From 37b7c32465ea85a1005d3eb120edf6fc7cfdaa80 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 9 Apr 2019 09:45:28 -0400 Subject: [PATCH] fix errors when no filter specified --- web/skins/classic/views/montagereview.php | 49 ++++++++++++----------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/web/skins/classic/views/montagereview.php b/web/skins/classic/views/montagereview.php index 61cf95b21..1d05d597e 100644 --- a/web/skins/classic/views/montagereview.php +++ b/web/skins/classic/views/montagereview.php @@ -59,34 +59,35 @@ include('_monitor_filters.php'); $filter_bar = ob_get_contents(); ob_end_clean(); +$filter = array(); if ( isset($_REQUEST['filter']) ) { $filter = $_REQUEST['filter']; } else { - if (isset($_REQUEST['minTime']) && isset($_REQUEST['maxTime']) && count($displayMonitors) != 0) { - $filter = array( - 'Query' => array( - 'terms' => array( - array('attr' => 'StartDateTime', 'op' => '>=', 'val' => $_REQUEST['minTime'], 'obr' => '1'), - array('attr' => 'StartDateTime', 'op' => '<=', 'val' => $_REQUEST['maxTime'], 'cnj' => 'and', 'cbr' => '1'), - ) - ), - ); - if ( count($selected_monitor_ids) ) { - $filter['Query']['terms'][] = (array('attr' => 'MonitorId', 'op' => 'IN', 'val' => implode(',',$selected_monitor_ids), 'cnj' => 'and')); - } else if ( ( $group_id != 0 || isset($_SESSION['ServerFilter']) || isset($_SESSION['StorageFilter']) || isset($_SESSION['StatusFilter']) ) ) { - # this should be redundant - for ($i=0; $i < count($displayMonitors); $i++) { - if ($i == '0') { - $filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'and', 'obr' => '1'); - } else if ($i == (count($displayMonitors)-1)) { - $filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'or', 'cbr' => '1'); - } else { - $filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'or'); - } - } - } -} # end if REQUEST[Filter] + if (isset($_REQUEST['minTime']) && isset($_REQUEST['maxTime']) && count($displayMonitors) != 0) { + $filter = array( + 'Query' => array( + 'terms' => array( + array('attr' => 'StartDateTime', 'op' => '>=', 'val' => $_REQUEST['minTime'], 'obr' => '1'), + array('attr' => 'StartDateTime', 'op' => '<=', 'val' => $_REQUEST['maxTime'], 'cnj' => 'and', 'cbr' => '1'), + ) + ), + ); + if ( count($selected_monitor_ids) ) { + $filter['Query']['terms'][] = (array('attr' => 'MonitorId', 'op' => 'IN', 'val' => implode(',',$selected_monitor_ids), 'cnj' => 'and')); + } else if ( ( $group_id != 0 || isset($_SESSION['ServerFilter']) || isset($_SESSION['StorageFilter']) || isset($_SESSION['StatusFilter']) ) ) { + # this should be redundant + for ($i=0; $i < count($displayMonitors); $i++) { + if ($i == '0') { + $filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'and', 'obr' => '1'); + } else if ($i == (count($displayMonitors)-1)) { + $filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'or', 'cbr' => '1'); + } else { + $filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'or'); + } + } + } + } # end if REQUEST[Filter] parseFilter($filter); # This is to enable the download button session_start();