Code

Some style fixes
[gosa.git] / include / sieve / class_sieveElement_If.inc
index 60b04c9394d673b48c6d057ce7048d3371a02110..99f170df244e134473815505e191704b24f9c672 100644 (file)
@@ -20,6 +20,7 @@ class sieve_if
   function sieve_if($elements,$object_id,$parent)
   {
     $this->parent = $parent;
+    $this->object_id       = $object_id;
   
     /* Possible address parts we can select */
     $this->address_parts = array( 
@@ -51,19 +52,22 @@ class sieve_if
         "gt"  => _("greater than"),
         "ne"  => _("not equal"));
 
-    /* Remove comments from tests */  
-    $tmp = array();
-    foreach($elements['ELEMENTS'] as $ele){
-      if($ele['class'] != "comment"){
-        $tmp[] = $ele;
+    /* Skip parsing if this element is new */
+    if($elements != NULL){
+
+      /* Remove comments from tests */  
+      $tmp = array();
+      foreach($elements['ELEMENTS'] as $ele){
+        if($ele['class'] != "comment"){
+          $tmp[] = $ele;
+        }
       }
-    }
-    $elements['ELEMENTS'] = $tmp;
+      $elements['ELEMENTS'] = $tmp;
 
-    $this->object_id       = $object_id;
-    if($elements!=NULL){
-      $this->elements = $elements;
-      $this->_parsed  = $this->_parse($elements['ELEMENTS'],1);
+      if($elements!=NULL){
+        $this->elements = $elements;
+        $this->_parsed  = $this->_parse($elements['ELEMENTS'],1);
+      }
     }
   }