Fixed more php 8.1 errors (#6754)

* Update default_setting_edit.php

* Update default_settings_reload.php

* Update modules.php

* Update access_controls_reload.php

* Update call_recordings.php

* Update fax.php

* Update extension_edit.php

* Update extension_imports.php

* Update destination_imports.php

* Update dialplan_outbound_add.php

* Update dialplan_inbound_add.php

* Update voicemail_imports.php

* Update contact_import.php
This commit is contained in:
Alex 2023-06-12 17:06:56 -06:00 committed by GitHub
parent 5d9c8ad770
commit 25b24d68bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 33 additions and 31 deletions

View File

@ -42,7 +42,7 @@ else {
}
//set the variables
$search = $_REQUEST['search'];
$search = $_REQUEST['search'] ?? '';
//create event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
@ -63,4 +63,4 @@ else {
header("Location: ".$location);
?>
?>

View File

@ -165,6 +165,7 @@ if (!class_exists('call_recordings')) {
//download the file
if ($full_recording_path != '/' && file_exists($full_recording_path)) {
ob_clean();
$fd = fopen($full_recording_path, "rb");
if ($this->binary) {
header("Content-Type: application/force-download");
@ -187,12 +188,13 @@ if (!class_exists('call_recordings')) {
header("Content-Length: ".filesize($full_recording_path));
}
ob_clean();
fpassthru($fd);
//content-range
if (isset($_SERVER['HTTP_RANGE']) && !$this->binary) {
$this->range_download($full_recording_path);
}
fpassthru($fd);
}
//if base64, remove temp recording file

View File

@ -279,7 +279,7 @@
//user selected fields, labels
$fields = $_POST['fields'];
$labels = $_POST['labels'];
$labels = $_POST['labels'] ?? [];
//set the domain_uuid
$domain_uuid = $_SESSION['domain_uuid'];

View File

@ -501,7 +501,7 @@
fclose($handle);
//save to the data
if (is_array($array)) {
if (!empty($array) && is_array($array)) {
$database = new database;
$database->app_name = 'destinations';
$database->app_uuid = '5ec89622-b19c-3559-64f0-afde802ab139';
@ -1027,4 +1027,4 @@
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@ -765,7 +765,7 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='public_order' class='formfld'>\n";
if (strlen(htmlspecialchars($public_order))> 0) {
if (!empty($public_order) && strlen(htmlspecialchars($public_order))> 0) {
echo " <option selected='yes' value='".htmlspecialchars($public_order)."'>".htmlspecialchars($public_order)."</option>\n";
}
$i = 100;
@ -787,13 +787,13 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='dialplan_enabled'>\n";
if ($dialplan_enabled == "true") {
if (!empty($dialplan_enabled) && $dialplan_enabled == "true") {
echo " <option value='true' SELECTED >".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($dialplan_enabled == "false") {
if (!empty($dialplan_enabled) && $dialplan_enabled == "false") {
echo " <option value='false' SELECTED >".$text['label-false']."</option>\n";
}
else {

View File

@ -1007,7 +1007,7 @@ function type_onchange(dialplan_detail_type) {
echo "</optgroup>";
echo "<optgroup label='&nbsp; &nbsp;".$domain_name."'>\n";
}
if ($row['gateway'] == $gateway_name) {
if (!empty($gateway_name) && $row['gateway'] == $gateway_name) {
echo "<option value=\"".escape($row['gateway_uuid']).":".escape($row['gateway'])."\" selected=\"selected\">".escape($row['gateway'])."</option>\n";
}
else {
@ -1015,7 +1015,7 @@ function type_onchange(dialplan_detail_type) {
}
}
else {
if ($row['gateway'] == $gateway_name) {
if (!empty($gateway_name) && $row['gateway'] == $gateway_name) {
echo "<option value=\"".escape($row['gateway_uuid']).":".escape($row['gateway'])."\" $onchange selected=\"selected\">".escape($row['gateway'])."</option>\n";
}
else {
@ -1067,7 +1067,7 @@ function type_onchange(dialplan_detail_type) {
echo " </optgroup>\n";
echo " <optgroup label='&nbsp; &nbsp;".$domain_name."'>\n";
}
if ($row['gateway'] == $gateway_2_name) {
if (!empty($gateway_2_name) && $row['gateway'] == $gateway_2_name) {
echo " <option value=\"".escape($row['gateway_uuid']).":".escape($row['gateway'])."\" selected=\"selected\">".escape($row['gateway'])."</option>\n";
}
else {
@ -1075,7 +1075,7 @@ function type_onchange(dialplan_detail_type) {
}
}
else {
if ($row['gateway'] == $gateway_2_name) {
if (!empty($gateway_2_name) && $row['gateway'] == $gateway_2_name) {
echo " <option value=\"".escape($row['gateway_uuid']).":".escape($row['gateway'])."\" selected=\"selected\">".escape($row['gateway'])."</option>\n";
}
else {
@ -1127,7 +1127,7 @@ function type_onchange(dialplan_detail_type) {
echo " </optgroup>\n";
echo " <optgroup label='&nbsp; &nbsp;".$domain_name."'>\n";
}
if ($row['gateway'] == $gateway_3_name) {
if (!empty($gateway_3_name) && $row['gateway'] == $gateway_3_name) {
echo " <option value=\"".escape($row['gateway_uuid']).":".escape($row['gateway'])."\" selected=\"selected\">".escape($row['gateway'])."</option>\n";
}
else {
@ -1135,7 +1135,7 @@ function type_onchange(dialplan_detail_type) {
}
}
else {
if ($row['gateway'] == $gateway_3_name) {
if (!empty($gateway_3_name) && $row['gateway'] == $gateway_3_name) {
echo " <option value=\"".escape($row['gateway_uuid']).":".escape($row['gateway'])."\" selected=\"selected\">".escape($row['gateway'])."</option>\n";
}
else {
@ -1176,7 +1176,7 @@ function type_onchange(dialplan_detail_type) {
echo " <div id=\"enter_custom_outbound_prefix_box\" style=\"display:none\">\n";
echo " <input class='formfld' style='width: 10%;' type='text' name='custom-outbound-prefix' id=\"outbound_prefix\" maxlength='255'>\n";
echo " <input type='button' class='btn' name='' onclick=\"update_outbound_prefix()\" value='".$text['button-add']."'>\n";
echo " <br />".$text['description-enter-custom-outbound-prefix'].".\n";
//echo " <br />".$text['description-enter-custom-outbound-prefix'].".\n";
echo " </div>\n";
echo " <select name='dialplan_expression_select' id='dialplan_expression_select' onchange=\"update_dialplan_expression()\" class='formfld'>\n";
@ -1289,7 +1289,7 @@ function type_onchange(dialplan_detail_type) {
echo "<td class='vtable' align='left'>\n";
echo " <select name='dialplan_order' class='formfld'>\n";
//echo " <option></option>\n";
if (strlen(htmlspecialchars($dialplan_order))> 0) {
if (!empty($dialplan_order) && strlen(htmlspecialchars($dialplan_order))> 0) {
echo " <option selected='yes' value='".escape($dialplan_order)."'>".escape($dialplan_order)."</option>\n";
}
$i = 100;
@ -1312,13 +1312,13 @@ function type_onchange(dialplan_detail_type) {
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='dialplan_enabled'>\n";
//echo " <option value=''></option>\n";
if ($dialplan_enabled == "true") {
if (!empty($dialplan_enabled) && $dialplan_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($dialplan_enabled == "false") {
if (!empty($dialplan_enabled) && $dialplan_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {

View File

@ -50,7 +50,7 @@
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$action = "update";
$extension_uuid = $_REQUEST["id"];
$page = $_REQUEST['page'] ?? '';
$page = $_REQUEST['page'];
}
else {
$action = "add";
@ -69,7 +69,7 @@
if ($total_extensions >= $_SESSION['limit']['extensions']['numeric']) {
message::add($text['message-maximum_extensions'].' '.$_SESSION['limit']['extensions']['numeric'], 'negative');
header('Location: extensions.php'.(is_numeric($page) ? '?page='.$page : null));
header('Location: extensions.php'.(isset($page) && is_numeric($page) ? '?page='.$page : null));
exit;
}
}
@ -323,7 +323,7 @@
}
//prevent users from bypassing extension limit by using range
if ($_SESSION['limit']['extensions']['numeric'] != '') {
if (!empty($_SESSION['limit']['extensions']['numeric'])) {
if (isset($total_extensions) && ($total_extensions ?? 0) + $range > $_SESSION['limit']['extensions']['numeric']) {
$range = $_SESSION['limit']['extensions']['numeric'] - $total_extensions;
}
@ -812,7 +812,7 @@
header("Location: extensions.php");
}
else {
header("Location: extension_edit.php?id=".$extension_uuid.(is_numeric($page) ? '&page='.$page : null));
header("Location: extension_edit.php?id=".$extension_uuid.(isset($page) && is_numeric($page) ? '&page='.$page : null));
}
exit;
}

View File

@ -345,7 +345,7 @@
fclose($handle);
//save to the data
if (is_array($array)) {
if (!empty($array) && is_array($array)) {
$database = new database;
$database->app_name = 'extensions';
$database->app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';

View File

@ -129,7 +129,7 @@
$parameters['user_uuid'] = $_SESSION['user_uuid'];
}
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
$num_rows = $database->select($sql, $parameters ?? null, 'column');
//prepare paging
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
@ -192,7 +192,7 @@
$sql .= order_by($order_by, $order, 'f.fax_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$result = $database->select($sql, $parameters, 'all');
$result = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//create token
@ -349,4 +349,4 @@
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@ -867,7 +867,7 @@ if (!class_exists('modules')) {
}
//get module details
if (is_array($uuids) && @sizeof($uuids) != 0) {
if (!empty($uuids) && is_array($uuids) && @sizeof($uuids) != 0) {
$sql = "select ".$this->uuid_prefix."uuid as uuid, module_name as module, module_enabled as enabled from v_".$this->table." ";
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
$database = new database;

View File

@ -321,7 +321,7 @@
fclose($handle);
//save to the data
if (is_array($array)) {
if (!empty($array) && is_array($array)) {
$database = new database;
$database->app_name = 'voicemails';
$database->app_uuid = 'b523c2d2-64cd-46f1-9520-ca4b4098e044';

View File

@ -241,7 +241,7 @@
//pre-populate the form
if (count($_GET) > 0 && empty($_POST["persistformvar"])) {
$default_setting_uuid = $_GET["id"];
$default_setting_uuid = $_GET["id"] ?? '';
$sql = "select default_setting_uuid, default_setting_category, default_setting_subcategory, default_setting_name, default_setting_value, default_setting_order, cast(default_setting_enabled as text), default_setting_description ";
$sql .= "from v_default_settings ";
$sql .= "where default_setting_uuid = :default_setting_uuid ";

View File

@ -46,7 +46,7 @@ $language = new text;
$text = $language->get();
//set the variables
$search = $_REQUEST['search'] ?? null;
$search = $_REQUEST['search'] ?? '';
$domain_uuid = $_GET['id'] ?? null;
//reload default settings