Fix bug where managesieve_allowed_hosts config wasn't respected on mail screen (#6295)

pull/6302/head
Aleksander Machniak 7 years ago
parent 53fe9d7048
commit 339121b121

@ -38,6 +38,13 @@ class managesieve extends rcube_plugin
{ {
$this->rc = rcube::get_instance(); $this->rc = rcube::get_instance();
$this->load_config();
$allowed_hosts = $this->rc->config->get('managesieve_allowed_hosts');
if (!empty($allowed_hosts) && !in_array($_SESSION['storage_host'], (array) $allowed_hosts)) {
return;
}
// register actions // register actions
$this->register_action('plugin.managesieve', array($this, 'managesieve_actions')); $this->register_action('plugin.managesieve', array($this, 'managesieve_actions'));
$this->register_action('plugin.managesieve-action', array($this, 'managesieve_actions')); $this->register_action('plugin.managesieve-action', array($this, 'managesieve_actions'));
@ -100,16 +107,9 @@ class managesieve extends rcube_plugin
*/ */
function settings_actions($args) function settings_actions($args)
{ {
$this->load_config();
$allowed_hosts = $this->rc->config->get('managesieve_allowed_hosts');
$vacation_mode = (int) $this->rc->config->get('managesieve_vacation'); $vacation_mode = (int) $this->rc->config->get('managesieve_vacation');
$forward_mode = (int) $this->rc->config->get('managesieve_forward'); $forward_mode = (int) $this->rc->config->get('managesieve_forward');
if (!empty($allowed_hosts) && !in_array($_SESSION['storage_host'], (array) $allowed_hosts)) {
return;
}
// register Filters action // register Filters action
if ($vacation_mode != 2 && $forward_mode != 2) { if ($vacation_mode != 2 && $forward_mode != 2) {
$args['actions'][] = array( $args['actions'][] = array(
@ -269,14 +269,12 @@ class managesieve extends rcube_plugin
public function get_engine($type = null) public function get_engine($type = null)
{ {
if (!$this->engine) { if (!$this->engine) {
$this->load_config();
// Add include path for internal classes // Add include path for internal classes
$include_path = $this->home . '/lib' . PATH_SEPARATOR; $include_path = $this->home . '/lib' . PATH_SEPARATOR;
$include_path .= ini_get('include_path'); $include_path .= ini_get('include_path');
set_include_path($include_path); set_include_path($include_path);
$class_name = 'rcube_sieve_' . ($type ?: 'engine'); $class_name = 'rcube_sieve_' . ($type ?: 'engine');
$this->engine = new $class_name($this); $this->engine = new $class_name($this);
} }

Loading…
Cancel
Save