Code

Added simple direct add of sieve elements.
[gosa.git] / include / sieve / class_sieveElement_Vacation.inc
index 9bb4a41b4ef1c8a8fad1ccb26fcfecb6a1bf64b9..91d2310667e44145cef59a091d810d386d561678 100644 (file)
@@ -57,7 +57,7 @@ class sieve_vacation
             }
           }
         }else{
-              $this->addresses[] = $data['ELEMENTS'][$i]['text'] ;
+              $this->addresses[] =  preg_replace("/\"/i","",$data['ELEMENTS'][$i]['text']);
         }
       }
 
@@ -71,7 +71,7 @@ class sieve_vacation
         foreach($strs as $str){
           $data .= $str;
         }
-        $this->reason = $data;//preg_replace("/\"/","",$data);
+        $this->reason = $data;
       }
     }
   }
@@ -92,7 +92,12 @@ class sieve_vacation
     if($this->mime){
       $str.= ":mime ".sieve_create_strings($this->mime);
     }
-    $str .= "\n ".sieve_create_strings($this->reason);
+  
+    /* Append reason and ensure that this will be 
+     *  handled as multiline text element 
+     *  by adding a "\n" new line 
+     */
+    $str .= "\n ".sieve_create_strings($this->reason."\n");
     return($str." ; \n");
   }
 
@@ -100,7 +105,7 @@ class sieve_vacation
   {
     /* Get release date */
     if(isset($_POST['vacation_release_'.$this->object_id])){
-      $this->days = $_POST['vacation_release_'.$this->object_id];
+      $this->days = stripslashes($_POST['vacation_release_'.$this->object_id]);
     }
 
     /* Check if we want to toggle the expert mode */
@@ -114,9 +119,9 @@ class sieve_vacation
       $tmp = array();
       $tmp2 = split(",",$vr);
       foreach($tmp2 as $val){
-        $ad = trim(preg_replace("/\"/","",$val));
+        $ad = trim($val);
         if(!empty($ad)){
-          $tmp[] = "\"".$ad."\"";
+          $tmp[] = $ad;
         }
       }
       $this->addresses = $tmp;
@@ -125,7 +130,7 @@ class sieve_vacation
     /* Get reason */
     if(isset($_POST['vacation_reason_'.$this->object_id])){
       $vr = stripslashes ($_POST['vacation_reason_'.$this->object_id]);
-      $this->reason = "\"".trim(preg_replace("/\"/","",$vr))."\"";
+      $this->reason = trim($vr);
     }
   }
 
@@ -134,7 +139,7 @@ class sieve_vacation
     $msgs = array();
     $err = FALSE;
     foreach($this->addresses as $addr){
-      if(!is_email(preg_replace("/\"/","",$addr))){
+      if(!is_email($addr)){
         $err = true;
       }
     }