roundcubemail/plugins/managesieve/lib/Roundcube/rcube_sieve.php
public function save_script($name, $content = null)
    {
        if (!$this->sieve) {
            return $this->_set_error(self::ERROR_INTERNAL);
        }

        if (!$content) {
            $content = '/* empty script */';
        }

        $result = $this->sieve->installScript($name, $content);

        if (is_a($result, 'PEAR_Error')) {
            $rawErrorMessage = $result->getMessage();
            $errMessages = preg_split("/$name:/", $rawErrorMessage);

            if (count($errMessages) > 0) {
                foreach ($errMessages as $singleError) {
                    $matches = array();
                    $res = preg_match('/line (\d+):(.*)/i', $singleError, $matches);

                    if ($res === 1 ) {
                        if (count($matches) > 2) {
                            $this->errorLines[] = array("line" => $matches[1], "msg" => $matches[2]);
                        }
                        else {
                            $this->errorLines[] = array("line" => $matches[1], "msg" => null);
                        }
                    }
                }
            }

            return $this->_set_error(self::ERROR_INSTALL);
        }

        return true;
    }
public function save_script($name, $content = null)
    {
        if (!$this->sieve) {
            return $this->_set_error(self::ERROR_INTERNAL);
        }

        if (!$content) {
            $content = '/* empty script */';
        }

        $result = $this->sieve->installScript($name, $content);

        if (is_a($result, 'PEAR_Error')) {
            $rawErrorMessage = $result->getMessage();
            $errMessages = preg_split("/$name:/", $rawErrorMessage);

            if (count($errMessages) > 0) {
                foreach ($errMessages as $singleError) {
                    $matches = array();
                    $res = preg_match('/line (\d+):(.*)/i', $singleError, $matches);

                    if ($res === 1 ) {
                        if (count($matches) > 2) {
                            $this->errorLines[] = array("line" => $matches[1], "msg" => $matches[2]);
                        }
                        else {
                            $this->errorLines[] = array("line" => $matches[1], "msg" => null);
                        }
                    }
                }
            }

            return $this->_set_error(self::ERROR_INSTALL);
        }

        return true;
    }
public function save_script ( $ name , $ content = null ) { if ( ! $ this -> sieve ) { return $ this -> _set_error ( self :: ERROR_INTERNAL ) ; } if ( ! $ content ) { $ content = '/* empty script */' ; } $ result = $ this -> sieve -> installScript ( $ name , $ content ) ; if ( is_a ( $ result , 'PEAR_Error' ) ) { $ rawErrorMessage = $ result -> getMessage ( ) ; $ errMessages = preg_split ( "/$name:/" , $ rawErrorMessage ) ; if ( count ( $ errMessages ) > 0 ) { foreach ( $ errMessages as $ singleError ) { $ matches = array ( ) ; $ res = preg_match ( '/line (\d+):(.*)/i' , $ singleError , $ matches ) ; if ( $ res === 1 ) { if ( count ( $ matches ) > 2 ) { $ this -> errorLines [ ] = array ( "line" => $ matches [ 1 ] , "msg" => $ matches [ 2 ] ) ; } else { $ this -> errorLines [ ] = array ( "line" => $ matches [ 1 ] , "msg" => null ) ; } } } } return $ this -> _set_error ( self :: ERROR_INSTALL ) ; } return true ; }
Saves text script into server
Saves text script into server