Apply fixes from StyleCI (#12124)

This commit is contained in:
Jellyfrog
2020-09-21 15:59:34 +02:00
committed by GitHub
parent 0d56bbd946
commit 29f45ca352
816 changed files with 5038 additions and 5038 deletions

View File

@@ -64,13 +64,13 @@ class AlertDB
//Pretty-print rule to dissect easier
$pretty = ['&&' => ' && ', '||' => ' || '];
$rule = str_replace(array_keys($pretty), $pretty, $rule);
$tmp = explode(" ", $rule);
$tmp = explode(' ', $rule);
$tables = [];
foreach ($tmp as $opt) {
if (strstr($opt, '%') && strstr($opt, '.')) {
$tmpp = explode(".", $opt, 2);
$tmpp[0] = str_replace("%", "", $tmpp[0]);
$tables[] = mres(str_replace("(", "", $tmpp[0]));
$tmpp = explode('.', $opt, 2);
$tmpp[0] = str_replace('%', '', $tmpp[0]);
$tables[] = mres(str_replace('(', '', $tmpp[0]));
$rule = str_replace($opt, $tmpp[0] . '.' . $tmpp[1], $rule);
}
}
@@ -81,7 +81,7 @@ class AlertDB
}
$x = sizeof($tables) - 1;
$i = 0;
$join = "";
$join = '';
while ($i < $x) {
if (isset($tables[$i + 1])) {
$gtmp = ResolveGlues([$tables[$i + 1]], 'device_id');
@@ -89,8 +89,8 @@ class AlertDB
//Cannot resolve glue-chain. Rule is invalid.
return false;
}
$last = "";
$qry = "";
$last = '';
$qry = '';
foreach ($gtmp as $glue) {
if (empty($last)) {
[$tmp,$last] = explode('.', $glue);
@@ -104,11 +104,11 @@ class AlertDB
$tables[] = $tmp;
}
}
$join .= "( " . $qry . $tables[0] . ".device_id ) && ";
$join .= '( ' . $qry . $tables[0] . '.device_id ) && ';
}
$i++;
}
$sql = "SELECT * FROM " . implode(",", $tables) . " WHERE (" . $join . "" . str_replace("(", "", $tables[0]) . ".device_id = ?) && (" . str_replace(["%", "@", "!~", "~"], ["", ".*", "NOT REGEXP", "REGEXP"], $rule) . ")";
$sql = 'SELECT * FROM ' . implode(',', $tables) . ' WHERE (' . $join . '' . str_replace('(', '', $tables[0]) . '.device_id = ?) && (' . str_replace(['%', '@', '!~', '~'], ['', '.*', 'NOT REGEXP', 'REGEXP'], $rule) . ')';
return $sql;
}