Code

Updated address element to support regex extension
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 22 Mar 2007 13:59:33 +0000 (13:59 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 22 Mar 2007 13:59:33 +0000 (13:59 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5862 594d385d-05f5-0310-b6e9-bd551577e9d8

include/sieve/class_sieveElement_If.inc

index 05f4895141ed53d8f739a4e24f7e1888d3b6964b..3b5bb2a1bed832d7731b3a0734949d6ae10fbd2e 100644 (file)
@@ -36,6 +36,7 @@ class sieve_if
     /* Match types */
     $this->match_types  = array(  
         ":is"         => _("is"),
+        ":regex"      => _("regex"),
         ":contains"   => _("contains"),
         ":matches"    => _("matches"),
         ":count"      => _("count"),
@@ -1010,10 +1011,13 @@ class sieve_if
             $values .= $key.", ";
           }
           $values = preg_replace("/,$/","",trim($values));
+
           $smarty->assign("keys",$keys);
-          $smarty->assign("values",$values);
+          $smarty->assign("values", $values);
           $smarty->assign("ID"  , $element_id); 
-          $ret .= $smarty->fetch(get_template_path("templates/element_address.tpl",TRUE,dirname(__FILE__)));
+          $str = $smarty->fetch(get_template_path("templates/element_address.tpl",TRUE,dirname(__FILE__)));
+          $ret .= $str;
+          echo htmlentities($str);
           break;
         }
       
@@ -1163,8 +1167,16 @@ class sieve_if
    */
   function _parse($data,$id = 0)
   {
-    $av_methods   = array("address","allof","anyof","exists","false","header","not","size","true","envelope");
-    $av_match_type= array(":is",":contains",":matches",":over",":count",":value",":under");
+    $av_match_type = array();
+    foreach($this->match_types as $name => $description){
+      $av_match_type[] = $name;
+    }
+    $av_match_type[] = ":over";
+    $av_match_type[] = ":under";
+
+
+
+    $av_methods= array("address","allof","anyof","exists","false","header","not","size","true","envelope");
     $type = $data[$id]['text'];
     $tmp = array();
 
@@ -1199,7 +1211,7 @@ class sieve_if
    
         
         $part     = "(:all|:localpart|:domain)";
-        $operator = "(:contains|:is|:matches|:count|:value)";
+        $operator = "(:regex|:contains|:is|:matches|:count|:value)";
         $value_op = "(lt|le|eq|ge|gt|ne)";
 
         $Address_Part     = "";