Aleksander Machniak
2015-02-18 3e0ad293e118a078d227ca15aaab7cf6cbdb0851
Fix PHP fatal error when visiting Vacation interface and there's no sieve script yet
3 files modified
28 ■■■■ changed files
plugins/managesieve/Changelog 2 ●●●●● patch | view | raw | blame | history
plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php 6 ●●●● patch | view | raw | blame | history
plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php 20 ●●●● patch | view | raw | blame | history
plugins/managesieve/Changelog
@@ -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
plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -2344,12 +2344,12 @@
     */
    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');
plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
@@ -562,11 +562,20 @@
                $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 @@
                    }
                }
            }
        if (!$this->sieve->script) {
            return false;
        }
        $this->sieve->script->content = $this->script;