From c026aab073bd22bf5f84212a5dce3626c43cf314 Mon Sep 17 00:00:00 2001 From: fusionate Date: Wed, 24 May 2023 20:52:04 +0000 Subject: [PATCH] Device [Class]: Updates for PHP 8.1 --- app/devices/resources/classes/device.php | 72 ++++++++++++------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/app/devices/resources/classes/device.php b/app/devices/resources/classes/device.php index f07556c813..f1dc101afa 100644 --- a/app/devices/resources/classes/device.php +++ b/app/devices/resources/classes/device.php @@ -315,7 +315,7 @@ //build the delete array foreach ($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { $sql = "update v_devices set device_uuid_alternate = null where device_uuid_alternate = :device_uuid_alternate; "; $parameters['device_uuid_alternate'] = $record['uuid']; $database = new database; @@ -392,7 +392,7 @@ //filter out unchecked device lines, build delete array $x = 0; foreach ($records as $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; $array[$this->table][$x]['device_uuid'] = $this->device_uuid; $x++; @@ -400,7 +400,7 @@ } //delete the checked rows - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //execute delete $database = new database; $database->app_name = $this->app_name; @@ -439,7 +439,7 @@ //filter out unchecked device keys, build delete array $x = 0; foreach ($records as $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; $array[$this->table][$x]['device_uuid'] = $this->device_uuid; $x++; @@ -447,7 +447,7 @@ } //delete the checked rows - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //execute delete $database = new database; $database->app_name = $this->app_name; @@ -486,7 +486,7 @@ //filter out unchecked device settings, build delete array $x = 0; foreach ($records as $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; $array[$this->table][$x]['device_uuid'] = $this->device_uuid; $x++; @@ -494,7 +494,7 @@ } //delete the checked rows - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //execute delete $database = new database; $database->app_name = $this->app_name; @@ -536,7 +536,7 @@ //build the delete array foreach ($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { foreach ($this->tables as $table) { $array[$table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; } @@ -544,7 +544,7 @@ } //delete the checked rows - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //grant temporary permissions $p = new permissions; @@ -599,7 +599,7 @@ //build the delete array foreach ($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { foreach ($this->tables as $table) { $array[$table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; } @@ -607,7 +607,7 @@ } //delete the checked rows - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //grant temporary permissions $p = new permissions; @@ -661,7 +661,7 @@ //build the delete array foreach ($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { foreach ($this->tables as $table) { $array[$table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; } @@ -669,7 +669,7 @@ } //delete the checked rows - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //grant temporary permissions $p = new permissions; @@ -723,13 +723,13 @@ //build the delete array foreach ($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; } } //execute delete - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { $database = new database; $database->app_name = $this->app_name; $database->app_uuid = $this->app_uuid; @@ -769,13 +769,13 @@ //build the delete array foreach ($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; } } //execute delete - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { $database = new database; $database->app_name = $this->app_name; $database->app_uuid = $this->app_uuid; @@ -819,8 +819,8 @@ if (is_array($records) && @sizeof($records) != 0) { //get current toggle state - foreach($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + foreach ($records as $x => $record) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { $uuids[] = "'".$record['uuid']."'"; } } @@ -841,14 +841,14 @@ //build update array $x = 0; - foreach($states as $uuid => $state) { + foreach ($states as $uuid => $state) { $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid; $array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0]; $x++; } //save the changes - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //save the array $database = new database; @@ -901,8 +901,8 @@ if (is_array($records) && @sizeof($records) != 0) { //get current toggle state - foreach($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + foreach ($records as $x => $record) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { $uuids[] = "'".$record['uuid']."'"; } } @@ -921,14 +921,14 @@ //build update array $x = 0; - foreach($states as $uuid => $state) { + foreach ($states as $uuid => $state) { $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid; $array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0]; $x++; } //save the changes - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //save the array $database = new database; @@ -974,8 +974,8 @@ if (is_array($records) && @sizeof($records) != 0) { //get current toggle state - foreach($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + foreach ($records as $x => $record) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { $uuids[] = "'".$record['uuid']."'"; } } @@ -994,14 +994,14 @@ //build update array $x = 0; - foreach($states as $uuid => $state) { + foreach ($states as $uuid => $state) { $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid; $array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0]; $x++; } //save the changes - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //save the array $database = new database; @@ -1047,8 +1047,8 @@ if (is_array($records) && @sizeof($records) != 0) { //get current toggle state - foreach($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + foreach ($records as $x => $record) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { $uuids[] = "'".$record['uuid']."'"; } } @@ -1067,14 +1067,14 @@ //build update array $x = 0; - foreach($states as $uuid => $state) { + foreach ($states as $uuid => $state) { $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid; $array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0]; $x++; } //save the changes - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //save the array $database = new database; @@ -1121,8 +1121,8 @@ if (is_array($records) && @sizeof($records) != 0) { //get checked records - foreach($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + foreach ($records as $x => $record) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { $uuids[] = "'".$record['uuid']."'"; } } @@ -1206,7 +1206,7 @@ } //save the changes and set the message - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array) && is_array($array) && @sizeof($array) != 0) { //grant temporary permissions $p = new permissions;