diff --git a/includes/alerts.inc.php b/includes/alerts.inc.php index ae985a36f3..aaffd47f30 100755 --- a/includes/alerts.inc.php +++ b/includes/alerts.inc.php @@ -34,7 +34,7 @@ function GenSQL($rule) { if( strstr($opt,'%') && strstr($opt,'.') ) { $tmpp = explode(".",$opt,2); $tmpp[0] = str_replace("%","",$tmpp[0]); - $tables[] = mres($tmpp[0]); + $tables[] = mres(str_replace("(","",$tmpp[0])); $rule = str_replace($opt,$tmpp[0].'.'.$tmpp[1],$rule); } } @@ -48,7 +48,7 @@ function GenSQL($rule) { } $i++; } - $sql = "SELECT * FROM ".implode(",",$tables)." WHERE (".$join."".$tables[0].".device_id = ?) && (".str_replace(array("*","!~","~"),array("%","NOT LIKE","LIKE"),$rule).")"; + $sql = "SELECT * FROM ".implode(",",$tables)." WHERE (".$join."".str_replace("(","",$tables[0]).".device_id = ?) && (".str_replace(array("%","@","!~","~"),array("","%","NOT LIKE","LIKE"),$rule).")"; return $sql; }