Code

IE Psot fix ....
[gosa.git] / include / class_mail-methods-cyrus.inc
index 2c5c532cb96e60ebccc4efc55ecd2a6dded10dcc..836e290197faccf0e0e1069c18df43d6c6927323 100644 (file)
@@ -31,11 +31,20 @@ class mailMethodCyrus extends mailMethod
 
   function connect($gosaMailServer)
   {
+    $cfg=array();
+
     /* Connect to IMAP server. I don't want to see these warning here... */
     $this->gosaMailServer= $gosaMailServer;
-    $cfg= $this->config[$gosaMailServer];
-
+    if (!isset($this->config[$gosaMailServer])){
+      print_red(_("Warning: Account has an invalid mailserver string! Please check the mail server settings in the mail tab."));
+    } else {
+      $cfg= $this->config[$gosaMailServer];
+    }
     /* For some reason, hiding errors with @ does not wor here... */
+    if(!isset($cfg['connect']))   $cfg['connect']="";
+    if(!isset($cfg['admin']))     $cfg['admin']="";
+    if(!isset($cfg['password']))  $cfg['password']="";
+
     $this->mbox = @imap_open($cfg['connect'], $cfg['admin'], $cfg['password'], OP_HALFOPEN);
 
     /* Mailbox reachable? */
@@ -64,7 +73,7 @@ class mailMethodCyrus extends mailMethod
         $result['quotaUsage']=    $quota_value["STORAGE"]['usage'];
         $result['gosaMailQuota']= $quota_value["STORAGE"]['limit'];
       } else {
-        /* backward compatible */
+        /* backward icompatible */
         $result['quotaUsage']=    $quota_value['usage'];
         $result['gosaMailQuota']= $quota_value['limit'];
       }
@@ -128,12 +137,6 @@ class mailMethodCyrus extends mailMethod
 
   function setSharedFolderPermissions($folder, $permissions)
   {
-    /* Show warning message in case of missing imap_getacl */
-    if (!function_exists('imap_getacl')){
-      print_red (_("Warning: imap_getacl is not implemented, wouldn't modify acl informations."));
-      return;
-    }
-
     /* Get list of subfolders */
     $folders= $this->getMailboxList($folder, "");
     $folders[]= $folder;
@@ -148,6 +151,8 @@ class mailMethodCyrus extends mailMethod
         foreach ($users as $userid => $perms){
           imap_setacl ($this->mbox, $subfolder, $userid, "");
         }
+      } else {
+        print_red (_("Warning: imap_getacl is not implemented, can't remove acl informations."));
       }
 
       /* Set permissions for this folder */