diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-03-27 14:12:20 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-03-27 14:12:20 +0000 |
| commit | 0879fb9a869ed5105a01d00368450081cc30033f (patch) | |
| tree | 4bc4d43a22f9dd47c7212416f10d059caff1dedf /plugins/managesieve/lib | |
| parent | 678d48770e2890aacdd9c9bb71efe146731d100d (diff) | |
- 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
Diffstat (limited to 'plugins/managesieve/lib')
| -rw-r--r-- | plugins/managesieve/lib/rcube_sieve.php | 16 |
1 files changed, 7 insertions, 9 deletions
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'); } } |
