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)
|
private function __filterOnAttributeValue($value)
|
||||||
{
|
{
|
||||||
|
// dissect the value
|
||||||
|
$include = array();
|
||||||
|
$exclude = array();
|
||||||
|
$includeIDs = [];
|
||||||
|
$excludeIDs = [];
|
||||||
|
if (!empty($value)) {
|
||||||
if (!is_array($value)) {
|
if (!is_array($value)) {
|
||||||
$pieces = explode('|', strtolower($value));
|
$pieces = explode('|', strtolower($value));
|
||||||
} else {
|
} else {
|
||||||
$pieces = $value;
|
$pieces = $value;
|
||||||
}
|
}
|
||||||
// dissect the value
|
|
||||||
$include = array();
|
|
||||||
$exclude = array();
|
|
||||||
|
|
||||||
foreach ($pieces as $piece) {
|
foreach ($pieces as $piece) {
|
||||||
if ($piece[0] === '!') {
|
if ($piece[0] === '!') {
|
||||||
|
@ -126,7 +129,6 @@ class EventsController extends AppController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$includeIDs = array();
|
|
||||||
if (!empty($include)) {
|
if (!empty($include)) {
|
||||||
$includeConditions = [];
|
$includeConditions = [];
|
||||||
foreach ($include as $i) {
|
foreach ($include as $i) {
|
||||||
|
@ -142,7 +144,6 @@ class EventsController extends AppController
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$excludeIDs = array();
|
|
||||||
if (!empty($exclude)) {
|
if (!empty($exclude)) {
|
||||||
$excludeConditions = [];
|
$excludeConditions = [];
|
||||||
foreach ($exclude as $e) {
|
foreach ($exclude as $e) {
|
||||||
|
@ -157,6 +158,7 @@ class EventsController extends AppController
|
||||||
'list' => true,
|
'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
|
// 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)) {
|
if (empty($includeIDs) && empty($excludeIDs)) {
|
||||||
$includeIDs[] = -1;
|
$includeIDs[] = -1;
|
||||||
|
|
Loading…
Reference in New Issue