index 3b5bb2a1bed832d7731b3a0734949d6ae10fbd2e..99f170df244e134473815505e191704b24f9c672 100644 (file)
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(
"gt" => _("greater than"),
"ne" => _("not equal"));
- $this->object_id = $object_id;
- if($elements!=NULL){
- $this->elements = $elements;
- $this->_parsed = $this->_parse($elements['ELEMENTS'],1);
+ /* 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;
+
+ if($elements!=NULL){
+ $this->elements = $elements;
+ $this->_parsed = $this->_parse($elements['ELEMENTS'],1);
+ }
}
}
if(!isset($match_types[$mt])){
$parsed[$key]['LastError'] = _("Invalid match type given.");
}
+ if($mt == ":regex"){
+ $this->parent->add_require("regex");
+ }
$parsed[$key]['Match_type'] = $mt;
}
$Match_types = array( ":over" => _("greater than") ,
":under" => _("lower than"));
- $Units = array( "M" => _("Megabyte") ,
- "K" => _("Kilobyte"));
+ $Units = array( "M" => _("Megabyte"),
+ "K" => _("Kilobyte"),
+ "" => _("Bytes"));
/* Toggle Inverse ? */
if(isset($_POST['toggle_inverse_'.$element_id])){
}else{
$object = $smarty->fetch(get_template_path("templates/element_elsif.tpl",TRUE,dirname(__FILE__)));
}
- $str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
+ $str = preg_replace("/%%OBJECT_CONTENT%%/",addcslashes($object,"\\"),$object_container);
return($str);
}
$smarty->assign("ID" , $element_id);
$str = $smarty->fetch(get_template_path("templates/element_address.tpl",TRUE,dirname(__FILE__)));
$ret .= $str;
- echo htmlentities($str);
break;
}
$Match_types = array( ":over" => _("greater than") ,
":under" => _("lower than"));
- $Units = array( "M" => _("Megabyte") ,
- "K" => _("Kilobyte"));
+ $Units = array( "M" => _("Megabyte"),
+ "K" => _("Kilobyte"),
+ "" => _("Bytes"));
$Match_type = $data['Match_type'];
$Value = preg_replace("/[^0-9]/","",$data['Value_List'][0]);
$smarty->assign("DisplayAdd",FALSE);
$smarty->assign("DisplayDel",TRUE);
$str = $smarty->fetch(get_template_path("templates/object_test_container.tpl",TRUE,dirname(__FILE__)));
- $ret = preg_replace("/%%OBJECT_CONTENT%%/",$ret,$str);
+ $ret = preg_replace("/%%OBJECT_CONTENT%%/",addcslashes($ret,"\\"),$str);
return($ret);
}