roundcubemail/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
public function deactivate_script($name)
    {
        // Kolab's KEP:14
        if ($this->rc->config->get('managesieve_kolab_master')) {
            $extension   = $this->rc->config->get('managesieve_filename_extension', '.sieve');
            $user_script = $_SESSION['managesieve_user_script'];

            // if the script is active...
            if ($user_script && ($key = array_search($name, $this->active)) !== false) {
                // ...rewrite USER file removing appropriate include command
                if ($this->sieve->load($user_script)) {
                    $script = $this->sieve->script->as_array();
                    $name   = $name.$extension;

                    foreach ($script as $rid => $rules) {
                        foreach ($rules['actions'] as $action) {
                            if ($action['type'] == 'include' && empty($action['global'])
                                && $action['target'] == $name
                            ) {
                                break 2;
                            }
                        }
                    }

                    // Entry found
                    if ($rid < count($script)) {
                        $this->sieve->script->delete_rule($rid);
                        $result = $this->sieve->save();
                        if ($result) {
                            unset($this->active[$key]);
                        }
                    }
                }
            }
        }
        else {
            $result = $this->sieve->deactivate();
            if ($result)
                $this->active = array();
        }

        return $result;
    }
public function deactivate_script($name)
    {
        // Kolab's KEP:14
        if ($this->rc->config->get('managesieve_kolab_master')) {
            $extension   = $this->rc->config->get('managesieve_filename_extension', '.sieve');
            $user_script = $_SESSION['managesieve_user_script'];

            // if the script is active...
            if ($user_script && ($key = array_search($name, $this->active)) !== false) {
                // ...rewrite USER file removing appropriate include command
                if ($this->sieve->load($user_script)) {
                    $script = $this->sieve->script->as_array();
                    $name   = $name.$extension;

                    foreach ($script as $rid => $rules) {
                        foreach ($rules['actions'] as $action) {
                            if ($action['type'] == 'include' && empty($action['global'])
                                && $action['target'] == $name
                            ) {
                                break 2;
                            }
                        }
                    }

                    // Entry found
                    if ($rid < count($script)) {
                        $this->sieve->script->delete_rule($rid);
                        $result = $this->sieve->save();
                        if ($result) {
                            unset($this->active[$key]);
                        }
                    }
                }
            }
        }
        else {
            $result = $this->sieve->deactivate();
            if ($result)
                $this->active = array();
        }

        return $result;
    }
public function deactivate_script ( $ name ) { // Kolab's KEP:14 if ( $ this -> rc -> config -> get ( 'managesieve_kolab_master' ) ) { $ extension = $ this -> rc -> config -> get ( 'managesieve_filename_extension' , '.sieve' ) ; $ user_script = $ _SESSION [ 'managesieve_user_script' ] ; // if the script is active... if ( $ user_script && ( $ key = array_search ( $ name , $ this -> active ) ) !== false ) { // ...rewrite USER file removing appropriate include command if ( $ this -> sieve -> load ( $ user_script ) ) { $ script = $ this -> sieve -> script -> as_array ( ) ; $ name = $ name . $ extension ; foreach ( $ script as $ rid => $ rules ) { foreach ( $ rules [ 'actions' ] as $ action ) { if ( $ action [ 'type' ] == 'include' && empty ( $ action [ 'global' ] ) && $ action [ 'target' ] == $ name ) { break 2 ; } } } // Entry found if ( $ rid < count ( $ script ) ) { $ this -> sieve -> script -> delete_rule ( $ rid ) ; $ result = $ this -> sieve -> save ( ) ; if ( $ result ) { unset ( $ this -> active [ $ key ] ) ; } } } } } else { $ result = $ this -> sieve -> deactivate ( ) ; if ( $ result ) $ this -> active = array ( ) ; } return $ result ; }
Deactivates sieve script

@param string $name Script name

@return bool True on success, False on failure
Deactivates sieve script