Code

Replaced in_array calls with in_array_strict
[gosa.git] / gosa-plugins / mail / personal / mail / sieve / class_sieveElement_If.inc
index cb33ae5e788e2fb09ac9a366613f5d698f026345..4412f3fe6a0a3d86062c8f01f137b9fca633c725 100644 (file)
@@ -37,7 +37,7 @@ class sieve_if
     /* Match types */
     $this->match_types  = array(  
         ":is"         => _("is"),
-        ":regex"      => _("regex"),
+        ":regex"      => _("reg-ex"),
         ":contains"   => _("contains"),
         ":matches"    => _("matches"),
         ":count"      => _("count"),
@@ -236,7 +236,7 @@ class sieve_if
           $script .= $data['Match_type']." ";
 
           /* Add special match type for count and value */
-          if(in_array($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
+          if(in_array_strict($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
             $script .= sieve_create_strings($data['Match_type_value'])." ";
           }
 
@@ -281,7 +281,7 @@ class sieve_if
           $script .= $data['Match_type']." ";
 
           /* Add special match type for count and value */
-          if(in_array($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
+          if(in_array_strict($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
             $script .= sieve_create_strings($data['Match_type_value'])." ";
           }
 
@@ -327,7 +327,7 @@ class sieve_if
           $script .= $data['Match_type']." ";
 
           /* Add special match type for count and value */
-          if(in_array($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
+          if(in_array_strict($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
             $script .= sieve_create_strings($data['Match_type_value'])." ";
           }
 
@@ -443,7 +443,7 @@ class sieve_if
                                 "LastError"       => "",
                                 "Match_type"      => ":contains",
                                 "Match_type_value"=> "",
-                                "Key_List"        => array(_("emtpy")),
+                                "Key_List"        => array(_("empty")),
                                 "Value_List"      => array(_("empty"))) ;
         if($type == "address"){
           $values["Address_Part"]    = ":all";
@@ -540,7 +540,7 @@ class sieve_if
       $element_id = $this->object_id."_".$id."_".$obj_id;
       
       foreach($_POST as $name => $value){
-        if(preg_match("/Remove_Test_Object_".$element_id."_(x|y)/",$name)) {
+        if(preg_match("/Remove_Test_Object_".$element_id."/",$name)) {
           return(false); 
         }
       }
@@ -630,7 +630,7 @@ class sieve_if
           /* In case of :count and :value match types 
            *  we have a special match operator we should save.
            */
-          if(in_array($parsed[$key]['Match_type'],array(":value",":count"))){
+          if(in_array_strict($parsed[$key]['Match_type'],array(":value",":count"))){
             if(isset($_POST['operator_'.$element_id])){
               $op = $_POST['operator_'.$element_id];
 
@@ -646,7 +646,7 @@ class sieve_if
             $vls = stripslashes($_POST['keys_'.$element_id]);
             $tmp = array();
 
-            $tmp2 = split(",",$vls);
+            $tmp2 = explode(",",$vls);
             foreach($tmp2 as $val){
               $tmp[] = trim($val);
   
@@ -662,7 +662,7 @@ class sieve_if
             $vls = stripslashes($_POST['values_'.$element_id]);
             $tmp = array();
 
-            $tmp2 = split(",",$vls);
+            $tmp2 = explode(",",$vls);
             foreach($tmp2 as $val){
               $tmp[] = trim($val);
               if(preg_match("/\"/",$val)){
@@ -708,7 +708,7 @@ class sieve_if
             $vls = stripslashes($_POST['Values_'.$element_id]);
             $tmp = array();          
   
-            $tmp2 = split(",",$vls);
+            $tmp2 = explode(",",$vls);
             foreach($tmp2 as $val){
               $tmp[] = "\"".trim(preg_replace("/\"/","",$val))."\"";
             }
@@ -830,7 +830,7 @@ class sieve_if
   function execute()
   {
     /* Create title */
-    $name  = "<img alt='' src='images/small_filter.png' class='center'>";
+    $name  = "<img alt='' src='images/lists/action.png' class='center'>";
     $name .= "<b>"._("Condition")."</b>";
     if($this->TYPE == "if"){
       $name .= "&nbsp;-&nbsp;"._("If");
@@ -1173,7 +1173,7 @@ class sieve_if
         } 
         default : 
         {
-          trigger_error(_("Unhandled switch type"));
+          trigger_error(_("Unknown switch type"));
         }
       }
     }
@@ -1266,7 +1266,7 @@ class sieve_if
             $Match_type = $node['text'];
 
             /* Get value operator */
-            if(in_array($Match_type,array(":value",":count"))){
+            if(in_array_strict($Match_type,array(":value",":count"))){
               $i ++;        
               $node = $data[$i];
 
@@ -1380,7 +1380,7 @@ class sieve_if
         
         /* Skip first values, [if,not,exists] */
         $node = $data[$id];
-        while(in_array($node['text'],array("if","not","exists"))){
+        while(in_array_strict($node['text'],array("if","not","exists"))){
           $id ++;
           $node = $data[$id];
         }
@@ -1448,16 +1448,16 @@ class sieve_if
     $next = NULL;
     $num = 0;
     for($i = $id ; $i < count($data) ; $i++ ){
-      if(in_array($data[$i]['class'],array("left-parant","left-bracket"))){
+      if(in_array_strict($data[$i]['class'],array("left-parant","left-bracket"))){
         $open_brakets ++;
       }
       if($data[$i]['class'] == "comma" && $open_brakets == 1){
         $num ++;
       }
-      if(!in_array($data[$i]['class'],array("comma","left-parant","right-parant")) || $open_brakets >1 ){
+      if(!in_array_strict($data[$i]['class'],array("comma","left-parant","right-parant")) || $open_brakets >1 ){
         $par[$num][] = $data[$i];
       }
-      if(in_array($data[$i]['class'],array("right-parant","right-bracket"))){
+      if(in_array_strict($data[$i]['class'],array("right-parant","right-bracket"))){
         $open_brakets --;
       }
     }