Filter Event Date - convert timestamp to datetime

PyMisp sends the to / from as a timestamp.  MISP needs to convert a timestamp when comparing.
pull/6362/head
deku 2020-09-29 15:05:49 -04:00
parent 6255f631cb
commit 22cbd98aa2
1 changed files with 10 additions and 2 deletions

View File

@ -2877,9 +2877,17 @@ class Event extends AppModel
public function set_filter_timestamp(&$params, $conditions, $options)
{
if ($options['filter'] == 'from') {
$conditions['AND']['Event.date >='] = $params['from'];
if (is_numeric($params['from'])) {
$conditions['AND']['Event.date >='] = date('Y-m-d', $params['from']);
} else {
$conditions['AND']['Event.date >='] = $params['from'];
}
} elseif ($options['filter'] == 'to') {
$conditions['AND']['Event.date <='] = $params['to'];
if (is_numeric($params['to'])) {
$conditions['AND']['Event.date <='] = date('Y-m-d', $params['to']);
} else {
$conditions['AND']['Event.date <='] = $params['to'];
}
} else {
if (empty($options['scope'])) {
$scope = 'Attribute';