summaryrefslogtreecommitdiff
path: root/plugins/managesieve/lib
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-12-09 11:40:03 +0100
committerAleksander Machniak <alec@alec.pl>2013-12-09 11:40:03 +0100
commit27f0c2723bf8a5efb5a588c2603fbb0a65f0453d (patch)
tree4b85103d31ccf29fc63d4487ecd72572b355734b /plugins/managesieve/lib
parentfd0c123e44391aa01a85c5aeebbd0cea418f0808 (diff)
Nicely handle server-side modification of script names (#1489412)
Diffstat (limited to 'plugins/managesieve/lib')
-rw-r--r--plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
index e0f6ead9a..4a375d353 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -132,6 +132,11 @@ class rcube_sieve_engine
// Get list of scripts
$list = $this->list_scripts();
+ // reset current script when entering filters UI (#1489412)
+ if ($this->rc->action == 'plugin.managesieve') {
+ $this->rc->session->remove('managesieve_current');
+ }
+
if (!empty($_GET['_set']) || !empty($_POST['_set'])) {
$script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true);
}
@@ -179,15 +184,20 @@ class rcube_sieve_engine
case SIEVE_ERROR_CONNECTION:
case SIEVE_ERROR_LOGIN:
$this->rc->output->show_message('managesieve.filterconnerror', 'error');
+ rcube::raise_error(array('code' => 403, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Unable to connect to managesieve on $host:$port"), true, false);
break;
+
default:
$this->rc->output->show_message('managesieve.filterunknownerror', 'error');
break;
}
- rcube::raise_error(array('code' => 403, 'type' => 'php',
- 'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Unable to connect to managesieve on $host:$port"), true, false);
+ // reload interface in case of possible error when specified script wasn't found (#1489412)
+ if ($script_name !== null && !empty($list) && !in_array($script_name, $list)) {
+ $this->rc->output->command('reload', 500);
+ }
// to disable 'Add filter' button set env variable
$this->rc->output->set_env('filterconnerror', true);