mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Fix #3725:
- Fix match_filter_field() and also simplify logic - Fix $filterfieldsarray initialization - Avoid to have double spaces on filterfieldsarray['act'] - Fix filter on Firewall Logs
This commit is contained in:
parent
6d74e3e97b
commit
c69e813c84
@ -90,20 +90,28 @@ function match_filter_line($flent, $filtertext = "") {
|
||||
}
|
||||
|
||||
function match_filter_field($flent, $fields) {
|
||||
foreach ($fields as $field) {
|
||||
if ($fields[$field] == "All") continue;
|
||||
if ((strpos($fields[$field], '!') === 0)) {
|
||||
$fields[$field] = substr($fields[$field], 1);
|
||||
if (preg_match("/act/i", $field)) {
|
||||
if ( (in_arrayi($flent[$field], explode(",", str_replace(" ", ",", $fields[$field]))) ) ) return false;
|
||||
} else if ( (preg_match("/{$fields[$field]}/i", $flent[$field])) ) return false;
|
||||
foreach ($fields as $key => $field) {
|
||||
if ($field == "All")
|
||||
continue;
|
||||
if ((strpos($$field, '!') === 0)) {
|
||||
$field = substr($field, 1);
|
||||
if (strtolower($key) == 'act') {
|
||||
if (in_arrayi($flent[$key], explode(" ", $field)))
|
||||
return false;
|
||||
} else {
|
||||
if (@preg_match("/{$field}/i", $flent[$key]))
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (strtolower($key) == 'act') {
|
||||
if (!in_arrayi($flent[$key], explode(" ", $field)))
|
||||
return false;
|
||||
} else {
|
||||
if (!@preg_match("/{$field}/i", $flent[$key]))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (preg_match("/act/i", $field)) {
|
||||
if ( !(in_arrayi($flent[$field], explode(",", str_replace(" ", ",", $fields[$field]))) ) ) return false;
|
||||
} else if ( !(preg_match("/{$fields[$field]}/i", $flent[$field])) ) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -73,14 +73,14 @@ if ($filtersubmit) {
|
||||
|
||||
$filterlogentries_submit = getGETPOSTsettingvalue('filterlogentries_submit', null);
|
||||
if ($filterlogentries_submit) {
|
||||
$filterfieldsarray = array("act", "time", "interface", "srcip", "srcport", "dstip", "dstport", "proto", "tcpflags");
|
||||
$filterfieldsarray = array();
|
||||
|
||||
$actpass = getGETPOSTsettingvalue('actpass', null);
|
||||
$actblock = getGETPOSTsettingvalue('actblock', null);
|
||||
$actreject = getGETPOSTsettingvalue('actreject', null);
|
||||
|
||||
$filterfieldsarray['act'] = trim($actpass . " " . $actblock . " " . $actreject);
|
||||
$filterfieldsarray['act'] = $filterfieldsarray['act'] ? $filterfieldsarray['act'] : 'All';
|
||||
$filterfieldsarray['act'] = str_replace(" ", " ", trim($actpass . " " . $actblock . " " . $actreject));
|
||||
$filterfieldsarray['act'] = $filterfieldsarray['act'] != "" ? $filterfieldsarray['act'] : 'All';
|
||||
$filterfieldsarray['time'] = getGETPOSTsettingvalue('filterlogentries_time', null);
|
||||
$filterfieldsarray['interface'] = getGETPOSTsettingvalue('filterlogentries_interfaces', null);
|
||||
$filterfieldsarray['srcip'] = getGETPOSTsettingvalue('filterlogentries_sourceipaddress', null);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user