diff --git a/emailadmin/inc/class.emailadmin_imap_cyrus.inc.php b/emailadmin/inc/class.emailadmin_imap_cyrus.inc.php index d760d3c797..ce502b1000 100644 --- a/emailadmin/inc/class.emailadmin_imap_cyrus.inc.php +++ b/emailadmin/inc/class.emailadmin_imap_cyrus.inc.php @@ -205,4 +205,22 @@ class emailadmin_imap_cyrus extends emailadmin_imap } $this->disconnect(); } + + /** + * Proxy former bosieve methods to internal emailadmin_sieve instance + * + * @param string $name + * @param array $params + * @throws Exception + */ + public function __call($name,array $params=null) + { + switch($name) + { + case 'setRules': // call setRules with 3. param of true, to enable utf7imap fileinto for Cyrus + $params += array(null, null, true); + break; + } + return parent::__call($name, $params); + } } diff --git a/emailadmin/inc/class.emailadmin_script.inc.php b/emailadmin/inc/class.emailadmin_script.inc.php index 2778e6c5e1..d751a638d0 100644 --- a/emailadmin/inc/class.emailadmin_script.inc.php +++ b/emailadmin/inc/class.emailadmin_script.inc.php @@ -234,8 +234,13 @@ class emailadmin_script { } - // update and save sieve script - function updateScript ($connection) + /** + * update and save sieve script + * + * @param emailadmin_imap $connection + * @param boolean $utf7imap_fileinto =false true: encode foldernames with utf7imap, default utf8 + */ + function updateScript ($connection, $utf7imap_fileinto=false) { #global $_SESSION,$default,$sieve; global $default,$sieve; @@ -383,7 +388,8 @@ class emailadmin_script { if (!$rule['unconditional']) $newruletext .= ") {\n\t"; if (preg_match("/folder/i",$rule['action'])) { - $newruletext .= "fileinto \"" . $rule['action_arg'] . "\";"; + $newruletext .= "fileinto \"" . ($utf7imap_fileinto ? + translation::convert($rule['action_arg'],'utf-8', 'utf7-imap') : $rule['action_arg']) . "\";"; } if (preg_match("/reject/i",$rule['action'])) { $newruletext .= "reject text: \n" . $rule['action_arg'] . "\n.\n;"; diff --git a/emailadmin/inc/class.emailadmin_sieve.inc.php b/emailadmin/inc/class.emailadmin_sieve.inc.php index efdd0d4d70..4ea10697e8 100644 --- a/emailadmin/inc/class.emailadmin_sieve.inc.php +++ b/emailadmin/inc/class.emailadmin_sieve.inc.php @@ -569,13 +569,14 @@ class emailadmin_sieve extends Net_Sieve * * @param array $_rules * @param string $_scriptName + * @param boolean $utf7imap_fileinto =false true: encode foldernames with utf7imap, default utf8 */ - function setRules(array $_rules, $_scriptName=null) + function setRules(array $_rules, $_scriptName=null, $utf7imap_fileinto=false) { $script = $this->retrieveRules($_scriptName); $script->debug = $this->debug; $script->rules = $_rules; - $ret = $script->updateScript($this); + $ret = $script->updateScript($this, $utf7imap_fileinto); $this->error = $script->errstr; return $ret; } diff --git a/mail/inc/class.mail_sieve.inc.php b/mail/inc/class.mail_sieve.inc.php index 897b7e3091..926a217dac 100644 --- a/mail/inc/class.mail_sieve.inc.php +++ b/mail/inc/class.mail_sieve.inc.php @@ -236,7 +236,7 @@ class mail_sieve switch ($rules['action']) { case 'folder': - $content['action_folder_text'][] = translation::convert($rules['action_arg'],'utf-8','utf7-imap'); + $content['action_folder_text'][] = $rules['action_arg']; break; case 'address': @@ -285,7 +285,7 @@ class mail_sieve switch ($content['action']) { case 'folder': - $newRule['action_arg'] = translation::convert(implode($content['action_folder_text']), 'utf7-imap', 'utf-8'); + $newRule['action_arg'] = implode($content['action_folder_text']); break; case 'address': $newRule['action_arg'] = implode(',',$content['action_address_text']);