From 00a1759129ff756867a74b61561ad85e97f71bc8 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Thu, 12 Mar 2015 06:32:00 -0400
Subject: [PATCH] Fix handling of header test with one-element array as header name
---
plugins/managesieve/composer.json | 2 +-
plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php | 28 +++++++++++++++-------------
plugins/managesieve/Changelog | 3 +++
3 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog
index 8ce63c8..9291d55 100644
--- a/plugins/managesieve/Changelog
+++ b/plugins/managesieve/Changelog
@@ -1,4 +1,7 @@
+* version 8.3 [2015-03-12]
+-----------------------------------------------------------
- Fix PHP fatal error when visiting Vacation interface and there's no sieve script yet
+- Fix handling of header test with one-element array as header name
* version 8.2 [2015-01-14]
-----------------------------------------------------------
diff --git a/plugins/managesieve/composer.json b/plugins/managesieve/composer.json
index 6d640da..529167f 100644
--- a/plugins/managesieve/composer.json
+++ b/plugins/managesieve/composer.json
@@ -3,7 +3,7 @@
"type": "roundcube-plugin",
"description": "Adds a possibility to manage Sieve scripts (incoming mail filters). It's clickable interface which operates on text scripts and communicates with server using managesieve protocol. Adds Filters tab in Settings.",
"license": "GPLv3+",
- "version": "8.2",
+ "version": "8.3",
"authors": [
{
"name": "Aleksander Machniak",
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
index 98c4c95..2f2791d 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -63,7 +63,7 @@
1 => 'notifyimportancehigh'
);
- const VERSION = '8.2';
+ const VERSION = '8.3';
const PROGNAME = 'Roundcube (Managesieve)';
const PORT = 4190;
@@ -1394,19 +1394,21 @@
}
if (isset($rule['test'])) {
- if (in_array($rule['test'], array('header', 'address', 'envelope'))
- && !is_array($rule['arg1'])
- && ($header = strtolower($rule['arg1']))
- && isset($this->headers[$header])
- ) {
- $test = $header;
+ if (in_array($rule['test'], array('header', 'address', 'envelope'))) {
+ if (is_array($rule['arg1']) && count($rule['arg1']) == 1) {
+ $rule['arg1'] = $rule['arg1'][0];
+ }
+
+ $matches = ($header = strtolower($rule['arg1'])) && isset($this->headers[$header]);
+ $test = $matches ? $header : '...';
}
- else if ($rule['test'] == 'exists'
- && !is_array($rule['arg'])
- && ($header = strtolower($rule['arg']))
- && isset($this->headers[$header])
- ) {
- $test = $header;
+ else if ($rule['test'] == 'exists') {
+ if (is_array($rule['arg']) && count($rule['arg']) == 1) {
+ $rule['arg'] = $rule['arg'][0];
+ }
+
+ $matches = ($header = strtolower($rule['arg'])) && isset($this->headers[$header]);
+ $test = $matches ? $header : '...';
}
else if (in_array($rule['test'], array('size', 'body', 'date', 'currentdate'))) {
$test = $rule['test'];
--
Gitblit v1.9.1