mirror of https://github.com/MISP/MISP
fix: [event index] search via attribute key allows for empty input now
parent
5a29fcc370
commit
459144011e
|
@ -109,14 +109,17 @@ class EventsController extends AppController
|
|||
*/
|
||||
private function __filterOnAttributeValue($value)
|
||||
{
|
||||
// dissect the value
|
||||
$include = array();
|
||||
$exclude = array();
|
||||
$includeIDs = [];
|
||||
$excludeIDs = [];
|
||||
if (!empty($value)) {
|
||||
if (!is_array($value)) {
|
||||
$pieces = explode('|', strtolower($value));
|
||||
} else {
|
||||
$pieces = $value;
|
||||
}
|
||||
// dissect the value
|
||||
$include = array();
|
||||
$exclude = array();
|
||||
|
||||
foreach ($pieces as $piece) {
|
||||
if ($piece[0] === '!') {
|
||||
|
@ -126,7 +129,6 @@ class EventsController extends AppController
|
|||
}
|
||||
}
|
||||
|
||||
$includeIDs = array();
|
||||
if (!empty($include)) {
|
||||
$includeConditions = [];
|
||||
foreach ($include as $i) {
|
||||
|
@ -142,7 +144,6 @@ class EventsController extends AppController
|
|||
)));
|
||||
}
|
||||
|
||||
$excludeIDs = array();
|
||||
if (!empty($exclude)) {
|
||||
$excludeConditions = [];
|
||||
foreach ($exclude as $e) {
|
||||
|
@ -157,6 +158,7 @@ class EventsController extends AppController
|
|||
'list' => true,
|
||||
)));
|
||||
}
|
||||
}
|
||||
// return -1 as the only value in includedIDs if both arrays are empty. This will mean that no events will be shown if there was no hit
|
||||
if (empty($includeIDs) && empty($excludeIDs)) {
|
||||
$includeIDs[] = -1;
|
||||
|
|
Loading…
Reference in New Issue