From 0879fb9a869ed5105a01d00368450081cc30033f Mon Sep 17 00:00:00 2001 From: alec Date: Sun, 27 Mar 2011 14:12:20 +0000 Subject: - Moved elsif replacement code to handle only imports from other formats git-svn-id: https://svn.roundcube.net/trunk@4619 208e9e7b-5314-0410-a742-e7e81cd9613c --- plugins/managesieve/Changelog | 2 ++ plugins/managesieve/lib/rcube_sieve.php | 16 +++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index 8bbb12a90..7eb9f64dd 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -1,3 +1,5 @@ +- Moved elsif replacement code to handle only imports from other formats + * version 4.1 [2011-03-07] ----------------------------------------------------------- - Fix fileinto target is always INBOX (#1487776) diff --git a/plugins/managesieve/lib/rcube_sieve.php b/plugins/managesieve/lib/rcube_sieve.php index d701095f2..932522d22 100644 --- a/plugins/managesieve/lib/rcube_sieve.php +++ b/plugins/managesieve/lib/rcube_sieve.php @@ -291,18 +291,16 @@ class rcube_sieve if (empty($script->content)) { $script = $this->_import_rules($txt); $script = new rcube_sieve_script($script, $this->disabled, $this->exts); - } - // replace all elsif with if+stop, we support only ifs - foreach ($script->content as $idx => $rule) { - if (!isset($script->content[$idx+1]) - || preg_match('/^else|elsif$/', $script->content[$idx+1]['type'])) { + // replace all elsif with if+stop, we support only ifs + foreach ($script->content as $idx => $rule) { // 'stop' not found? - if (!preg_match('/^(stop|vacation)$/', $rule['actions'][count($rule['actions'])-1]['type'])) { - $script->content[$idx]['actions'][] = array( - 'type' => 'stop' - ); + foreach ($rule['actions'] as $action) { + if (preg_match('/^(stop|vacation)$/', $action['type'])) { + continue 2; + } } + $script->content[$idx]['actions'][] = array('type' => 'stop'); } } -- cgit v1.2.3