/** * Returns the content of the currently active script. * * @return string The complete ruleset of the specified user. * @throws Ingo_Exception * @throws Horde_Exception_NotFound */ public function getScript() { $this->_connect(); $active = Ingo_Exception_Pear::catchError($this->_sieve->getActive()); if (!strlen($active)) { throw new Horde_Exception_NotFound(); } return array('name' => $active, 'script' => Ingo_Exception_Pear::catchError($this->_sieve->getScript($active))); }
function __construct($_icServer = null) { parent::Net_Sieve(); $this->scriptName = !empty($GLOBALS['phpgw_info']['user']['preferences']['felamimail']['sieveScriptName']) ? $GLOBALS['phpgw_info']['user']['preferences']['felamimail']['sieveScriptName'] : 'felamimail'; $this->displayCharset = 'utf-8'; if (!is_null($_icServer) && $this->_connect($_icServer) === 'die') { die('Sieve not activated'); } }
//////////////////////////////////////////// Carrega Timezones para o javascript /////////////////////////////////////// $zones = timezone_identifiers_list(); $Time = new DateTime('now', new DateTimeZone('UTC')); $timezone = array(); foreach ($zones as $zone) { $timezone['timezones'][$zone] = $Time->setTimezone(new DateTimeZone($zone))->format('O'); } $localtime = localtime(time(), true); $timezone['isDaylightSaving'] = !!$localtime['tm_isdst'] ? 1 : 0; echo '<script type="text/javascript"> var Timezone = ' . json_encode($timezone) . '</script>'; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////// Verifica se o usuario esta fora do escritorio imprime a variavel javascript "outOfficeFlag" //////////////// include_once __DIR__ . '/../prototype/library/Net/Sieve.php'; $sieveConf = parse_ini_file(__DIR__ . "/../prototype/config/Sieve.srv", true); $sieveConf = $sieveConf['config']; $sieve = new Net_Sieve(); $inVacation = false; @$sieve->connect($sieveConf['host'], $sieveConf['port'], $sieveConf['options'], $sieveConf['useTLS']); @$sieve->login($_SESSION['wallet']['Sieve']['user'], $_SESSION['wallet']['Sieve']['password'], $sieveConf['loginType']); $script = $sieve->getScript($sieve->getActive()); $old_rule = strripos($script, "##PSEUDO script start"); if ($old_rule) { if (preg_match("/^ *#vacation/im", $script)) { $inVacation = true; } } else { $pos = strripos($script, "#PseudoScript#"); $pseudo_script = substr($script, $pos + 17); $sieveRules = json_decode($pseudo_script, true); if (count($sieveRules) > 0) { foreach ($sieveRules as $i => $v) {
$pass = '******'; $host = 'localhost'; $port = "2000"; //you can create a file called passwords.php and store your $user,$pass,$host and $port values in it // or you can modify this script @(include_once "./passwords.php"); $sieve_script_name1 = 'test script1'; // The script $sieve_script1 = "require \"fileinto\";\n\rif header :contains \"From\" \"@cnba.uba.ar\" \n\r{fileinto \"INBOX.Test1\";}\r\nelse \r\n{fileinto \"INBOX\";}"; $sieve_script_name2 = 'test script2'; $sieve_script2 = "require \"fileinto\";\n\rif header :contains \"From\" \"@cnba.uba.ar\" \n\r{fileinto \"INBOX.Test\";}\r\nelse \r\n{fileinto \"INBOX\";}"; $sieve_script1 = "require \"vacation\";\nvacation\n:days 7\n:addresses [\"matthew@de-construct.com\"]\n:subject \"This is a test\"\n\"I'm on my holiday!\nsadfafs\";"; //$sieve=new Net_Sieve($user, $passwd, $host , $port , 'PLAIN'); //$sieve=new Net_Sieve($user, $passwd, $host , $port, 'DIGEST-MD5' ); //$sieve=new Net_Sieve($user, $passwd, $host , $port); $sieve = new Net_Sieve(); $sieve->setDebug(true); if (PEAR::isError($error = $sieve->connect($host, $port))) { echo " there was an error trying to connect to the server. The error is: " . $error->getMessage() . "\n"; exit; } //if(PEAR::isError($error = $sieve->login($user, $passwd , 'PLAIN' , '', false ) ) ){ if (PEAR::isError($error = $sieve->login($user, $passwd, null, '', false))) { echo " there was an error trying to connect to the server. The error is: " . $error->getMessage() . "\n"; exit; } // I list the scripts that I Have installed echo "These are the scripts that I have in the server:\n"; print_r($sieve->listScripts()); echo "\n"; echo "I remove script 1 ({$sieve_script_name1})......\n";