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
+1 -1
View File
@@ -105,7 +105,7 @@
$array['fax'][0]['fax_pin_number'] = $fax_pin_number;
$array['fax'][0]['fax_caller_id_name'] = $fax_caller_id_name;
$array['fax'][0]['fax_caller_id_number'] = $fax_caller_id_number;
if (strlen($fax_forward_number) > 0) {
if (!empty($fax_forward_number)) {
$array['fax'][0]['fax_forward_number'] = $fax_forward_number;
}
$array['fax'][0]['fax_description'] = $fax_description;
+10 -10
View File
@@ -138,7 +138,7 @@
$fax_caller_id_number = $_POST["fax_caller_id_number"];
$fax_toll_allow = $_POST["fax_toll_allow"];
$fax_forward_number = $_POST["fax_forward_number"];
if (strlen($fax_destination_number) == 0) {
if (empty($fax_destination_number)) {
$fax_destination_number = $fax_extension;
}
if (strlen($fax_forward_number) > 3) {
@@ -227,7 +227,7 @@
clearstatcache();
//process the data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
$msg = '';
if ($action == "update" && is_uuid($_POST["fax_uuid"]) && permission_exists('fax_extension_edit')) {
@@ -243,9 +243,9 @@
}
//check for all required data
if (strlen($fax_extension) == 0) { $msg .= "".$text['confirm-ext']."<br>\n"; }
if (strlen($fax_name) == 0) { $msg .= "".$text['confirm-fax']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (empty($fax_extension)) { $msg .= "".$text['confirm-ext']."<br>\n"; }
if (empty($fax_name)) { $msg .= "".$text['confirm-fax']."<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";
@@ -343,11 +343,11 @@
$array['fax'][0]['fax_caller_id_name'] = $fax_caller_id_name;
$array['fax'][0]['fax_caller_id_number'] = $fax_caller_id_number;
$array['fax'][0]['fax_toll_allow'] = $fax_toll_allow;
if ($action == "add" && strlen($fax_forward_number) > 0) {
if ($action == "add" && !empty($fax_forward_number)) {
$array['fax'][0]['fax_forward_number'] = $fax_forward_number;
}
if ($action == "update") {
$array['fax'][0]['fax_forward_number'] = strlen($fax_forward_number) > 0 ? $fax_forward_number : null;
$array['fax'][0]['fax_forward_number'] = !empty($fax_forward_number) ? $fax_forward_number : null;
}
if (permission_exists('fax_send_greeting')) {
$array['fax'][0]['fax_send_greeting'] = strlen($fax_send_greeting) != 0 ? $fax_send_greeting : null;
@@ -775,7 +775,7 @@
while ($file = readdir($dh)) {
if ($file != "." && $file != ".." && $file[0] != '.') {
if (!is_dir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file)) {
$selected = ($fax_send_greeting == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file && strlen($fax_send_greeting) > 0) ? true : false;
$selected = ($fax_send_greeting == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file && !empty($fax_send_greeting)) ? true : false;
echo " <option value='".escape($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file)."' ".(($selected) ? "selected='selected'" : null).">".escape($file)."</option>\n";
if ($selected) { $tmp_selected = true; }
}
@@ -805,7 +805,7 @@
if (is_array($sound_files)) {
echo "<optgroup label='Sounds'>\n";
foreach ($sound_files as $value) {
if (strlen($value) > 0) {
if (!empty($value)) {
if (substr($fax_send_greeting, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") {
$fax_send_greeting = substr($fax_send_greeting, 71);
}
@@ -817,7 +817,7 @@
echo "</optgroup>\n";
}
//select
if (strlen($fax_send_greeting) > 0) {
if (!empty($fax_send_greeting)) {
if (permission_exists('conference_center_add') || permission_exists('conference_center_edit')) {
if (!$tmp_selected) {
echo "<optgroup label='selected'>\n";
+3 -3
View File
@@ -105,7 +105,7 @@ if (is_array($result) && @sizeof($result) != 0) {
load_domain_settings($domain_uuid);
$fax_cover_font = $_SESSION['fax']['cover_font']['text'];
if(strlen($fax_cover_font) == 0){
if(empty($fax_cover_font)){
$fax_cover_font = $fax_cover_font_default;
}
@@ -312,7 +312,7 @@ function load_default_settings() {
$name = $row['default_setting_name'];
$category = $row['default_setting_category'];
$subcategory = $row['default_setting_subcategory'];
if (strlen($subcategory) == 0) {
if (empty($subcategory)) {
if ($name == "array") {
$settings[$category][] = $row['default_setting_value'];
}
@@ -359,7 +359,7 @@ function load_domain_settings($domain_uuid) {
$name = $row['domain_setting_name'];
$category = $row['domain_setting_category'];
$subcategory = $row['domain_setting_subcategory'];
if (strlen($subcategory) == 0) {
if (empty($subcategory)) {
//$$category[$name] = $row['domain_setting_value'];
if ($name == "array") {
$_SESSION[$category][] = $row['domain_setting_value'];
+3 -3
View File
@@ -136,7 +136,7 @@
}
//add the headers and stream the file
if (strlen($download_filename) > 0) {
if (!empty($download_filename)) {
$fd = fopen($download_filename, "rb");
if ($_GET['t'] == "bin") {
header("Content-Type: application/force-download");
@@ -172,7 +172,7 @@
}
//get the fax extension
if (strlen($fax_extension) > 0) {
if (!empty($fax_extension)) {
//set the fax directories. example /usr/local/freeswitch/storage/fax/329/inbox
$dir_fax_inbox = $fax_dir.'/'.$fax_extension.'/inbox';
$dir_fax_sent = $fax_dir.'/'.$fax_extension.'/sent';
@@ -339,7 +339,7 @@
$file_ext = $row['fax_file_type'];
//decode the base64
if (strlen($row['fax_base64']) > 0) {
if (!empty($row['fax_base64'])) {
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
if (!file_exists($dir_fax_inbox.'/'.$file)) {
file_put_contents($dir_fax_inbox.'/'.$file, base64_decode($row['fax_base64']));
+1 -1
View File
@@ -77,7 +77,7 @@
//add the search string
$search = strtolower($_GET["search"]);
if (strlen($search) > 0) {
if (!empty($search)) {
$sql_search = " and (";
$sql_search .= " lower(fax_result_text) like :search ";
$sql_search .= " or lower(fax_file) like :search ";
+2 -2
View File
@@ -369,7 +369,7 @@ else {
$pdf->setPrintFooter(false);
$pdf->SetMargins(0, 0, 0, true);
if (strlen($fax_cover_font) > 0) {
if (!empty($fax_cover_font)) {
if (substr($fax_cover_font, -4) == '.ttf') {
$pdf_font = TCPDF_FONTS::addTTFfont($fax_cover_font);
}
@@ -700,7 +700,7 @@ else {
fax_split_dtmf($fax_number, $fax_dtmf);
//prepare the fax command
if (strlen($fax_toll_allow) > 0) {
if (!empty($fax_toll_allow)) {
$channel_variables["toll_allow"] = $fax_toll_allow;
}
$route_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $fax_prefix . $fax_number, $channel_variables);
+2 -2
View File
@@ -87,7 +87,7 @@ if (!class_exists('fax')) {
}
//set the dialplan_uuid
if (strlen($this->dialplan_uuid) == 0) {
if (empty($this->dialplan_uuid)) {
$this->dialplan_uuid = uuid();
}
else {
@@ -114,7 +114,7 @@ if (!class_exists('fax')) {
$fax_name = ($this->fax_name != '') ? $this->fax_name : format_phone($this->destination_number);
//set the last fax
if (strlen($_SESSION['fax']['last_fax']['text']) > 0) {
if (!empty($_SESSION['fax']['last_fax']['text'])) {
$last_fax = "last_fax=".xml::sanitize($_SESSION['fax']['last_fax']['text']);
}
else {