Fix PHP fatal error when visiting Vacation interface and there's no sieve script yet

pull/280/head
Aleksander Machniak 10 years ago
parent 9920097bfc
commit 9a833f6faa

@ -1,3 +1,5 @@
- Fix PHP fatal error when visiting Vacation interface and there's no sieve script yet
* version 8.2 [2015-01-14]
-----------------------------------------------------------
- Fix bug where actions without if/elseif/else in sieve scripts were skipped

@ -2344,12 +2344,12 @@ class rcube_sieve_engine
*/
protected function init_script()
{
$this->script = $this->sieve->script->as_array();
if (!$this->script) {
if (!$this->sieve->script) {
return;
}
$this->script = $this->sieve->script->as_array();
$headers = array();
$exceptions = array('date', 'currentdate', 'size', 'body');

@ -562,11 +562,20 @@ class rcube_sieve_vacation extends rcube_sieve_engine
$this->script_name = 'roundcube';
}
$this->script = array($rule);
$script_active = false;
// use default script contents
if (!$this->rc->config->get('managesieve_kolab_master')) {
$script_file = $this->rc->config->get('managesieve_default');
if ($script_file && is_readable($script_file)) {
$content = file_get_contents($script_file);
}
// if script exists
else {
}
// create and load script
if ($this->sieve->save_script($this->script_name, $content)) {
$this->sieve->load($this->script_name);
}
}
$script_active = in_array($this->script_name, $this->active);
// re-order rules if needed
@ -616,6 +625,9 @@ class rcube_sieve_vacation extends rcube_sieve_engine
}
}
}
if (!$this->sieve->script) {
return false;
}
$this->sieve->script->content = $this->script;

Loading…
Cancel
Save