diff --git a/gosa-plugins/mail/personal/mail/class_mailAccount.inc b/gosa-plugins/mail/personal/mail/class_mailAccount.inc
index e5cc18f8cf4551366f2094541a9289d2a5d36341..1d3993a1dca3468f42cd1e203e80e3ace9dc3d26 100644 (file)
*/
+/*
+
+ FLAG POSTNAME DESC
+ ####################################################################################################
+ L (!) only_local Enables: "User is only allowed to send and receive local mails"
+
+ <REVERSED> If checked in the ui, the flag is not present in the
+ gosaMailDeliveryMode attribute. If its unchecked in the ui, the
+ character 'L' is added to the delivery flags.
+
+ R use_mailsize_limit Enables rule: "Reject mails bigger than [n] MB";
+ S use_spam_filter Enables rule: "Move mails tagged with SPAM level greater than [n]
+ to folder [x]"
+ V use_vacation Enables: "Vacation message"
+ C own_script Enables: "Use custom sieve script (disables all Mail options!)"
+ I drop_own_mails Enables: "No delivery to own mailbox."
+
+*/
+
class mailAccount extends plugin
{
/* Definitions */
var $plHeadline = "Mail";
- var $plDescription = "This does something";
+ var $plDescription = "Manage personal mail settings";
var $view_logged = FALSE;
var $is_account = FALSE;
var $initially_was_account = FALSE;
/* Initialize configured values
*/
- if($this->is_account){
+ if($this->is_account && !$this->is_template){
if($this->mailMethod->connect() && $this->mailMethod->account_exists()){
if($this->mailMethod->domainSelectionEnabled()){
$this->mailDomainPart = preg_replace("/^[^@]*+@/","",$this->mail);
$this->mail = preg_replace("/@.*$/","\\1",$this->mail);
- if(!in_array($this->mailDomainPart,$this->mailDomainParts)){
+ if(!in_array_strict($this->mailDomainPart,$this->mailDomainParts)){
$this->mailDomainParts[] = $this->mailDomainPart;
}
}
$list = $this->mailAddressSelect->save();
foreach ($list as $entry){
$val = $entry['mail'][0];
- if (!in_array ($val, $this->gosaMailAlternateAddress) && $val != $this->mail){
+ if (!in_array_strict($val, $this->gosaMailAlternateAddress) && $val != $this->mail){
$this->addForwarder($val);
$this->is_modified= TRUE;
}
return($this->mailAddressSelect->execute());
}
- if (isset($_POST['add_forwarder'])){
- if ($_POST['forward_address'] != ""){
+ if (isset($_POST['add_forwarder']) && isset($_POST['forward_address'])){
+ if (!empty($_POST['forward_address'])){
$address= get_post('forward_address');
$valid= FALSE;
if (!tests::is_email($address)){
}
}
} elseif ($address == $this->mail
- || in_array($address, $this->gosaMailAlternateAddress)) {
+ || in_array_strict($address, $this->gosaMailAlternateAddress)) {
msg_dialog::display(_("Error"),_("Cannot add primary address to the list of forwarders!") , ERROR_DIALOG);
} else {
$valid= TRUE;
}
}
}
- if (isset($_POST['delete_forwarder'])){
+ if (isset($_POST['delete_forwarder']) && isset($_POST['forwarder_list'])){
$this->delForwarder ($_POST['forwarder_list']);
}
if ($this->mailAddressSelect instanceOf mailAddressSelect){
/* _Multiple users vars_ */
foreach($this->attributes as $attr){
$u_attr = "use_".$attr;
- $smarty->assign($u_attr,in_array($attr,$this->multi_boxes));
+ $smarty->assign($u_attr,in_array_strict($attr,$this->multi_boxes));
}
foreach(array("only_local","gosaMailForwardingAddress","use_mailsize_limit","drop_own_mails","use_vacation","use_spam_filter") as $attr){
$u_attr = "use_".$attr;
- $smarty->assign($u_attr,in_array($attr,$this->multi_boxes));
+ $smarty->assign($u_attr,in_array_strict($attr,$this->multi_boxes));
}
*/
$smarty->assign("spamlevel", $this->SpamLevels);
$smarty->assign("spambox" , $this->MailBoxes);
-
+ $smarty->assign("is_template", $this->is_template);
$smarty->assign("multiple_support",$this->multiple_support_active);
return($display.$smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
}
$server = $this->gosaMailServer;
plugin::save_object();
- if(!$this->mailMethod->isModifyableServer() && $this->initially_was_account){
+ if(!$this->mailMethod->isModifyableServer() && $this->initially_was_account && !$this->is_template){
$this->gosaMailServer = $server;
}
- if(!$this->mailMethod->isModifyableMail() && $this->initially_was_account){
+ if(!$this->mailMethod->isModifyableMail() && $this->initially_was_account && !$this->is_template){
$this->mail = $mail;
}else{
/* Get posted mail domain part, if necessary
*/
if($this->mailMethod->domainSelectionEnabled() && isset($_POST['MailDomain'])){
- if(in_array(get_post('MailDomain'), $this->mailDomainParts)){
+ if(in_array_strict(get_post('MailDomain'), $this->mailDomainParts)){
$this->mailDomainPart = get_post('MailDomain');
}
}
}
return ($attrs["uid"][0]);
}
- if (!in_array($address, $this->gosaMailAlternateAddress)){
+ if (!in_array_strict($address, $this->gosaMailAlternateAddress)){
$this->gosaMailAlternateAddress[]= $address;
$this->is_modified= TRUE;
}
}
if ($this->is_template){
if (!tests::is_email($mail, TRUE)){
- $message[]= msgPool::invalid(_("Mail address"),"","","%givenName.%sn@your-domain.com");
+ $message[]= msgPool::invalid(_("Mail address"),"","","{%givenName}.{%sn}@your-domain.com");
}
} else {
if (!tests::is_email($mail)){
foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
- if (in_array($val, $skip)){
+ if (in_array_strict($val, $skip)){
continue;
}
$value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
}
}
+
+ // Remove non ASCII charcters
+ $value = iconv('UTF-8', 'US-ASCII//TRANSLIT', $value);
+ $value = preg_replace('/[^(\x20-\x7F)]*/','',$value);
+
+ // No spaces are allowed here
+ $value = preg_replace("/[ ]/","", $value);
array_push($this->$val, strtolower(rewrite($value)));
}
}
}
$this->mail= strtolower(rewrite($this->mail));
+ // Remove non ASCII charcters
+ $this->mail= iconv('UTF-8', 'US-ASCII//TRANSLIT', $this->mail);
+ $this->mail= preg_replace('/[^(\x20-\x7F)]*/','',$this->mail);
+
+ // No spaces are allowed here
+ $this->mail = preg_replace("/[ ]/","", $this->mail);
+
// Fix mail address when using templates
if($this->is_account && $this->mailMethod->domainSelectionEnabled()){
$this->mailDomainPart = preg_replace("/^[^@]*+@/","",$this->mail);
$this->mail = preg_replace("/@.*$/","\\1",$this->mail);
- if(!in_array($this->mailDomainPart,$this->mailDomainParts)){
+ if(!in_array_strict($this->mailDomainPart,$this->mailDomainParts)){
$this->mailDomainParts[] = $this->mailDomainPart;
}
}
if($this->mailMethod->domainSelectionEnabled()){
$this->mailDomainPart = preg_replace("/^[^@]*+@/","",$this->mail);
$this->mail = preg_replace("/@.*$/","\\1",$this->mail);
- if(!in_array($this->mailDomainPart,$this->mailDomainParts)){
+ if(!in_array_strict($this->mailDomainPart,$this->mailDomainParts)){
$this->mailDomainParts[] = $this->mailDomainPart;
}
}
function get_multi_edit_values()
{
$ret = plugin::get_multi_edit_values();
- if(in_array("gosaMailQuota",$this->multi_boxes)){
+ if(in_array_strict("gosaMailQuota",$this->multi_boxes)){
$ret['gosaMailQuota'] = $this->gosaMailQuota;
}
$flag_add = $flag_remove = array();
"C" => "own_script",
"I" => "drop_own_mails");
foreach($opts as $flag => $post){
- if(in_array($post, $this->multi_boxes)){
+ if(in_array_strict($post, $this->multi_boxes)){
if(preg_match("/".$flag."/",$tmp)){
$flag_add[] = $flag;
}else{
$ret['flag_remove'] = $flag_remove;
if($this->mailMethod->vacationRangeEnabled()){
- if(in_array("V",$flag_add)){
+ if(in_array_strict("V",$flag_add)){
$ret['gosaVacationStart'] = $this->gosaVacationStart = get_post('gosaVacationStart');
$ret['gosaVacationStop'] = $this->gosaVacationStop = get_post('gosaVacationStop');
}
{
$message = plugin::multiple_check();
- if(empty($this->gosaMailServer) && in_array("gosaMailServer",$this->multi_boxes)){
+ if(empty($this->gosaMailServer) && in_array_strict("gosaMailServer",$this->multi_boxes)){
$message[]= msgPool::noserver(_("Mail"));
}
/* Check quota */
- if ($this->gosaMailQuota != '' && in_array("gosaMailQuota",$this->multi_boxes)){
+ if ($this->gosaMailQuota != '' && in_array_strict("gosaMailQuota",$this->multi_boxes)){
if (!is_numeric($this->gosaMailQuota)) {
$message[]= msgPool::invalid(_("Quota size"),$this->gosaMailQuota,"/^[0-9]*/");
} else {
}
/* Check rejectsize for integer */
- if ($this->gosaMailMaxSize != '' && in_array("gosaMailMaxSize",$this->multi_boxes)){
+ if ($this->gosaMailMaxSize != '' && in_array_strict("gosaMailMaxSize",$this->multi_boxes)){
if (!is_numeric($this->gosaMailMaxSize)){
$message[]= msgPool::invalid(_("Mail reject size"),$this->gosaMailMaxSize,"/^[0-9]*/");
} else {
}
}
- if(empty($this->gosaSpamMailbox) && in_array("gosaSpamMailbox",$this->multi_boxes)){
+ if(empty($this->gosaSpamMailbox) && in_array_strict("gosaSpamMailbox",$this->multi_boxes)){
$message[]= msgPool::required(_("Spam folder"));
}
"name" => "cyrusDeleteMailbox",
"type" => "bool",
"default" => 'true',
- "description" => _("The 'cyrusDeleteMailbox' statement determines if GOsa should remove the mailbox from your IMAP server or keep it after the account is deleted in LDAP."),
+ "description" => _("Remove mail boxes from the IMAP storage after they their user gets removed."),
"check" => "gosaProperty::isBool",
"migrate" => "",
"group" => "mail",
"name" => "cyrusAutocreateFolders",
"type" => "string",
"default" => "",
- "description" => _("The 'cyrusAutocreateFolders' statement contains a comma seperated list of personal IMAP folders that should be created along initial account creation."),
+ "description" => _("Comma separated list of folders to be automatically created on user creation."),
"check" => "gosaProperty::isString",
"migrate" => "",
"group" => "mail",
"gosaMailDeliveryModeV" => _("Add vacation information"), // This is flag of gosaMailDeliveryMode
"gosaVacationMessage" => _("Vacation message"),
- "gosaMailDeliveryModeS" => _("Use spam filter"), // This is flag of gosaMailDeliveryMode
- "gosaSpamSortLevel" => _("Spam level"),
- "gosaSpamMailbox" => _("Spam mail box"),
+ "gosaMailDeliveryModeS" => _("Use SPAM filter"), // This is flag of gosaMailDeliveryMode
+ "gosaSpamSortLevel" => _("SPAM level"),
+ "gosaSpamMailbox" => _("SPAM mail box"),
"sieveManagement" => _("Sieve management"),
- "gosaMailDeliveryModeR" => _("Reject due to mailsize"), // This is flag of gosaMailDeliveryMode
+ "gosaMailDeliveryModeR" => _("Reject due to mail size"), // This is flag of gosaMailDeliveryMode
"gosaMailMaxSize" => _("Mail max size"),
"gosaMailForwardingAddress" => _("Forwarding address"),