Ejemplo n.º 1
0
  | Copyright (c) 2006 Palosanto Solutions S. A.                         |
  +----------------------------------------------------------------------+
  | Cdla. Nueva Kennedy Calle E 222 y 9na. Este                          |
  | Telfs. 2283-268, 2294-440, 2284-356                                  |
  | Guayaquil - Ecuador                                                  |
  | http://www.palosanto.com                                             |
  +----------------------------------------------------------------------+
  | The contents of this file are subject to the General Public License  |
  | (GPL) Version 2 (the "License"); you may not use this file except in |
  | compliance with the License. You may obtain a copy of the License at |
  | http://www.opensource.org/licenses/gpl-license.php                   |
  |                                                                      |
  | Software distributed under the License is distributed on an "AS IS"  |
  | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See  |
  | the License for the specific language governing rights and           |
  | limitations under the License.                                       |
  +----------------------------------------------------------------------+
  | The Original Code is: Elastix Open Source.                           |
  | The Initial Developer of the Original Code is PaloSanto Solutions    |
  +----------------------------------------------------------------------+
  $Id: email.conf.php,v 1.1.1.1 2007/07/06 21:31:56 gcarrillo Exp $ */
$configPostfix2 = isPostfixToElastix2();
// in misc.lib.php
$clave = obtenerClaveCyrusAdmin();
if (!$configPostfix2) {
    define("SASL_DOMAIN", "example.com");
}
$GLOBALS['CYRUS'] = array('HOST' => "localhost", 'PORT' => 143, 'ADMIN' => 'cyrus', 'PASS' => $clave);
$script = "require [\"fileinto\",\"vacation\"];\n";
$script .= "if header :contains \"X-Spam-Status\" \"Yes,\" {\n" . " fileinto \"spam\";\n" . "}\n" . "\r\n";
define("DEFAULT_SCRIPT", $script);
 function existScriptSieve($email, $search)
 {
     $SIEVE = array();
     $SIEVE['HOST'] = "localhost";
     $SIEVE['PORT'] = 4190;
     $SIEVE['USER'] = "";
     $SIEVE['PASS'] = obtenerClaveCyrusAdmin();
     $SIEVE['AUTHTYPE'] = "PLAIN";
     $SIEVE['AUTHUSER'] = "******";
     $SIEVE['USER'] = $email;
     $result['status'] = false;
     $result['actived'] = "";
     $flag = $status = null;
     exec("echo " . $SIEVE['PASS'] . " | sieveshell --username="******" --authname=" . $SIEVE['AUTHUSER'] . " " . $SIEVE['HOST'] . ":" . $SIEVE['PORT'] . " -e 'list'", $flags, $status);
     if ($status != 0) {
         return null;
     } else {
         for ($i = 0; $i < count($flags); $i++) {
             $value = trim($flags[$i]);
             if (preg_match("/{$search}/", $value)) {
                 $result['status'] = true;
             }
             if (preg_match("/active script/", $value)) {
                 $result['actived'] = $value;
             }
         }
     }
     return $result;
 }
Ejemplo n.º 3
0
 function deleteVacationScript($email, $objAntispam, $spamCapture, $arrLang)
 {
     $SIEVE = array();
     $SIEVE['HOST'] = "localhost";
     $SIEVE['PORT'] = 4190;
     $SIEVE['USER'] = "";
     $SIEVE['PASS'] = obtenerClaveCyrusAdmin("/var/www/html/");
     $SIEVE['AUTHTYPE'] = "PLAIN";
     $SIEVE['AUTHUSER'] = "******";
     $SIEVE['USER'] = $email;
     $existCron = $this->existCronFile();
     if (!$existCron) {
         $this->createCronFile();
     }
     exec("echo " . $SIEVE['PASS'] . " | sieveshell --username="******" --authname=" . $SIEVE['AUTHUSER'] . " " . $SIEVE['HOST'] . ":" . $SIEVE['PORT'] . " -e 'delete vacations.sieve'", $flags, $status);
     if ($status != 0) {
         $this->errMsg = _tr("Error: Impossible remove ") . "vacations.sieve";
         return false;
     }
     if ($spamCapture) {
         $contentSpamFilter = $objAntispam->getContentScript();
         $fileScript = "/tmp/scriptTest.sieve";
         $fp = fopen($fileScript, 'w');
         fwrite($fp, $contentSpamFilter);
         fclose($fp);
         exec("echo " . $SIEVE['PASS'] . " | sieveshell --username="******" --authname=" . $SIEVE['AUTHUSER'] . " " . $SIEVE['HOST'] . ":" . $SIEVE['PORT'] . " -e 'put {$fileScript}'", $flags, $status);
         if ($status != 0) {
             $this->errMsg = _tr("Error: Impossible upload ") . "scriptTest.sieve";
             return false;
         } else {
             exec("echo " . $SIEVE['PASS'] . " | sieveshell --username="******" --authname=" . $SIEVE['AUTHUSER'] . " " . $SIEVE['HOST'] . ":" . $SIEVE['PORT'] . " -e 'activate scriptTest.sieve'", $flags, $status);
             if ($status != 0) {
                 $this->errMsg = _tr("Error: Impossible activate ") . "scriptTest.sieve";
                 return false;
             }
         }
         if (is_file($fileScript)) {
             unlink($fileScript);
         }
     }
     return true;
 }
Ejemplo n.º 4
0
  | Copyright (c) 2006 Palosanto Solutions S. A.                         |
  +----------------------------------------------------------------------+
  | Cdla. Nueva Kennedy Calle E 222 y 9na. Este                          |
  | Telfs. 2283-268, 2294-440, 2284-356                                  |
  | Guayaquil - Ecuador                                                  |
  | http://www.palosanto.com                                             |
  +----------------------------------------------------------------------+
  | The contents of this file are subject to the General Public License  |
  | (GPL) Version 2 (the "License"); you may not use this file except in |
  | compliance with the License. You may obtain a copy of the License at |
  | http://www.opensource.org/licenses/gpl-license.php                   |
  |                                                                      |
  | Software distributed under the License is distributed on an "AS IS"  |
  | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See  |
  | the License for the specific language governing rights and           |
  | limitations under the License.                                       |
  +----------------------------------------------------------------------+
  | The Original Code is: Elastix Open Source.                           |
  | The Initial Developer of the Original Code is PaloSanto Solutions    |
  +----------------------------------------------------------------------+
  $Id: email.conf.php,v 1.1.1.1 2007/07/06 21:31:56 gcarrillo Exp $ */
$configPostfix2 = isPostfixToElastix2();
// in misc.lib.php
$clave = obtenerClaveCyrusAdmin("/var/www/html/");
if (!$configPostfix2) {
    define("SASL_DOMAIN", "example.com");
}
$GLOBALS['CYRUS'] = array('HOST' => "localhost", 'PORT' => 143, 'ADMIN' => 'cyrus', 'PASS' => $clave);
$script = "require [\"fileinto\",\"vacation\"];\n";
$script .= "if header :contains \"X-Spam-Status\" \"Yes,\" {\n" . " fileinto \"spam\";\n" . "}\n" . "\r\n";
define("DEFAULT_SCRIPT", $script);