Aleksander Machniak
2015-02-19 50b04366ee7472272e2576d17c609e1d26345221
plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -63,7 +63,7 @@
        1 => 'notifyimportancehigh'
    );
    const VERSION  = '8.1';
    const VERSION  = '8.2';
    const PROGNAME = 'Roundcube (Managesieve)';
    const PORT     = 4190;
@@ -220,14 +220,14 @@
     *
     * @return int Connection status: 0 on success, >0 on failure
     */
    public function load_script($script_name = null)
    protected function load_script($script_name = null)
    {
        // Get list of scripts
        $list = $this->list_scripts();
        if ($script_name === null || $script_name === '') {
            // get (first) active script
            if (!empty($this->active[0])) {
            if (!empty($this->active)) {
               $script_name = $this->active[0];
            }
            else if ($list) {
@@ -2078,7 +2078,6 @@
        // Handle active script(s) and list of scripts according to Kolab's KEP:14
        if ($this->rc->config->get('managesieve_kolab_master')) {
            // Skip protected names
            foreach ((array)$this->list as $idx => $name) {
                $_name = strtoupper($name);
@@ -2106,7 +2105,10 @@
                    foreach ($rules['actions'] as $action) {
                        if ($action['type'] == 'include' && empty($action['global'])) {
                            $name = preg_replace($filename_regex, '', $action['target']);
                            $this->active[] = $name;
                            // make sure the script exist
                            if (in_array($name, $this->list)) {
                                $this->active[] = $name;
                            }
                        }
                    }
                }
@@ -2138,6 +2140,11 @@
            if (!empty($exceptions)) {
                $this->list = array_diff($this->list, (array)$exceptions);
            }
        }
        // reindex
        if (!empty($this->list)) {
            $this->list = array_values($this->list);
        }
        return $this->list;
@@ -2337,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');