diff --git a/db_functions.php b/db_functions.php index dac37e2..780d14d 100644 --- a/db_functions.php +++ b/db_functions.php @@ -96,21 +96,21 @@ function renderGroupConcat(string &$sql_where, string $sql_join, string $sql_fie */ function renderWhereJoin(string &$sql_where, string &$sql_join): void { if (get_request_var('crit') > 0) { - $awhere = 'h.monitor_criticality >= ' . get_request_var('crit'); + $awhere = 'h.monitor_criticality >= ' . (int) get_request_var('crit'); } else { $awhere = ''; } if (get_request_var('grouping') == 'site') { if (get_request_var('site') > 0) { - $awhere .= ($awhere == '' ? '' : ' AND ') . 'h.site_id = ' . get_request_var('site'); + $awhere .= ($awhere == '' ? '' : ' AND ') . 'h.site_id = ' . (int) get_request_var('site'); } elseif (get_request_var('site') == -2) { $awhere .= ($awhere == '' ? '' : ' AND ') . ' h.site_id = 0'; } } if (get_request_var('rfilter') != '') { - $awhere .= ($awhere == '' ? '' : ' AND ') . " h.description RLIKE '" . get_request_var('rfilter') . "'"; + $awhere .= ($awhere == '' ? '' : ' AND ') . ' h.description RLIKE ' . db_qstr(get_request_var('rfilter')); } if (get_request_var('grouping') == 'tree') { diff --git a/monitor_controller.php b/monitor_controller.php index 7eb2b69..2202d94 100644 --- a/monitor_controller.php +++ b/monitor_controller.php @@ -106,7 +106,9 @@ function drawPage(): void { // Default with permissions = default_by_permission // Tree = group_by_tree - $function = 'render' . ucfirst(get_request_var('grouping')); + $allowed_groupings = ['default', 'tree', 'site', 'template']; + $grouping = in_array(get_request_var('grouping'), $allowed_groupings, true) ? get_request_var('grouping') : 'default'; + $function = 'render' . ucfirst($grouping); if (function_exists($function) && get_request_var('view') != 'list') { if (get_request_var('grouping') == 'default' || get_request_var('grouping') == 'site') { @@ -548,23 +550,23 @@ function monitorRenderGroupingDropdowns(array $classes, array $criticalities, ar */ function monitorRenderHiddenFilterInputs(): void { if (get_request_var('grouping') != 'tree') { - print '