Device Vendor - Edit: Updates for PHP 8.1

This commit is contained in:
fusionate 2023-05-25 15:42:19 +00:00
parent 7b18e82c32
commit fea5368a74
No known key found for this signature in database
1 changed files with 8 additions and 8 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
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. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -46,7 +46,7 @@
$text = $language->get(); $text = $language->get();
//action add or update //action add or update
if (is_uuid($_REQUEST["id"])) { if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$action = "update"; $action = "update";
$device_vendor_uuid = $_REQUEST["id"]; $device_vendor_uuid = $_REQUEST["id"];
} }
@ -57,7 +57,7 @@
//get http post variables and set them to php variables //get http post variables and set them to php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
$name = $_POST["name"]; $name = $_POST["name"];
$enabled = $_POST["enabled"] ?: 'false'; $enabled = $_POST["enabled"] ?? 'false';
$description = $_POST["description"]; $description = $_POST["description"];
} }
@ -96,7 +96,7 @@
} }
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('device_vendor_add')) { if ($action == "add" && permission_exists('device_vendor_add')) {
$array['device_vendors'][0]['device_vendor_uuid'] = uuid(); $array['device_vendors'][0]['device_vendor_uuid'] = uuid();
message::add($text['message-add']); message::add($text['message-add']);
@ -125,7 +125,7 @@
} }
//pre-populate the form //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"]; $device_vendor_uuid = $_GET["id"];
$sql = "select * from v_device_vendors "; $sql = "select * from v_device_vendors ";
$sql .= "where device_vendor_uuid = :device_vendor_uuid "; $sql .= "where device_vendor_uuid = :device_vendor_uuid ";
@ -170,7 +170,7 @@
echo " ".$text['label-name']."\n"; echo " ".$text['label-name']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n"; echo "<td width='70%' class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='name' maxlength='255' value=\"".escape($name)."\">\n"; echo " <input class='formfld' type='text' name='name' maxlength='255' value=\"".escape($name ?? '')."\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-name']."\n"; echo $text['description-name']."\n";
echo "</td>\n"; echo "</td>\n";
@ -203,7 +203,7 @@
echo " ".$text['label-description']."\n"; echo " ".$text['label-description']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='description' maxlength='255' value=\"".escape($description)."\">\n"; echo " <input class='formfld' type='text' name='description' maxlength='255' value=\"".escape($description ?? '')."\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-description']."\n"; echo $text['description-description']."\n";
echo "</td>\n"; echo "</td>\n";