From e9952dceceaccb20b5c2a4fd326e0bd86d6c95f1 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 15 Dec 2008 09:20:55 +0000 Subject: [PATCH] Updated folder creation git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13293 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../mail/class_mail-methods-cyrus.inc | 1 - .../mail/personal/mail/class_mail-methods.inc | 24 +++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc b/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc index 838760218..94c7ccc18 100644 --- a/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc +++ b/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc @@ -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."
"; /* Remove all acl's for this folder */ $users= @imap_getacl ($this->imap_handle, $folder_id); diff --git a/gosa-plugins/mail/personal/mail/class_mail-methods.inc b/gosa-plugins/mail/personal/mail/class_mail-methods.inc index 56d8743eb..bb11ae22a 100644 --- a/gosa-plugins/mail/personal/mail/class_mail-methods.inc +++ b/gosa-plugins/mail/personal/mail/class_mail-methods.inc @@ -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__,"Warning", + sprintf("MAIL: WARNING unknown pattern in account creation string '%s' near '%s'", $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); -- 2.30.2