Exemple #1
0
 /**
  * @param string $sScriptName
  * @return bool
  */
 public function DeleteScript($sScriptName)
 {
     if ($this->_connect()) {
         return $this->_oSieve->sieve_deletescript($sScriptName);
     }
     return false;
 }
Exemple #2
0
 /**
  * Return an array of available capabilities.
  *
  * @return array
  */
 function sieve_get_capability()
 {
     if ($this->loggedin == false) {
         return false;
     }
     $this->__fputs('CAPABILITY');
     $this->line = $this->__fgets(1024);
     //Hack for older versions of Sieve Server.  They do not respond with the Cyrus v2. standard
     //response.  They repsond as follows: "Cyrus timsieved v1.0.0" "SASL={PLAIN,........}"
     //So, if we see IMLEMENTATION in the first line, then we are done.
     if (preg_match("IMPLEMENTATION", $this->line)) {
         //we're on the Cyrus V2 sieve server
         while (sieve::status($this->line) == F_DATA) {
             $this->item = sieve::parse_for_quotes($this->line);
             if (strcmp($this->item[0], "IMPLEMENTATION") == 0) {
                 $this->capabilities["implementation"] = $this->item[1];
             } elseif (strcmp($this->item[0], "SIEVE") == 0 or strcmp($this->item[0], "SASL") == 0) {
                 if (strcmp($this->item[0], "SIEVE") == 0) {
                     $this->cap_type = "modules";
                 } else {
                     $this->cap_type = "auth";
                 }
                 $this->modules = explode(" ", $this->item[1]);
                 if (is_array($this->modules)) {
                     foreach ($this->modules as $this->module) {
                         $this->capabilities[$this->cap_type][$this->module] = true;
                     }
                 } elseif (is_string($this->modules)) {
                     $this->capabilites[$this->cap_type][$this->modules] = true;
                 }
             } else {
                 $this->capabilities["unknown"][] = $this->line;
             }
             $this->line = $this->__fgets(1024);
         }
         // end while
     } else {
         //we're on the older Cyrus V1. server
         //this version does not support module reporting.  We only have auth types.
         $this->cap_type = "auth";
         //break apart at the "Cyrus timsieve...." "SASL={......}"
         $this->item = sieve::parse_for_quotes($this->line);
         $this->capabilities["implementation"] = $this->item[0];
         //we should have "SASL={..........}" now.  Break out the {xx,yyy,zzzz}
         $this->modules = substr($this->item[1], strpos($this->item[1], "{"), strlen($this->item[1]) - 1);
         //then split again at the ", " stuff.
         //$this->modules = split($this->modules, ", ");
         $this->modules = explode(', ', $this->modules);
         //fill up our $this->modules property
         if (is_array($this->modules)) {
             foreach ($this->modules as $this->module) {
                 $this->capabilities[$this->cap_type][$this->module] = true;
             }
         } elseif (is_string($this->modules)) {
             $this->capabilites[$this->cap_type][$this->module] = true;
         }
     }
     return $this->modules;
 }
script?</A>

<?php 
    html_foot();
    exit;
}
// Start of Body of code...
// Make sure user is authenticated...
if (!isset($PHP_AUTH_USER)) {
    authenticate();
}
$userid = $PHP_AUTH_USER;
$password = $PHP_AUTH_PW;
$emailaddr = "{$userid}@{$domain}";
// Connect to sieve server
$sieve = new sieve($sieveserver, $sieveport, $userid, $password);
// Right password for this user?
if (!$sieve->sieve_login()) {
    authenticate();
}
// If the user requested, deactivate current script
if ($deactivatescript) {
    $sieve->sieve_setactivescript("");
}
// Verify that other script is not active
if ($sieve->sieve_listscripts()) {
    if (isset($sieve->response["ACTIVE"])) {
        if ($sieve->response["ACTIVE"] != "vacationset") {
            ask_active_script($sieve->response["ACTIVE"]);
        }
    }