remove instances where a pointer is used in a foreach loop for value (#7108)

This commit is contained in:
frytimo
2024-08-22 12:41:10 -06:00
committed by GitHub
parent 0583c5b429
commit 2cbb4dbc31
73 changed files with 170 additions and 170 deletions
+3 -3
View File
@@ -57,7 +57,7 @@ if ($domains_processed == 1) {
$sql .= "and k.device_key_vendor is null ";
$device_keys = $database->select($sql, null, 'all');
if (!empty($device_keys)) {
foreach ($device_keys as $index => &$row) {
foreach ($device_keys as $index => $row) {
$array['device_keys'][$index]['device_key_uuid'] = $row["device_key_uuid"];
$array['device_keys'][$index]['device_key_vendor'] = $row["device_vendor"];
}
@@ -87,7 +87,7 @@ if ($domains_processed == 1) {
//loop through the device_keys to build the data array
if (!empty($device_profile_keys)) {
foreach ($device_profile_keys as $index => &$row) {
foreach ($device_profile_keys as $index => $row) {
$array['device_profile_keys'][$index]['device_profile_key_uuid'] = $row["device_key_uuid"];
$array['device_profile_keys'][$index]['domain_uuid'] = $row["domain_uuid"];
$array['device_profile_keys'][$index]['device_profile_uuid'] = $row["device_profile_uuid"];
@@ -131,7 +131,7 @@ if ($domains_processed == 1) {
//loop through the device_keys to build the data array
if (!empty($device_profile_keys)) {
foreach ($device_profile_keys as $index => &$row) {
foreach ($device_profile_keys as $index => $row) {
$array['device_profile_settings'][$index]['device_profile_setting_uuid'] = $row["device_setting_uuid"];
$array['device_profile_settings'][$index]['domain_uuid'] = $row["domain_uuid"];
$array['device_profile_settings'][$index]['device_profile_uuid'] = $row["device_profile_uuid"];
+1 -1
View File
@@ -73,7 +73,7 @@
}
//find and remove the "|2" that denotes a duplicate header
foreach ($headers as &$header) {
foreach ($headers as $header) {
$pos = strpos($header, '|');
if ($pos !== false) {
$header = substr($header, 0, $pos);
+4 -4
View File
@@ -366,7 +366,7 @@
//remove empty device keys
if (isset($row['device_keys'])) {
$y = 0;
foreach ($row['device_keys'] as &$sub_row) {
foreach ($row['device_keys'] as $sub_row) {
if (count($sub_row) == 2) {
unset($array['devices'][$x]['device_keys']);
}
@@ -377,7 +377,7 @@
//remove empty device lines
if (isset($row['device_lines'])) {
$y = 0;
foreach ($row['device_lines'] as &$sub_row) {
foreach ($row['device_lines'] as $sub_row) {
if (count($sub_row) == 2) {
unset($array['devices'][$x]['device_lines']);
}
@@ -413,7 +413,7 @@
//remove empty device keys
if (isset($row['device_keys'])) {
$y = 0;
foreach ($row['device_keys'] as &$sub_row) {
foreach ($row['device_keys'] as $sub_row) {
if (count($sub_row) == 2) {
unset($array['devices'][$x]['device_keys']);
}
@@ -424,7 +424,7 @@
//remove empty device lines
if (isset($row['device_lines'])) {
$y = 0;
foreach ($row['device_lines'] as &$sub_row) {
foreach ($row['device_lines'] as $sub_row) {
if (count($sub_row) == 2) {
unset($array['devices'][$x]['device_lines']);
}
+1 -1
View File
@@ -230,7 +230,7 @@
$parameters['device_profile_uuid'] = $device_profile_uuid;
$database = new database;
$result = $database->execute($sql, $parameters, 'all');
foreach ($result as &$row) {
foreach ($result as $row) {
$domain_uuid = $row["domain_uuid"];
$device_profile_name = $row["device_profile_name"];
$device_profile_keys = $row["device_profile_keys"] ?? null;
+1 -1
View File
@@ -203,7 +203,7 @@
$vendor_function_groups = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
unset($group_list);
foreach ($vendor_function_groups as &$sub_row) {
foreach ($vendor_function_groups as $sub_row) {
$group_list[] = escape($sub_row["group_name"]).(($sub_row['group_domain_uuid'] != '') ? "@".escape($_SESSION['domains'][$sub_row['group_domain_uuid']]['domain_name']) : null);
}
$group_list = isset($group_list) ? implode(', ', $group_list) : '';
@@ -159,7 +159,7 @@
//add or update the device keys
if (is_array($_POST['device_keys'])) {
foreach ($_POST['device_keys'] as &$row) {
foreach ($_POST['device_keys'] as $row) {
//validate the data
$save = true;
@@ -187,7 +187,7 @@
//process the profile keys
if (!empty($row["device_profile_uuid"])) {
//get the profile key settings from the array
foreach ($device_profile_keys as &$field) {
foreach ($device_profile_keys as $field) {
if ($device_key_uuid == $field["device_key_uuid"]) {
$database = $field;
break;