diff --git a/gosa-plugins/mail/personal/mail/class_mail-methods.inc b/gosa-plugins/mail/personal/mail/class_mail-methods.inc
index 56d8743eb87b004bfe0ed2492dbd3024446d4240..a17d77e4a0462d88de166d22461705d524590a50 100644 (file)
/* Create accounts in cyrus style with '/' instead of '.' */
protected $cyrusUseSlashes= FALSE;
+ /* gosaSharedFolderTarget settings,
+ * E.g.
+ * For an accountID like: 'share/herberts.folder@gonicus.de' the value 'dummy+'
+ * will result in gosaSharedFolderTarget: dummy+share/herberts.folder@gonicus.de
+ */
+ protected $gosaSharedPrefix = '';
+
/* The atribute mapping for this class Source --> Destination */
protected $attributes = array();
protected $userObjectClasses = array();
protected $shareObjectClasses = array();
- /* Enabled mail domain selection. If enabled getMailDomains must the domain parts */
+ /* Enabled mail domain selection. If enabled getMailDomains() have to return an array
+ * with the domain parts.
+ */
protected $enableDomainSelection= FALSE;
protected $enableQuota = TRUE;
protected $enableSieveManager = FALSE;
"<b>MAIL:</b> Shared folder creation set to");
$this->share_id = $tmp;
}
+ $tmp = $this->config->get_cfg_value("gosaSharedPrefix");
+ if(!empty($tmp)){
+ @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<i>".$tmp."</i>",
+ "<b>MAIL:</b> Shared folder prefix set to");
+ $this->gosaSharedPrefix = $tmp;
+ }
$this->build_account_id();
$this->initial_account_id = $this->account_id;
}else{
$this->parent->attrs['objectClass'] =
array_remove_entries_ics($this->shareObjectClasses, $this->parent->attrs['objectClass']);
+ $this->parent->attrs['gosaSharedFolderTarget'] =array();
}
foreach($this->attributes as $source => $dest){
$this->attrs[$dest] = array();
$this->parent->attrs['objectClass'][] = $oc;
}
}
+
+ // Add gosaSharedFolderTarget for groups.
+ $this->build_account_id();
+ if($this->type == "group"){
+ $this->parent->attrs['gosaSharedFolderTarget'] =
+ $this->gosaSharedPrefix.$this->account_id;
+ }
}
$domain = $mailpart = "";
$mail = $this->parent->mail;
if(preg_match("/\@/",$mail)){
- list($mailpart,$domain) = split("\@",$mail);
+ list($mailpart,$domain) = explode("@",$mail);
}
/* Create account_id
$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)){
- list($mailpart,$domain) = split("\@",$mail);
+ list($mailpart,$domain) = explode("@",$mail);
}
/* 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);
+ list($mail,$domain) = explode("@",$acc_id);
$str = trim($mail . $folder . "@" . $domain);
}else{
$str = trim($acc_id . $folder);
$tmp->init();
return($tmp);
}else{
- @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "","<b>MAIL: Invalid mailMethod defined: <b>".$cls.
- "</b> falling back to <b>".get_class($this)."</b>");
+ @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "","<b>MAIL: Invalid mailMethod defined: ".$cls.
+ " falling back to ".get_class($this)."</b>");
/* Print out configuration errors directly, we can't catch them everywhere.
*/