Code

fixes: #1175
[gosa.git] / gosa-plugins / mail / personal / mail / sieve / class_sieve.inc
index ed3eafd096e73338f13f5c8be5a165f9d7436fe4..91c826f402b0c97d611ae825fa45ba11650e8177 100644 (file)
@@ -103,13 +103,13 @@ class sieve
     unset($this->error_raw);
 
     $this->line=fgets($this->fp,1024);
-    $this->token = split(" ", $this->line, 2);
+    $this->token = explode(" ", $this->line, 2);
 
     if($this->token[0] == "NO"){
       /* we need to try and extract the error code from here.  There are two possibilites: one, that it will take the form of:
          NO ("yyyyy") "zzzzzzz" or, two, NO {yyyyy} "zzzzzzzzzzz" */
       $this->x = 0;
-      list($this->ltoken, $this->mtoken, $this->rtoken) = split(" ", $this->line." ", 3);
+      list($this->ltoken, $this->mtoken, $this->rtoken) = explode(" ", $this->line." ", 3);
       if($this->mtoken[0] == "{"){
         while($this->mtoken[$this->x] != "}" or $this->err_len < 1){
           $this->err_len = substr($this->mtoken, 1, $this->x);
@@ -301,7 +301,7 @@ class sieve
     //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(ereg("IMPLEMENTATION",$this->line))
+    if(strstr($this->line, "IMPLEMENTATION"))
     {
       //we're on the Cyrus V2 sieve server
       while(sieve::status($this->line) == F_DATA){
@@ -319,7 +319,7 @@ class sieve
             $this->cap_type="auth";
           }
 
-          $this->modules = split(" ", $this->item[1]);
+          $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;
@@ -349,7 +349,7 @@ class sieve
       $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)){
@@ -374,7 +374,7 @@ class sieve
     }
 
     /* Loop through each allowed authentication type and see if the server allows the type */
-    foreach(split(" ",$this->auth_types) as $auth_type)
+    foreach(explode(" ",$this->auth_types) as $auth_type)
     {
       if (isset($this->capabilities["auth"][$auth_type]))
       {
@@ -394,7 +394,7 @@ class sieve
     }
 
     /* Fill error message if no auth types are present */
-    if (!isset($this->capabilities["auth"])){
+    if (($this->options != "tls") && (!isset($this->capabilities["auth"]))){
       $this->error=EC_UNKNOWN;
       $this->error_raw = "No authentication methods found - please check your sieve setup for missing sasl modules";
       return false;