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 10:46:37 -06:00
committed by GitHub
co-authored by Tim Fry FusionPBX
parent ebbb2f1a72
commit fef8165be2
230 changed files with 1948 additions and 1937 deletions
+45 -45
View File
@@ -51,22 +51,22 @@
$text = $language->get();
//get the http post values and set theme as php variables
if (is_array($_POST) > 0) {
if (!empty($_POST)) {
//set the variables
$dialplan_name = $_POST["dialplan_name"];
$dialplan_order = $_POST["dialplan_order"];
$dialplan_expression = $_POST["dialplan_expression"];
$prefix_number = $_POST["prefix_number"];
$condition_field_1 = $_POST["condition_field_1"];
$condition_expression_1 = $_POST["condition_expression_1"];
$condition_field_2 = $_POST["condition_field_2"];
$condition_expression_2 = $_POST["condition_expression_2"];
$gateway = $_POST["gateway"];
$limit = $_POST["limit"];
$accountcode = $_POST["accountcode"];
$toll_allow = $_POST["toll_allow"];
$pin_numbers_enable = $_POST["pin_numbers_enabled"];
if (strlen($pin_numbers_enable) == 0) { $pin_numbers_enable = "false"; }
$dialplan_name = $_POST["dialplan_name"] ?? '';
$dialplan_order = $_POST["dialplan_order"] ?? '';
$dialplan_expression = $_POST["dialplan_expression"] ?? '';
$prefix_number = $_POST["prefix_number"] ?? '';
$condition_field_1 = $_POST["condition_field_1"] ?? '';
$condition_expression_1 = $_POST["condition_expression_1"] ?? '';
$condition_field_2 = $_POST["condition_field_2"] ?? '';
$condition_expression_2 = $_POST["condition_expression_2"] ?? '';
$gateway = $_POST["gateway"] ?? '';
$limit = $_POST["limit"] ?? '';
$accountcode = $_POST["accountcode"] ?? '';
$toll_allow = $_POST["toll_allow"] ?? '';
$pin_numbers_enable = $_POST["pin_numbers_enabled"] ?? null;
if (empty($pin_numbers_enable)) { $pin_numbers_enable = "false"; }
//set the default type
$gateway_type = 'gateway';
$gateway_2_type = 'gateway';
@@ -125,7 +125,7 @@
$gateway_2_type = 'xmpp';
}
//set the gateway_2_id and gateway_2_name
if ($gateway_2_type == "gateway" && strlen($_POST["gateway_2"]) > 0) {
if ($gateway_2_type == "gateway" && !empty($_POST["gateway_2"])) {
$gateway_2_array = explode(":",$gateway_2);
$gateway_2_id = $gateway_2_array[0];
$gateway_2_name = $gateway_2_array[1];
@@ -158,7 +158,7 @@
$gateway_type = 'transfer';
}
//set the gateway_3_id and gateway_3_name
if ($gateway_3_type == "gateway" && strlen($_POST["gateway_3"]) > 0) {
if ($gateway_3_type == "gateway" && !empty($_POST["gateway_3"])) {
$gateway_3_array = explode(":",$gateway_3);
$gateway_3_id = $gateway_3_array[0];
$gateway_3_name = $gateway_3_array[1];
@@ -171,11 +171,11 @@
$dialplan_enabled = $_POST["dialplan_enabled"];
$dialplan_description = $_POST["dialplan_description"];
//set default to enabled
if (strlen($dialplan_enabled) == 0) { $dialplan_enabled = "true"; }
if (empty($dialplan_enabled)) { $dialplan_enabled = "true"; }
}
//process the http form values
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//validate the token
$token = new token;
@@ -186,17 +186,17 @@
}
//check for all required data
if (strlen($gateway) == 0) { $msg .= $text['message-provide'].": ".$text['label-gateway-name']."<br>\n"; }
//if (strlen($gateway_2) == 0) { $msg .= "Please provide: Alternat 1<br>\n"; }
//if (strlen($gateway_3) == 0) { $msg .= "Please provide: Alternat 2<br>\n"; }
if (strlen($dialplan_expression) == 0) { $msg .= $text['message-provide'].": ".$text['label-dialplan-expression']."<br>\n"; }
//if (strlen($dialplan_name) == 0) { $msg .= "Please provide: Extension Name<br>\n"; }
//if (strlen($condition_field_1) == 0) { $msg .= "Please provide: Condition Field<br>\n"; }
//if (strlen($condition_expression_1) == 0) { $msg .= "Please provide: Condition Expression<br>\n"; }
//if (strlen($limit) == 0) { $msg .= "Please provide: Limit<br>\n"; }
//if (strlen($dialplan_enabled) == 0) { $msg .= "Please provide: Enabled True or False<br>\n"; }
//if (strlen($description) == 0) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (empty($gateway)) { $msg .= $text['message-provide'].": ".$text['label-gateway-name']."<br>\n"; }
//if (empty($gateway_2)) { $msg .= "Please provide: Alternat 1<br>\n"; }
//if (empty($gateway_3)) { $msg .= "Please provide: Alternat 2<br>\n"; }
if (empty($dialplan_expression)) { $msg .= $text['message-provide'].": ".$text['label-dialplan-expression']."<br>\n"; }
//if (empty($dialplan_name)) { $msg .= "Please provide: Extension Name<br>\n"; }
//if (empty($condition_field_1)) { $msg .= "Please provide: Condition Field<br>\n"; }
//if (empty($condition_expression_1)) { $msg .= "Please provide: Condition Expression<br>\n"; }
//if (empty($limit)) { $msg .= "Please provide: Limit<br>\n"; }
//if (empty($dialplan_enabled)) { $msg .= "Please provide: Enabled True or False<br>\n"; }
//if (empty($description)) { $msg .= "Please provide: 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";
@@ -210,13 +210,13 @@
}
//prepare to build the array
if (strlen(trim($_POST['dialplan_expression'])) > 0) {
if (!empty(trim($_POST['dialplan_expression']))) {
$tmp_array = explode("\n", $_POST['dialplan_expression']);
$x = 0;
foreach($tmp_array as $dialplan_expression) {
$dialplan_expression = trim($dialplan_expression);
if (strlen($dialplan_expression) > 0) {
if (!empty($dialplan_expression)) {
switch ($dialplan_expression) {
case "^(\d{7})$":
$label = $text['label-7d'];
@@ -325,7 +325,7 @@
$bridge_data = "sofia/gateway/".$gateway_uuid."/".$prefix_number."\$1";
}
}
if (strlen($gateway_2_name) > 0 && $gateway_2_type == "gateway") {
if (!empty($gateway_2_name) && $gateway_2_type == "gateway") {
$extension_2_name = $gateway_2_id.".".$abbrv;
if ($abbrv == "988") {
$bridge_2_data = "sofia/gateway/".$gateway_2_id."/".$prefix_number."18002738255";
@@ -333,7 +333,7 @@
$bridge_2_data = "sofia/gateway/".$gateway_2_id."/".$prefix_number."\$1";
}
}
if (strlen($gateway_3_name) > 0 && $gateway_3_type == "gateway") {
if (!empty($gateway_3_name) && $gateway_3_type == "gateway") {
$extension_3_name = $gateway_3_id.".".$abbrv;
if ($abbrv == "988") {
$bridge_3_data = "sofia/gateway/".$gateway_3_id."/".$prefix_number."18002738255";
@@ -383,7 +383,7 @@
}
if ($gateway_type == "enum") {
if (strlen($bridge_2_data) == 0) {
if (empty($bridge_2_data)) {
$dialplan_name = "enum.".$abbrv;
}
else {
@@ -412,7 +412,7 @@
$bridge_3_data = $gateway_array[1];
}
if (strlen($dialplan_order) == 0) {
if (empty($dialplan_order)) {
$dialplan_order ='333';
}
$dialplan_context = $_SESSION['domain_name'];
@@ -502,7 +502,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
$y++;
if (strlen($toll_allow) > 0) {
if (!empty($toll_allow)) {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_uuid'] = $dialplan_uuid;
@@ -526,7 +526,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
if ($gateway_type != "transfer") {
if (strlen($accountcode) > 0) {
if (!empty($accountcode)) {
$y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
@@ -690,7 +690,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
}
if (strlen($limit) > 0) {
if (!empty($limit)) {
$y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
@@ -703,7 +703,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
}
if (strlen($outbound_prefix) > 0) {
if (!empty($outbound_prefix)) {
$y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
@@ -765,7 +765,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0';
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
if (strlen($bridge_2_data) > 0) {
if (!empty($bridge_2_data)) {
$y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
@@ -778,7 +778,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
}
if (strlen($bridge_3_data) > 0) {
if (!empty($bridge_3_data)) {
$y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
@@ -996,7 +996,7 @@ function type_onchange(dialplan_detail_type) {
break;
}
}
if (strlen($domain_name) == 0) { $domain_name = $text['label-global']; }
if (empty($domain_name)) { $domain_name = $text['label-global']; }
echo "</optgroup>";
echo "<optgroup label='&nbsp; &nbsp;".$domain_name."'>\n";
}
@@ -1056,7 +1056,7 @@ function type_onchange(dialplan_detail_type) {
break;
}
}
if (strlen($domain_name) == 0) { $domain_name = $text['label-global']; }
if (empty($domain_name)) { $domain_name = $text['label-global']; }
echo " </optgroup>\n";
echo " <optgroup label='&nbsp; &nbsp;".$domain_name."'>\n";
}
@@ -1116,7 +1116,7 @@ function type_onchange(dialplan_detail_type) {
break;
}
}
if (strlen($domain_name) == 0) { $domain_name = $text['label-global']; }
if (empty($domain_name)) { $domain_name = $text['label-global']; }
echo " </optgroup>\n";
echo " <optgroup label='&nbsp; &nbsp;".$domain_name."'>\n";
}