From fea5368a74dea7a8a008dbedca9197d34d58ac62 Mon Sep 17 00:00:00 2001 From: fusionate Date: Thu, 25 May 2023 15:42:19 +0000 Subject: [PATCH] Device Vendor - Edit: Updates for PHP 8.1 --- app/devices/device_vendor_edit.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/devices/device_vendor_edit.php b/app/devices/device_vendor_edit.php index c694469860..c31c30464e 100644 --- a/app/devices/device_vendor_edit.php +++ b/app/devices/device_vendor_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2016-2022 + Portions created by the Initial Developer are Copyright (C) 2016-2023 the Initial Developer. All Rights Reserved. Contributor(s): @@ -46,7 +46,7 @@ $text = $language->get(); //action add or update - if (is_uuid($_REQUEST["id"])) { + if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; $device_vendor_uuid = $_REQUEST["id"]; } @@ -57,7 +57,7 @@ //get http post variables and set them to php variables if (count($_POST) > 0) { $name = $_POST["name"]; - $enabled = $_POST["enabled"] ?: 'false'; + $enabled = $_POST["enabled"] ?? 'false'; $description = $_POST["description"]; } @@ -96,7 +96,7 @@ } //add or update the database - if ($_POST["persistformvar"] != "true") { + if (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true") { if ($action == "add" && permission_exists('device_vendor_add')) { $array['device_vendors'][0]['device_vendor_uuid'] = uuid(); message::add($text['message-add']); @@ -125,7 +125,7 @@ } //pre-populate the form - if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { + if (!empty($_GET) && count($_GET) > 0 && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) { $device_vendor_uuid = $_GET["id"]; $sql = "select * from v_device_vendors "; $sql .= "where device_vendor_uuid = :device_vendor_uuid "; @@ -170,7 +170,7 @@ echo " ".$text['label-name']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-name']."\n"; echo "\n"; @@ -203,7 +203,7 @@ echo " ".$text['label-description']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-description']."\n"; echo "\n"; @@ -227,4 +227,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file