diff --git a/aggregate_graphs.php b/aggregate_graphs.php index 593ab6e8c4..8cf2eeb5ff 100644 --- a/aggregate_graphs.php +++ b/aggregate_graphs.php @@ -285,7 +285,7 @@ function form_actions() { $graph_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/aggregate_templates.php b/aggregate_templates.php index d86fe4d6eb..c494c0e2b4 100644 --- a/aggregate_templates.php +++ b/aggregate_templates.php @@ -284,7 +284,7 @@ function aggregate_form_actions() { $aggregate_list = ''; $i = 0; /* loop through each of the color templates selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/automation_devices.php b/automation_devices.php index 016cb9f9a4..239eac83be 100644 --- a/automation_devices.php +++ b/automation_devices.php @@ -124,7 +124,7 @@ function form_actions() { $device_list = ''; $device_array = array(); $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/automation_graph_rules.php b/automation_graph_rules.php index 8d8c3d28ec..7192caf018 100644 --- a/automation_graph_rules.php +++ b/automation_graph_rules.php @@ -228,7 +228,7 @@ function automation_graph_rules_form_actions() { /* setup some variables */ $automation_graph_rules_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/automation_networks.php b/automation_networks.php index dfbd6e2606..7c80af37dd 100644 --- a/automation_networks.php +++ b/automation_networks.php @@ -285,7 +285,7 @@ function form_actions() { $networks_list = ''; $i = 0; /* loop through each of the device types selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/automation_snmp.php b/automation_snmp.php index 510d474a77..2c74996bda 100644 --- a/automation_snmp.php +++ b/automation_snmp.php @@ -196,7 +196,7 @@ function form_automation_snmp_actions() { /* setup some variables */ $snmp_groups = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/automation_templates.php b/automation_templates.php index 3ec413946c..78e2bdff13 100644 --- a/automation_templates.php +++ b/automation_templates.php @@ -164,7 +164,7 @@ function form_actions() { /* setup some variables */ $at_list = ''; $i = 0; - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/automation_tree_rules.php b/automation_tree_rules.php index c95cb07a50..5b56fe283f 100644 --- a/automation_tree_rules.php +++ b/automation_tree_rules.php @@ -230,7 +230,7 @@ function automation_tree_rules_form_actions() { $automation_tree_rules_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/cdef.php b/cdef.php index e2f722333f..08670effe0 100644 --- a/cdef.php +++ b/cdef.php @@ -251,7 +251,7 @@ function form_actions() { $cdef_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/color.php b/color.php index 14e39c4007..9e6fb9c217 100644 --- a/color.php +++ b/color.php @@ -155,16 +155,17 @@ function form_actions() { } /* setup some variables */ - $color_list = ''; $i = 0; + $color_list = ''; + $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); /* ==================================================== */ - $color = db_fetch_row_prepared('SELECT * FROM colors WHERE id = ?', array($matches[1])); + $color = db_fetch_row_prepared('SELECT name, hex FROM colors WHERE id = ?', array($matches[1])); $color_list .= '
  • ' . ($color['name'] != '' ? htmlspecialchars($color['name']): __('Unnamed Color')) . ' (' . $color['hex'] . ')
  • '; $color_array[$i] = $matches[1]; diff --git a/color_templates.php b/color_templates.php index 20286cdae0..0550e417ea 100644 --- a/color_templates.php +++ b/color_templates.php @@ -203,7 +203,7 @@ function aggregate_color_form_actions() { $color_list = ''; $i = 0; /* loop through each of the color templates selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/data_input.php b/data_input.php index 45b9644004..a3bbc4231d 100644 --- a/data_input.php +++ b/data_input.php @@ -184,7 +184,7 @@ function form_actions() { $di_list = ''; $i = 0; /* loop through each of the data queries and process them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/data_queries.php b/data_queries.php index 7f65104b4c..bff5e73fb4 100644 --- a/data_queries.php +++ b/data_queries.php @@ -288,7 +288,7 @@ function form_actions() { $dq_list = ''; $i = 0; /* loop through each of the data queries and process them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/data_source_profiles.php b/data_source_profiles.php index a5ff68f257..4afe5a7384 100644 --- a/data_source_profiles.php +++ b/data_source_profiles.php @@ -235,7 +235,7 @@ function form_actions() { $profile_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST AS $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/data_sources.php b/data_sources.php index 5d18f34bbd..f414aa332a 100644 --- a/data_sources.php +++ b/data_sources.php @@ -396,7 +396,7 @@ function form_actions() { $ds_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/data_templates.php b/data_templates.php index 68056f3cf2..7a24ecb336 100644 --- a/data_templates.php +++ b/data_templates.php @@ -320,7 +320,7 @@ function form_actions() { $ds_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); @@ -458,11 +458,11 @@ function template_rrd_add() { $children = db_fetch_assoc_prepared('SELECT local_data_id FROM data_template_data WHERE data_template_id = ? AND local_data_id > 0', array(get_request_var('id'))); if (sizeof($children) > 0) { - foreach ($children as $item) { - db_execute_prepared("INSERT IGNORE INTO data_template_rrd - (local_data_template_rrd_id, local_data_id, data_template_id, rrd_maximum, rrd_minimum, rrd_heartbeat, data_source_type_id, data_source_name) - VALUES (?, ?, ?, 0, 0, 600, 1, ?)", array($data_template_rrd_id, $item['local_data_id'], get_request_var('id'), $dsname)); - } + foreach ($children as $item) { + db_execute_prepared("INSERT IGNORE INTO data_template_rrd + (local_data_template_rrd_id, local_data_id, data_template_id, rrd_maximum, rrd_minimum, rrd_heartbeat, data_source_type_id, data_source_name) + VALUES (?, ?, ?, 0, 0, 600, 1, ?)", array($data_template_rrd_id, $item['local_data_id'], get_request_var('id'), $dsname)); + } } header('Location: data_templates.php?action=template_edit&id=' . get_request_var('id') . "&view_rrd=$data_template_rrd_id"); diff --git a/gprint_presets.php b/gprint_presets.php index 7818a381b9..c23ac2961e 100644 --- a/gprint_presets.php +++ b/gprint_presets.php @@ -122,7 +122,7 @@ function form_actions() { $gprint_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/graph_templates.php b/graph_templates.php index 623cd6ad43..51e37efda4 100644 --- a/graph_templates.php +++ b/graph_templates.php @@ -285,7 +285,7 @@ function form_actions() { $graph_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/graphs.php b/graphs.php index 47ad9b9678..8d6cd4ba20 100644 --- a/graphs.php +++ b/graphs.php @@ -708,7 +708,7 @@ function form_actions() { $graph_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/host.php b/host.php index 34b643be86..558272eca3 100644 --- a/host.php +++ b/host.php @@ -397,7 +397,7 @@ function form_actions() { $host_list = ''; $i = 0; /* loop through each of the host templates selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/host_templates.php b/host_templates.php index 69c92fb0ec..f76fb2c6b0 100644 --- a/host_templates.php +++ b/host_templates.php @@ -230,7 +230,7 @@ function form_actions() { $host_list = ''; $i = 0; /* loop through each of the host templates selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/include/global.php b/include/global.php index 0a0f80ef04..0fb60c9e6a 100644 --- a/include/global.php +++ b/include/global.php @@ -311,7 +311,7 @@ if ((bool)ini_get('register_globals')) { unset($input['input']); unset($input['not_unset']); - while (list($var,) = @each($input)) { + foreach ($input as $var => $val) { if (!in_array($var, $not_unset)) { unset($$var); } diff --git a/lib/api_aggregate.php b/lib/api_aggregate.php index 79e691009f..c7c3a82d9c 100644 --- a/lib/api_aggregate.php +++ b/lib/api_aggregate.php @@ -506,7 +506,7 @@ function aggregate_validate_graph_params($posted, $has_override = false) { * */ function aggregate_validate_graph_items($posted, &$graph_items) { - while (list($var,$val) = each($posted)) { + foreach ($_POST as $var => $val) { /* work on color_templates */ if (preg_match('/^agg_color_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ diff --git a/lib/api_automation_tools.php b/lib/api_automation_tools.php index 92b609ada5..424905d1b9 100644 --- a/lib/api_automation_tools.php +++ b/lib/api_automation_tools.php @@ -221,7 +221,7 @@ function displayQueryTypes($types, $quietMode = FALSE) { echo "Known SNMP Query Types: (id, name)\n"; } - while (list($id, $name) = each ($types)) { + foreach ($types as $id => $name) { echo $id . "\t" . $name . "\n"; } @@ -269,7 +269,7 @@ function displaySNMPFields($fields, $hostId, $quietMode = FALSE) { echo "Known SNMP Fields for host-id $hostId: (name)\n"; } - while (list($field, $values) = each ($fields)) { + foreach ($fields as $field => $values) { echo $field . "\n"; } @@ -297,7 +297,7 @@ function displaySNMPQueries($queries, $quietMode = FALSE) { echo "Known SNMP Queries:(id, name)\n"; } - while (list($id, $name) = each ($queries)) { + foreach ($queries as $id => $name) { echo $id . "\t" . $name . "\n"; } @@ -327,7 +327,7 @@ function displayGraphTemplates($templates, $quietMode = FALSE) { echo "Known Graph Templates:(id, name)\n"; } - while (list($id, $name) = each ($templates)) { + foreach ($templates as $id => $name) { echo $id . "\t" . $name . "\n"; } diff --git a/lib/html_reports.php b/lib/html_reports.php index 40bff6f208..5b67c4fb7f 100644 --- a/lib/html_reports.php +++ b/lib/html_reports.php @@ -637,7 +637,7 @@ function reports_form_actions() { /* setup some variables */ $reports_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/links.php b/links.php index b3d013e54d..336a00e7a8 100644 --- a/links.php +++ b/links.php @@ -165,7 +165,7 @@ function form_actions() { $page_list = ''; $i = 0; /* loop through each of the pages selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/pollers.php b/pollers.php index 933a80d520..016aa2732a 100644 --- a/pollers.php +++ b/pollers.php @@ -257,7 +257,7 @@ function form_actions() { $pollers = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/rrdcleaner.php b/rrdcleaner.php index 54e3b23b2a..9a40a5360d 100644 --- a/rrdcleaner.php +++ b/rrdcleaner.php @@ -438,7 +438,7 @@ function do_rrd() { /* install the rrdclean error handler */ set_error_handler('rrdclean_error_handler'); - while (list ($var, $val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_(.*)$/', $var, $matches)) { /* recreate the file name */ $unused_file = db_fetch_row_prepared('SELECT id, name, local_data_id diff --git a/sites.php b/sites.php index ca6bb69e47..67496e627b 100644 --- a/sites.php +++ b/sites.php @@ -249,7 +249,7 @@ function form_actions() { $site_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/user_admin.php b/user_admin.php index ac267ccb85..d987ff1043 100644 --- a/user_admin.php +++ b/user_admin.php @@ -102,7 +102,7 @@ function form_actions() { /* if we are to save this form, instead of display it */ if (isset_request_var('associate_host')) { - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); @@ -126,7 +126,7 @@ function form_actions() { header('Location: user_admin.php?action=user_edit&header=false&tab=permsd&id=' . get_nfilter_request_var('id')); exit; }elseif (isset_request_var('associate_graph')) { - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); @@ -150,7 +150,7 @@ function form_actions() { header('Location: user_admin.php?action=user_edit&header=false&tab=permsg&id=' . get_nfilter_request_var('id')); exit; }elseif (isset_request_var('associate_template')) { - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); @@ -174,7 +174,7 @@ function form_actions() { header('Location: user_admin.php?action=user_edit&header=false&tab=permste&id=' . get_nfilter_request_var('id')); exit; }elseif (isset_request_var('associate_groups')) { - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); @@ -197,7 +197,7 @@ function form_actions() { header('Location: user_admin.php?action=user_edit&header=false&tab=permsgr&id=' . get_nfilter_request_var('id')); exit; }elseif (isset_request_var('associate_tree')) { - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); @@ -307,7 +307,7 @@ function form_actions() { $user_list = ''; $user_array = array(); $i = 0; - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/user_domains.php b/user_domains.php index fdd9bf8eb1..32f5190d67 100644 --- a/user_domains.php +++ b/user_domains.php @@ -194,10 +194,11 @@ function form_actions() { } /* setup some variables */ - $d_list = ''; $d_array = array(); + $d_list = ''; + $d_array = array(); /* loop through each of the data queries and process them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/user_group_admin.php b/user_group_admin.php index 1f14a3fff3..8995cc59b7 100644 --- a/user_group_admin.php +++ b/user_group_admin.php @@ -264,7 +264,7 @@ function form_actions() { /* if we are to save this form, instead of display it */ if (isset_request_var('associate_host')) { - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); @@ -288,7 +288,7 @@ function form_actions() { header('Location: user_group_admin.php?action=edit&header=false&tab=permsd&id=' . get_nfilter_request_var('id')); exit; }elseif (isset_request_var('associate_graph')) { - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); @@ -312,7 +312,7 @@ function form_actions() { header('Location: user_group_admin.php?action=edit&header=false&tab=permsg&id=' . get_nfilter_request_var('id')); exit; }elseif (isset_request_var('associate_template')) { - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); @@ -336,7 +336,7 @@ function form_actions() { header('Location: user_group_admin.php?action=edit&header=false&tab=permste&id=' . get_nfilter_request_var('id')); exit; }elseif (isset_request_var('associate_tree')) { - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); @@ -360,7 +360,7 @@ function form_actions() { header('Location: user_group_admin.php?action=edit&header=false&tab=permstr&id=' . get_nfilter_request_var('id')); exit; }elseif (isset_request_var('associate_member')) { - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); @@ -413,7 +413,7 @@ function form_actions() { $group_list = ''; $group_array = array(); $i = 0; - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); diff --git a/vdef.php b/vdef.php index 0124a18193..85302b4a57 100644 --- a/vdef.php +++ b/vdef.php @@ -241,7 +241,7 @@ function vdef_form_actions() { $vdef_list = ''; /* loop through each of the graphs selected on the previous page and get more info about them */ - while (list($var,$val) = each($_POST)) { + foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]);