示例#1
0
 /**
  * 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)));
 }
示例#2
0
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) {
            if ($v['id'] == 'vacation' && $v['enabled'] == 'true') {
                $inVacation = true;
            }
        }
示例#3
0
if(!PEAR::isError( $error = $sieve->haveSpace($sieve_script_name1, strlen($sieve_script1)))){
    echo "  ok! the server has a lot of space!\n";
}else{
    echo "  the server can't store the script. The error is: " . $error->getMessage() . "\n" ;
}
echo "\n";
*/
echo "I install the script '{$sieve_script_name1}' and mark it active.....\n";
if (!PEAR::isError($error = $sieve->installScript($sieve_script_name1, $sieve_script1, true))) {
    echo "  script '{$sieve_script_name1}' installed ok!\n";
} else {
    echo "  there was an error trying to install the script '{$sieve_script_name1}'. The error is: " . $error->getMessage() . "\n";
}
echo "\n";
echo "This is the script I just installed.....\n";
if (!PEAR::isError($error = $sieve->getScript($sieve_script_name1))) {
    echo "  script '{$sieve_script_name1}':\n{$error}\n";
} else {
    echo "  there was an error trying to install the script '{$sieve_script_name1}'. The error is: " . $error->getMessage() . "\n";
}
echo "I install the script '{$sieve_script_name2}' but it is not marked as active.....\n";
if (!PEAR::isError($error = $sieve->installScript($sieve_script_name2, $sieve_script2))) {
    echo "  script '{$sieve_script_name2}' installed ok!\n";
} else {
    echo "  there was an error trying to install the script '{$sieve_script_name2}'. The error is: " . $error->getMessage() . "\n";
}
echo "\n";
echo "Now set script 2 as active...\n";
if (!PEAR::isError($error = $sieve->setActive($sieve_script_name2))) {
    echo "  script '{$sieve_script_name2}' marked as active ok!\n";
} else {