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

@@ -130,7 +130,7 @@
//build update array
$array['dialplans'][0]['dialplan_uuid'] = $this->dialplan_uuid;
$array['dialplans'][0]['dialplan_name'] = $this->dialplan_name;
if (strlen($this->dialplan_continue) > 0) {
if (!empty($this->dialplan_continue)) {
$array['dialplans'][0]['dialplan_continue'] = $this->dialplan_continue;
}
$array['dialplans'][0]['dialplan_order'] = $this->dialplan_order;
@@ -188,7 +188,7 @@
$xml_string = file_get_contents($xml_file);
//prepare the xml
if (strlen($xml_string) > 0) {
if (!empty($xml_string)) {
//replace the variables
$length = (is_numeric($_SESSION["security"]["pin_length"]["var"])) ? $_SESSION["security"]["pin_length"]["var"] : 8;
$xml_string = str_replace("{v_context}", $domain['domain_name'], $xml_string);
@@ -200,7 +200,7 @@
//convert to an array
$dialplan = json_decode($json, true);
}
if (strlen($this->json) > 0) {
if (!empty($this->json)) {
//convert to an array
$dialplan = json_decode($json, true);
}
@@ -232,7 +232,7 @@
$xml_string = file_get_contents($xml_file);
//prepare the xml
if (strlen($xml_string) > 0) {
if (!empty($xml_string)) {
//replace the variables
$length = (is_numeric($_SESSION["security"]["pin_length"]["var"])) ? $_SESSION["security"]["pin_length"]["var"] : 8;
$xml_string = str_replace("{v_context}", $domain['domain_name'], $xml_string);
@@ -248,7 +248,7 @@
$dialplan = json_decode($json, true);
}
if (strlen($this->json) > 0) {
if (!empty($this->json)) {
//convert to an array
$dialplan = json_decode($json, true);
}
@@ -302,14 +302,14 @@
$array['dialplans'][$x]['dialplan_name'] = $dialplan['@attributes']['name'];
$array['dialplans'][$x]['dialplan_number'] = $dialplan['@attributes']['number'];
$array['dialplans'][$x]['dialplan_context'] = $dialplan_context;
if (strlen($dialplan['@attributes']['destination']) > 0) {
if (!empty($dialplan['@attributes']['destination'])) {
$array['dialplans'][$x]['dialplan_destination'] = $dialplan['@attributes']['destination'];
}
if (strlen($dialplan['@attributes']['continue']) > 0) {
if (!empty($dialplan['@attributes']['continue'])) {
$array['dialplans'][$x]['dialplan_continue'] = $dialplan['@attributes']['continue'];
}
$array['dialplans'][$x]['dialplan_order'] = $dialplan['@attributes']['order'];
if (strlen($dialplan['@attributes']['enabled']) > 0) {
if (!empty($dialplan['@attributes']['enabled'])) {
$array['dialplans'][$x]['dialplan_enabled'] = $dialplan['@attributes']['enabled'];
}
else {
@@ -330,7 +330,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $order;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = $row['@attributes']['field'];
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $row['@attributes']['expression'];
if (strlen($row['@attributes']['break']) > 0) {
if (!empty($row['@attributes']['break'])) {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_break'] = $row['@attributes']['break'];
}
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = $group;
@@ -367,7 +367,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $order;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = $row2['@attributes']['application'];
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $row2['@attributes']['data'];
if (strlen($row2['@attributes']['inline']) > 0) {
if (!empty($row2['@attributes']['inline'])) {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_inline'] = $row2['@attributes']['inline'];
}
else {
@@ -394,7 +394,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $order;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = $row2['@attributes']['application'];
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $row2['@attributes']['data'];
if (strlen($row2['@attributes']['inline']) > 0) {
if (!empty($row2['@attributes']['inline'])) {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_inline'] = $row2['@attributes']['inline'];
}
else {
@@ -522,7 +522,7 @@
$array[$x]['dialplan_order'] = $row['dialplan_order'];
$array[$x]['dialplan_enabled'] = $row['dialplan_enabled'];
$array[$x]['dialplan_description'] = $row['dialplan_description'];
if (strlen($row['dialplan_detail_uuid']) > 0) {
if (!empty($row['dialplan_detail_uuid'])) {
$array[$x]['dialplan_details'][$y]['dialplan_uuid'] = $row['dialplan_uuid'];
$array[$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = $row['dialplan_detail_uuid'];
$array[$x]['dialplan_details'][$y]['dialplan_detail_tag'] = $row['dialplan_detail_tag'];
@@ -714,7 +714,7 @@
//get the dialplan detail inline
$detail_inline = "";
if ($dialplan_detail_inline) {
if (strlen($dialplan_detail_inline) > 0) {
if (!empty($dialplan_detail_inline)) {
$detail_inline = " inline=\"" . $dialplan_detail_inline . "\"";
}
}
@@ -723,12 +723,12 @@
if ($dialplan_tag_status != "closed") {
if (($previous_dialplan_uuid != $dialplan_uuid) || ($previous_dialplan_detail_group != $dialplan_detail_group)) {
if ($condition_tag_status != "closed") {
if ($condition_attribute && (strlen($condition_attribute) > 0)) {
if ($condition_attribute && (!empty($condition_attribute))) {
$xml .= " <condition " . $condition_attribute . $condition_break . "/>\n";
$condition_attribute = "";
$condition_tag_status = "closed";
}
else if ($condition && (strlen($condition) > 0)) {
else if ($condition && (!empty($condition))) {
$xml .= " ".$condition . "/>";
$condition = "";
$condition_tag_status = "closed";
@@ -804,12 +804,12 @@
// finalize any previous pending condition statements
if ($condition_tag_status == "open") {
if (strlen($condition) > 0) {
if (!empty($condition)) {
$xml .= $condition . "/>\n";
$condition = '';
$condition_tag_status = "closed";
}
else if (strlen($condition_attribute) > 0 && $condition_tag_status == "open") {
else if (!empty($condition_attribute) && $condition_tag_status == "open") {
// previous condition(s) must have been of type time
// do not finalize if new condition is also of type time
if ($condition_type != 'time') {
@@ -828,7 +828,7 @@
//get the condition break attribute
$condition_break = "";
if ($dialplan_detail_break) {
if (strlen($dialplan_detail_break) > 0) {
if (!empty($dialplan_detail_break)) {
$condition_break = " break=\"" . $dialplan_detail_break . "\"";
}
}
@@ -854,11 +854,11 @@
if ($dialplan_detail_tag == "action" || $dialplan_detail_tag == "anti-action") {
if ($condition_tag_status == "open") {
if ($condition_attribute && (strlen($condition_attribute) > 0)) {
if ($condition_attribute && (!empty($condition_attribute))) {
$xml .= " <condition " . $condition_attribute . $condition_break . ">\n";
$condition_attribute = "";
}
else if ($condition && (strlen($condition) > 0)) {
else if ($condition && (!empty($condition))) {
$xml .= $condition . ">\n";
$condition = "";
}
@@ -923,10 +923,10 @@
//close the extension tag if it was left open
if ($dialplan_tag_status == "open") {
if ($condition_tag_status == "open") {
if ($condition_attribute and (strlen($condition_attribute) > 0)) {
if ($condition_attribute and (!empty($condition_attribute))) {
$xml .= " <condition " . $condition_attribute . $condition_break . "/>\n";
}
else if ($condition && (strlen($condition) > 0)) {
else if ($condition && (!empty($condition))) {
$xml .= $condition . "/>\n";
}
else {