Frytimo pr patches for php8.1 (#6630)

* Passing null to parameter #2 ($string) of type string is deprecated

* Passing null to parameter #1 ($string) of type string is deprecated

* php 8.1 fixes

* php 8.1 fixes - replace strlen($var) > 0 with !empty($var)

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - strlower with null

* php 8.1 fixes - strreplace with null

* php 8.1 fixes - passing null to base64_decode

* php 8.1 fixes - check for false and check for null on $this->dir

* php 8.1 fixes - remove assignment of $db variable to modules object

* php 8.1 fixes - avoid sending null to substr

* php 8.1 fixes - change ${var} to {$var}

* php 8.1 fixes - check for null before preg_replace

* php 8.1 fixes - remove setting db variable on domains object

* php 8.1 fixes - set empty string if $row['domain_setting_subcategory'] is null

* php 8.1 fixes - set empty string if $_REQUEST['show'] is not available

* php 8.1 fixes

* php 8.1 fixes - correct $_POST checking syntax

* php 8.1 fixes - correct $_POST variables

* php 8.1 fixes

* Use brackets consistently

* Update user_setting_edit.php

* Change to not empty

* Update device.php

* Update text.php

---------

Co-authored-by: Tim Fry <tim@voipstratus.com>
Co-authored-by: FusionPBX <markjcrane@gmail.com>
This commit is contained in:
frytimo
2023-05-05 13:46:37 -03:00
committed by GitHub
parent ebbb2f1a72
commit fef8165be2
230 changed files with 1948 additions and 1937 deletions

View File

@@ -55,7 +55,7 @@
}
//process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//process the http post data by submitted action
if ($_POST['action'] != '' && is_uuid($_POST['device_profile_uuid'])) {
@@ -115,13 +115,13 @@
//check for all required data
$msg = '';
if (strlen($device_profile_name) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_name']."<br>\n"; }
//if (strlen($device_profile_keys) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_keys']."<br>\n"; }
//if (strlen($device_profile_settings) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_settings']."<br>\n"; }
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
if (strlen($device_profile_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_enabled']."<br>\n"; }
//if (strlen($device_profile_description) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (empty($device_profile_name)) { $msg .= $text['message-required']." ".$text['label-device_profile_name']."<br>\n"; }
//if (empty($device_profile_keys)) { $msg .= $text['message-required']." ".$text['label-device_profile_keys']."<br>\n"; }
//if (empty($device_profile_settings)) { $msg .= $text['message-required']." ".$text['label-device_profile_settings']."<br>\n"; }
//if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
if (empty($device_profile_enabled)) { $msg .= $text['message-required']." ".$text['label-device_profile_enabled']."<br>\n"; }
//if (empty($device_profile_description)) { $msg .= $text['message-required']." ".$text['label-device_profile_description']."<br>\n"; }
if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "<div align='center'>\n";
@@ -135,7 +135,7 @@
}
//add the device_profile_uuid
if (strlen($_POST["device_profile_uuid"]) == 0) {
if (empty($_POST["device_profile_uuid"])) {
$device_profile_uuid = uuid();
}
@@ -147,7 +147,7 @@
$array['device_profiles'][0]["device_profile_description"] = $device_profile_description;
$y = 0;
foreach ($device_profile_keys as $row) {
if (strlen($row['profile_key_vendor']) > 0 && strlen($row['profile_key_id']) > 0) {
if (strlen($row['profile_key_vendor']) > 0 && !empty($row['profile_key_id'])) {
$array['device_profiles'][0]['device_profile_keys'][$y]["domain_uuid"] = $domain_uuid;
$array['device_profiles'][0]['device_profile_keys'][$y]["device_profile_key_uuid"] = $row["device_profile_key_uuid"];
$array['device_profiles'][0]['device_profile_keys'][$y]["profile_key_category"] = $row["profile_key_category"];
@@ -169,7 +169,7 @@
$y = 0;
if (permission_exists("device_profile_setting_edit")) {
foreach ($device_profile_settings as $row) {
if (strlen($row['profile_setting_name']) > 0 && strlen($row['profile_setting_enabled']) > 0) {
if (strlen($row['profile_setting_name']) > 0 && !empty($row['profile_setting_enabled'])) {
$array['device_profiles'][0]['device_profile_settings'][$y]["domain_uuid"] = $domain_uuid;
$array['device_profiles'][0]['device_profile_settings'][$y]["device_profile_setting_uuid"] = $row["device_profile_setting_uuid"];
$array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_name"] = $row["profile_setting_name"];
@@ -246,10 +246,10 @@
}
//set the defaults
if (strlen($device_profile_enabled) == 0) { $device_profile_enabled = 'true'; }
if (empty($device_profile_enabled)) { $device_profile_enabled = 'true'; }
//get the child data
if (strlen($device_profile_uuid) > 0) {
if (!empty($device_profile_uuid)) {
$sql = "select * from v_device_profile_keys ";
$sql .= "where device_profile_uuid = :device_profile_uuid ";
//$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
@@ -316,7 +316,7 @@
unset($sql);
//add the $device_profile_key_uuid
if (strlen($device_profile_key_uuid) == 0) {
if (empty($device_profile_key_uuid)) {
$device_profile_key_uuid = uuid();
}
@@ -348,7 +348,7 @@
}
//get the child data
if (strlen($device_profile_uuid) > 0) {
if (!empty($device_profile_uuid)) {
$sql = "select * from v_device_profile_settings ";
$sql .= "where device_profile_uuid = :device_profile_uuid ";
//$sql .= "and domain_uuid = '".$domain_uuid."' ";
@@ -361,7 +361,7 @@
}
//add the $device_profile_setting_uuid
if (strlen($device_profile_setting_uuid) == 0) {
if (empty($device_profile_setting_uuid)) {
$device_profile_setting_uuid = uuid();
}
@@ -536,7 +536,7 @@
}
echo " <option value='programmable' ".($row['profile_key_category'] == "programmable" ? "selected='selected'" : null).">".$text['label-programmable']."</option>\n";
if ($row['profile_key_vendor'] !== "polycom") {
if (strlen($row['profile_key_vendor']) == 0) {
if (empty($row['profile_key_vendor'])) {
echo " <option value='expansion' ".($row['profile_key_category'] == "expansion" ? "selected='selected'" : null).">".$text['label-expansion']."</option>\n";
echo " <option value='expansion-1' ".($row['profile_key_category'] == "expansion-1" ? "selected='selected'" : null).">".$text['label-expansion']." 1</option>\n";
echo " <option value='expansion-2' ".($row['profile_key_category'] == "expansion-2" ? "selected='selected'" : null).">".$text['label-expansion']." 2</option>\n";
@@ -577,7 +577,7 @@
if ($row['profile_key_vendor'] == $vendor['name']) {
$selected = "selected='selected'";
}
if (strlen($vendor['name']) > 0) {
if (!empty($vendor['name'])) {
echo " <option value='".escape($vendor['name'])."' $selected >".escape(ucwords($vendor['name']))."</option>\n";
}
}
@@ -591,7 +591,7 @@
$previous_vendor = '';
$i = 0;
foreach ($vendor_functions as $function) {
if (strlen($row['profile_key_vendor']) == 0 && $function['vendor_name'] != $previous_vendor) {
if (empty($row['profile_key_vendor']) && $function['vendor_name'] != $previous_vendor) {
if ($i > 0) { echo " </optgroup>\n"; }
echo " <optgroup label='".escape(ucwords($function['vendor_name']))."'>\n";
}
@@ -599,16 +599,16 @@
if ($row['profile_key_vendor'] == $function['vendor_name'] && $row['profile_key_type'] == $function['value']) {
$selected = "selected='selected'";
}
if (strlen($row['profile_key_vendor']) == 0) {
if (empty($row['profile_key_vendor'])) {
echo " <option value='".escape($function['value'])."' vendor='".escape($function['vendor_name'])."' $selected >".$text['label-'.$function['type']]."</option>\n";
}
if (strlen($row['profile_key_vendor']) > 0 && $row['profile_key_vendor'] == $function['vendor_name']) {
if (!empty($row['profile_key_vendor']) && $row['profile_key_vendor'] == $function['vendor_name']) {
echo " <option value='".escape($function['value'])."' vendor='".escape($function['vendor_name'])."' $selected >".$text['label-'.$function['type']]."</option>\n";
}
$previous_vendor = $function['vendor_name'];
$i++;
}
if (strlen($row['profile_key_vendor']) == 0) {
if (empty($row['profile_key_vendor'])) {
echo " </optgroup>\n";
}
echo " </select>\n";