From 97e3a11fcae7e88e06522effcd36cf92552efc0b Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 7 Aug 2006 10:22:29 +0000 Subject: [PATCH] Fixed checkbox saving git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4413 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/personal/mail/class_mailAccount.inc | 80 +++++++++------------ 1 file changed, 33 insertions(+), 47 deletions(-) diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index 1d9c3131a..a8a201e39 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -237,10 +237,13 @@ class mailAccount extends plugin } /* Handle account state */ - /* Do we need to flip is_account state? */ - if (isset($_POST['modify_state'])){ - $this->is_account= !$this->is_account; + if(isset($_POST['modify_state'])){ + if($this->is_account && $this->acl_is_removeable()){ + $this->is_account= FALSE; + }elseif(!$this->is_account && $this->acl_is_createable()){ + $this->is_account= TRUE; + } } /* Do we represent a valid account? */ @@ -534,32 +537,6 @@ class mailAccount extends plugin } } - if (preg_match("/V/", $this->gosaMailDeliveryMode)) { - $smarty->assign("use_vacation", "checked"); - } else { - $smarty->assign("use_vacation", ""); - } - if (preg_match("/S/", $this->gosaMailDeliveryMode)) { - $smarty->assign("use_spam_filter", "checked"); - } else { - $smarty->assign("use_spam_filter", ""); - } - if (preg_match("/R/", $this->gosaMailDeliveryMode)) { - $smarty->assign("use_mailsize_limit", "checked"); - } else { - $smarty->assign("use_mailsize_limit", ""); - } - if (preg_match("/I/", $this->gosaMailDeliveryMode)) { - $smarty->assign("only_local", "checked"); - } else { - $smarty->assign("only_local", ""); - } - if (preg_match("/C/", $this->gosaMailDeliveryMode)) { - $smarty->assign("own_script", "checked"); - } else { - $smarty->assign("own_script", ""); - } - /* Have vacation templates? */ $smarty->assign("template", ""); if (count($this->vacation)){ @@ -651,27 +628,36 @@ class mailAccount extends plugin C: Use custm sieve script I: Only insider delivery */ - $tmp= ""; - if (!isset($_POST["drop_own_mails"])){ - $tmp.= "L"; - } - if (isset($_POST["use_mailsize_limit"])){ - $tmp.= "R"; - } - if (isset($_POST["use_spam_filter"])){ - $tmp.= "S"; - } - if (isset($_POST["use_vacation"])){ - $tmp.= "V"; - } - if (isset($_POST["own_script"])){ - $tmp.= "C"; + $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode); + + + /* Handle delivery flags */ + if($this->acl_is_writeable("gosaMailDeliveryModeL")){ + if(!preg_match("/L/",$tmp) && !isset($_POST['drop_own_mails'])){ + $tmp.="L"; + }elseif(preg_match("/L/",$tmp) && isset($_POST['drop_own_mails'])){ + $tmp = preg_replace("/L/","",$tmp); + } } - if (isset($_POST["only_local"])){ - $tmp.= "I"; + + $opts = array( + "R" => "use_mailsize_limit", + "S" => "use_spam_filter", + "V" => "use_vacation", + "C" => "own_script", + "I" => "only_local"); + + foreach($opts as $flag => $post){ + if($this->acl_is_writeable("gosaMailDeliveryMode".$flag)){ + if(!preg_match("/".$flag."/",$tmp) && isset($_POST[$post])){ + $tmp.= $flag; + }elseif(preg_match("/".$flag."/",$tmp) && !isset($_POST[$post])){ + $tmp = preg_replace("/".$flag."/","",$tmp); + } + } } - $tmp= "[$tmp]"; + $tmp= "[$tmp]"; if ($this->gosaMailDeliveryMode != $tmp){ $this->is_modified= TRUE; } -- 2.30.2