Code

Updated folder creation
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Dec 2008 09:20:55 +0000 (09:20 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Dec 2008 09:20:55 +0000 (09:20 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13293 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc
gosa-plugins/mail/personal/mail/class_mail-methods.inc

index 83876021874e2a7d546afa74abbd658cb9faf8ec..94c7ccc18c43f35441aed0760275dc04102a306a 100644 (file)
@@ -391,7 +391,6 @@ class mailMethodCyrus extends mailMethod{
     $folders= $this->getMailboxList();
     foreach ($folders as $subfolder){
       $folder_id = $this->create_folder_id($subfolder);
-      echo $folder_id."<br>";
 
       /* Remove all acl's for this folder */
       $users= @imap_getacl ($this->imap_handle, $folder_id);
index 56d8743eb87b004bfe0ed2492dbd3024446d4240..bb11ae22a36cf04234223f36812ac70810d805e5 100644 (file)
@@ -392,15 +392,17 @@ class mailMethod{
       $acc_string = $this->share_id;
     }
 
-    /* Create account prefix and respect "cyrusUseSlashes"
+    /* Create account prefix and respect "cyrusUseSlashes" 
        Do not replace escaped dots for cyrusUseSlashes.
      */
     $uattrib = $this->uattrib;
     if($this->cyrusUseSlashes){
-      $prefix = preg_replace('/([^\\\\])\./',"\\1/",$prefix);
+      $prefix     = preg_replace('/([^\\\\])\./',"\\1/",$prefix);
+      $acc_string = preg_replace('/([^\\\\])\./',"\\1/",$acc_string); 
     }
     $prefix = preg_replace("/\\\\([\.\/])/","\\1",$prefix);
-
+    $acc_string = preg_replace("/\\\\([\.\/])/","\\1",$acc_string); 
+  
     $domain = $mailpart = "";
     $mail = $this->parent->mail;
     if(preg_match("/\@/",$mail)){
@@ -409,11 +411,23 @@ class mailMethod{
 
     /* Create account_id
      */
-    $from = array("/%CN%/","/%UID%/","/%PREFIX%/","/%UATTRIB%/","/%DOMAIN%/","/%MAILPART%/","/%MAIL%/");
+    $from = array("/%cn%/i","/%uid%/i","/%prefix%/i","/%uattrib%/i","/%domain%/i","/%mailpart%/i","/%mail%/i");
     $to   = array($this->parent->cn,$this->parent->uid,$prefix,$this->parent->$uattrib, $domain, $mailpart,$mail);
-
     $acc_id = trim(strtolower(preg_replace($from,$to,$acc_string)));
 
+    /* Check for not replaced pattern.
+     */
+    if(preg_match("/%/",$acc_id)){
+      $notr = preg_replace("/^[^%]*/","",$acc_id);
+      if(!empty($notr)){
+        @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"<b>Warning</b>", 
+            sprintf("<b>MAIL: WARNING unknown pattern in account creation string '%s' near '%s'</b>", $acc_id, $notr));
+
+        /* Remove incomprehensible patterns */
+        $acc_id = preg_replace("/%[^%]+%/","",$acc_id);
+      }
+    }
+
     if(preg_match("/\@/",$acc_id)){
       list($mail,$domain) = split("\@",$acc_id);
       $str = trim($mail . $folder . "@" . $domain);