Code

Updated table summary
[gosa.git] / gosa-plugins / mail / personal / mail / class_mailAccount.inc
index 7ef9e4171214064871fbb76ed1a8bac1b6fa109a..5be08f55851775a09c7fd643d8aca6760119ac26 100644 (file)
@@ -74,7 +74,7 @@ class mailAccount extends plugin
   var $sieveManagementUsed = FALSE;
   var $vacationTemplates = array();
   var $sieve_management = NULL;
-  var $selectMailAddress = FALSE;
+  var $mailAddressSelect = FALSE;
   var $initial_uid    = "";
   var $mailDomainPart = "";
   var $mailDomainParts = array();
@@ -244,9 +244,9 @@ class mailAccount extends plugin
         } else {
           $reason = "";
           if(!$this->mailMethod->accountCreateable($reason)){
-            $display= $this->show_disable_header(msgPool::addFeaturesButton(_("Mail")),$reason ,TRUE,TRUE);
+            $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Mail")),$reason ,TRUE,TRUE);
           }else{
-            $display= $this->show_disable_header(msgPool::addFeaturesButton(_("Mail")),msgPool::featuresDisabled(_("Mail")));
+            $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Mail")),msgPool::featuresDisabled(_("Mail")));
           }
           return ($display);
         }
@@ -281,18 +281,18 @@ class mailAccount extends plugin
      ****************/
 
     if (isset($_POST['add_local_forwarder'])){
-      $this->selectMailAddress=  new selectMailAddress($this->config, get_userinfo());
+      $this->mailAddressSelect=  new mailAddressSelect($this->config, get_userinfo());
       $this->dialog= TRUE;
     }
-    if (isset($_POST['selectMailAddress_cancel'])){
-      $this->selectMailAddress= FALSE;
+    if (isset($_POST['mailAddressSelect_cancel'])){
+      $this->mailAddressSelect= FALSE;
       $this->dialog= FALSE;
     }
 
-    if (isset($_POST['selectMailAddress_save']) && $this->selectMailAddress instanceOf selectMailAddress){
+    if (isset($_POST['mailAddressSelect_save']) && $this->mailAddressSelect instanceOf mailAddressSelect){
 
       if($this->acl_is_writeable("gosaMailForwardingAddress")){
-        $list = $this->selectMailAddress->save();
+        $list = $this->mailAddressSelect->save();
         foreach ($list as $entry){
           $val = $entry['mail'][0];
           if (!in_array ($val, $this->gosaMailAlternateAddress) && $val != $this->mail){
@@ -300,18 +300,22 @@ class mailAccount extends plugin
             $this->is_modified= TRUE;
           }
         }
-        $this->selectMailAddress= FALSE;
+        $this->mailAddressSelect= FALSE;
         $this->dialog= FALSE;
       } else {
         msg_dialog::display(_("Error"), _("Please select an entry!"), ERROR_DIALOG);
       }
     }
 
-    if($this->selectMailAddress instanceOf selectMailAddress){
+    if($this->mailAddressSelect instanceOf mailAddressSelect){
       $used  = array();
       $used['mail'] = array_values($this->gosaMailAlternateAddress);  
+      $used['mail'] = array_merge($used['mail'], array_values($this->gosaMailForwardingAddress));  
       $used['mail'][] = $this->mail;
-      return($this->selectMailAddress->execute());
+
+      // Build up blocklist
+      session::set('filterBlacklist', $used);
+      return($this->mailAddressSelect->execute());
     }
 
     if (isset($_POST['add_forwarder'])){
@@ -344,9 +348,9 @@ class mailAccount extends plugin
     if (isset($_POST['delete_forwarder'])){
       $this->delForwarder ($_POST['forwarder_list']);
     }
-    if ($this->selectMailAddress instanceOf selectMailAddress){
+    if ($this->mailAddressSelect instanceOf mailAddressSelect){
     
-      return($this->selectMailAddress->execute());
+      return($this->mailAddressSelect->execute());
     }
 
 
@@ -395,10 +399,9 @@ class mailAccount extends plugin
     $smarty->assign("isModifyableServer", $this->mailMethod->isModifyableServer());
     $smarty->assign("mailEqualsCN", $this->mailMethod->mailEqualsCN());
 
-    $SkipWrite = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
     $tmp  = $this->plInfo();
     foreach($tmp['plProvidedAcls'] as $name => $transl){
-      $smarty->assign("$name"."ACL", $this->getacl($name,$SkipWrite));
+      $smarty->assign("$name"."ACL", $this->getacl($name));
     }
     foreach($this->attributes as $attr){
       $smarty->assign($attr,$this->$attr);
@@ -742,6 +745,10 @@ class mailAccount extends plugin
       }
 
       foreach ($attrs as $val){
+
+        // We can only replace strings here
+        if(!is_string($obj->$val)) continue;
+
         if(preg_match("/dateOfBirth/",$val)){
           if($obj->use_dob){
             $contents= preg_replace("/%$val/",date("Y-d-m",$obj->dateOfBirth),$contents);