summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-11-30 12:06:12 +0000
committeralecpl <alec@alec.pl>2009-11-30 12:06:12 +0000
commitc55337ce67ff50b2b2836852939b3ec79316215b (patch)
tree4a1123666e316f2819d97d01fc726837049b7bea
parent6c95809d10fda20d522a6a09b861f20bed43ee8c (diff)
- write error to log if connection to managesieve server cannot be established
-rw-r--r--plugins/managesieve/managesieve.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php
index 92185e083..065524032 100644
--- a/plugins/managesieve/managesieve.php
+++ b/plugins/managesieve/managesieve.php
@@ -61,11 +61,13 @@ class managesieve extends rcube_plugin
require_once($this->home . '/lib/Net/Sieve.php');
require_once($this->home . '/lib/rcube_sieve.php');
+ $host = str_replace('%h', $_SESSION['imap_host'], $this->rc->config->get('managesieve_host', 'localhost'));
+ $port = $this->rc->config->get('managesieve_port', 2000);
+
// try to connect to managesieve server and to fetch the script
$this->sieve = new rcube_sieve($_SESSION['username'],
$this->rc->decrypt($_SESSION['password']),
- str_replace('%h', $_SESSION['imap_host'], $this->rc->config->get('managesieve_host', 'localhost')),
- $this->rc->config->get('managesieve_port', 2000),
+ $host, $port,
$this->rc->config->get('managesieve_usetls', false),
$this->rc->config->get('managesieve_disabled_extensions'),
$this->rc->config->get('managesieve_debug', false)
@@ -120,6 +122,9 @@ class managesieve extends rcube_plugin
$this->rc->output->show_message('managesieve.filterunknownerror', 'error');
break;
}
+
+ raise_error(array('code' => 403, 'type' => 'php', 'message' => "Unable to connect to managesieve on $host:$port"), true, false);
+
// to disable 'Add filter' button set env variable
$this->rc->output->set_env('filterconnerror', true);
$this->script = array();
@@ -547,10 +552,12 @@ class managesieve extends rcube_plugin
$select = new html_select(array('name' => '_set', 'id' => $attrib['id'], 'onchange' => 'rcmail.managesieve_set()'));
- asort($list, SORT_LOCALE_STRING);
+ if ($list) {
+ asort($list, SORT_LOCALE_STRING);
- foreach($list as $set)
- $select->add($set . ($set == $active ? ' ('.$this->gettext('active').')' : ''), $set);
+ foreach($list as $set)
+ $select->add($set . ($set == $active ? ' ('.$this->gettext('active').')' : ''), $set);
+ }
$out = $select->show($this->sieve->current);