From 33c83159dacc003c39023e99b71a93db68d3b94c Mon Sep 17 00:00:00 2001 From: TheWitness Date: Thu, 16 Jan 2025 18:10:31 -0500 Subject: [PATCH] QA: Fix bugs identified by check_all_pages.sh --- data_input.php | 2 +- graphs_new.php | 4 ++-- host_templates.php | 11 +++++++---- lib/auth.php | 6 +++--- utilities.php | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/data_input.php b/data_input.php index 5b614a0343..3c04a966b5 100644 --- a/data_input.php +++ b/data_input.php @@ -661,7 +661,7 @@ function data_edit() { } else { $url = html_escape('data_input.php?action=field_remove_confirm&id=' . $field['id'] . '&data_input_id=' . get_request_var('id')); - form_selectable_cell("", $id, '', 'right'); + form_selectable_cell("", $i, '', 'right'); } form_end_row(); diff --git a/graphs_new.php b/graphs_new.php index b6a503d3e3..15cd143a12 100644 --- a/graphs_new.php +++ b/graphs_new.php @@ -452,7 +452,7 @@ function graphs() { $host = db_fetch_row_prepared('SELECT id, description, hostname, host_template_id FROM host WHERE id = ?', - array(get_request_var('host_id'))); + array(get_filter_request_var('host_id'))); } if (cacti_sizeof($host)) { @@ -479,7 +479,7 @@ function graphs() { if (get_request_var('rows') == '-1') { $rows = read_user_setting('num_rows_table', read_config_option('num_rows_table'), true); } else { - $rows = get_request_var('rows'); + $rows = get_filter_request_var('rows'); } form_start('graphs_new.php', 'chk'); diff --git a/host_templates.php b/host_templates.php index 759ae8073c..5d6cfe634f 100644 --- a/host_templates.php +++ b/host_templates.php @@ -558,23 +558,26 @@ function template_edit() { $header_label = __esc('Device Templates [edit: %s]', $host_template['name']); } else { + $host_template = array(); + $header_label = __('Device Templates [new]'); + set_request_var('id', 0); } - if (!cacti_sizeof($host_template) || $host_template['version'] == '') { + if (!cacti_sizeof($host_template) || !isset($host_template['version']) || $host_template['version'] == '') { $fields_host_template_edit['version']['default'] = CACTI_VERSION; } - if (!cacti_sizeof($host_template) || $host_template['author'] == '') { + if (!cacti_sizeof($host_template) || !isset($host_template['author']) || $host_template['author'] == '') { $fields_host_template_edit['author']['default'] = read_config_option('packaging_author'); } - if (!cacti_sizeof($host_template) || $host_template['email'] == '') { + if (!cacti_sizeof($host_template) || !isset($host_template['email']) || $host_template['email'] == '') { $fields_host_template_edit['email']['default'] = read_config_option('packaging_email'); } - if (!cacti_sizeof($host_template) || $host_template['copyright'] == '') { + if (!cacti_sizeof($host_template) || !isset($host_template['copyright']) || $host_template['copyright'] == '') { $fields_host_template_edit['copyright']['default'] = read_config_option('packaging_copyright'); } diff --git a/lib/auth.php b/lib/auth.php index e2c5c133b7..70f2b6f871 100644 --- a/lib/auth.php +++ b/lib/auth.php @@ -3143,12 +3143,12 @@ function auth_valid_user($user_id) { function auth_row_cache_purge($user_id, $class = 'all') { if ($user_id > 0) { if ($class == 'all') { - db_execute_prepared('DELETE FROM + db_execute_prepared('DELETE FROM user_auth_row_cache WHERE user_id = ?', array($user_id)); } else { - db_execute_prepared('DELETE FROM + db_execute_prepared('DELETE FROM user_auth_row_cache WHERE user_id = ? AND class = ?', @@ -3158,7 +3158,7 @@ function auth_row_cache_purge($user_id, $class = 'all') { if ($class == 'all') { db_execute('TRUNCATE user_auth_row_cache'); } else { - db_execute_prepared('DELETE FROM + db_execute_prepared('DELETE FROM user_auth_row_cache WHERE class = ?', array($class)); diff --git a/utilities.php b/utilities.php index 660f2344fc..5042c3f85f 100644 --- a/utilities.php +++ b/utilities.php @@ -787,7 +787,7 @@ function create_poller_cache_filter() { 'array' => $status, 'value' => '-1' ), - 'poller_actions' => array( + 'poller_action' => array( 'method' => 'drop_array', 'friendly_name' => __('Actions'), 'filter' => FILTER_VALIDATE_INT,