mirror of https://github.com/MISP/MISP
fix: [tag filters] fixed a bug introduced with the previous filter fix, resulting in multiple OR tags being ignored as a valid filter
parent
899490969c
commit
5d3dee3ba2
|
@ -468,6 +468,7 @@ class EventsController extends AppController
|
|||
$filterString = "";
|
||||
$expectOR = false;
|
||||
$setOR = false;
|
||||
$tagRules = [];
|
||||
foreach ($pieces as $piece) {
|
||||
if ($piece[0] == '!') {
|
||||
if (is_numeric(substr($piece, 1))) {
|
||||
|
@ -498,7 +499,7 @@ class EventsController extends AppController
|
|||
foreach ($block as $b) {
|
||||
$sqlSubQuery .= $b['EventTag']['event_id'] . ',';
|
||||
}
|
||||
$this->paginate['conditions']['AND'][] = substr($sqlSubQuery, 0, -1) . ')';
|
||||
$tagRules['AND'][] = substr($sqlSubQuery, 0, -1) . ')';
|
||||
}
|
||||
if ($filterString != "") {
|
||||
$filterString .= "|";
|
||||
|
@ -536,7 +537,7 @@ class EventsController extends AppController
|
|||
$setOR = true;
|
||||
$sqlSubQuery .= $a['EventTag']['event_id'] . ',';
|
||||
}
|
||||
$this->paginate['conditions']['AND'][] = substr($sqlSubQuery, 0, -1) . ')';
|
||||
$tagRules['OR'][] = substr($sqlSubQuery, 0, -1) . ')';
|
||||
}
|
||||
if ($filterString != "") {
|
||||
$filterString .= "|";
|
||||
|
@ -544,6 +545,7 @@ class EventsController extends AppController
|
|||
$filterString .= isset($tagName['Tag']['name']) ? $tagName['Tag']['name'] : $piece;
|
||||
}
|
||||
}
|
||||
$this->paginate['conditions']['AND'][] = $tagRules;
|
||||
// If we have a list of OR-d arguments, we expect to end up with a list of allowed event IDs
|
||||
// If we don't however, it means that none of the tags was found. To prevent displaying the entire event index in this case:
|
||||
if ($expectOR && !$setOR) {
|
||||
|
|
Loading…
Reference in New Issue