Aleksander Machniak
2016-04-13 302aff920c956d318f6f3262d7271ac5564dac78
Small code improvement
1 files modified
20 ■■■■ changed files
plugins/managesieve/lib/Roundcube/rcube_sieve_script.php 20 ●●●● patch | view | raw | blame | history
plugins/managesieve/lib/Roundcube/rcube_sieve_script.php
@@ -966,25 +966,33 @@
        $result = array();
        for ($i=0, $len=count($tokens); $i<$len; $i++) {
            if (!is_array($tokens[$i]) && preg_match('/^:comparator$/i', $tokens[$i])) {
            if (!is_array($tokens[$i]) && $tokens[$i][0] == ':') {
                if (preg_match('/^:comparator$/i', $tokens[$i])) {
                $test['comparator'] = $tokens[++$i];
                    continue;
            }
            else if (!is_array($tokens[$i]) && preg_match('/^:(count|value)$/i', $tokens[$i])) {
                if (preg_match('/^:(count|value)$/i', $tokens[$i])) {
                $test['type'] = strtolower(substr($tokens[$i], 1)) . '-' . $tokens[++$i];
                    continue;
            }
            else if (!is_array($tokens[$i]) && preg_match('/^:(is|contains|matches|regex)$/i', $tokens[$i])) {
                if (preg_match('/^:(is|contains|matches|regex)$/i', $tokens[$i])) {
                $test['type'] = strtolower(substr($tokens[$i], 1));
                    continue;
            }
            else if (!is_array($tokens[$i]) && preg_match('/^:index$/i', $tokens[$i])) {
                if (preg_match('/^:index$/i', $tokens[$i])) {
                $test['index'] = intval($tokens[++$i]);
                if ($tokens[$i+1] && preg_match('/^:last$/i', $tokens[$i+1])) {
                    $test['last'] = true;
                    $i++;
                }
                    continue;
           }
           else {
            }
               $result[] = $tokens[$i];
           }
        }
        $tokens = $result;