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:
@@ -129,7 +129,7 @@
|
||||
if (is_array($destination_conditions)) {
|
||||
$i=0;
|
||||
foreach($destination_conditions as $row) {
|
||||
if (isset($row['condition_expression']) && strlen($row['condition_expression']) > 0) {
|
||||
if (isset($row['condition_expression']) && !empty($row['condition_expression'])) {
|
||||
if ($row['condition_field'] == 'caller_id_number') {
|
||||
$row['condition_expression'] = preg_replace('#[^\+0-9\*]#', '', $row['condition_expression']);
|
||||
$conditions[$i]['condition_field'] = $row['condition_field'];
|
||||
@@ -142,7 +142,7 @@
|
||||
}
|
||||
|
||||
//process the http post
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
|
||||
|
||||
//initialize the destinations object
|
||||
$destination = new destinations;
|
||||
@@ -151,10 +151,10 @@
|
||||
}
|
||||
|
||||
//set the default context
|
||||
if ($destination_type =="inbound" && strlen($destination_context) == 0) {
|
||||
if ($destination_type =="inbound" && empty($destination_context)) {
|
||||
$destination_context = 'public';
|
||||
}
|
||||
if ($destination_type =="outbound" && strlen($destination_context) == 0) {
|
||||
if ($destination_type =="outbound" && empty($destination_context)) {
|
||||
$destination_context = $_SESSION['domain_name'];
|
||||
}
|
||||
|
||||
@@ -183,11 +183,11 @@
|
||||
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
if (strlen($destination_type) == 0) { $msg .= $text['message-required']." ".$text['label-destination_type']."<br>\n"; }
|
||||
//if (strlen($destination_prefix) == 0 && permission_exists('destination_prefix')) { $msg .= $text['message-required']." ".$text['label-destination_country_code']."<br>\n"; }
|
||||
if (strlen($destination_number) == 0) { $msg .= $text['message-required']." ".$text['label-destination_number']."<br>\n"; }
|
||||
if (strlen($destination_context) == 0) { $msg .= $text['message-required']." ".$text['label-destination_context']."<br>\n"; }
|
||||
if (strlen($destination_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-destination_enabled']."<br>\n"; }
|
||||
if (empty($destination_type)) { $msg .= $text['message-required']." ".$text['label-destination_type']."<br>\n"; }
|
||||
//if (empty($destination_prefix) && permission_exists('destination_prefix')) { $msg .= $text['message-required']." ".$text['label-destination_country_code']."<br>\n"; }
|
||||
if (empty($destination_number)) { $msg .= $text['message-required']." ".$text['label-destination_number']."<br>\n"; }
|
||||
if (empty($destination_context)) { $msg .= $text['message-required']." ".$text['label-destination_context']."<br>\n"; }
|
||||
if (empty($destination_enabled)) { $msg .= $text['message-required']." ".$text['label-destination_enabled']."<br>\n"; }
|
||||
|
||||
//check for duplicates
|
||||
if ($destination_type == 'inbound' && $destination_number != $db_destination_number && $_SESSION['destinations']['unique']['boolean'] == 'true') {
|
||||
@@ -204,7 +204,7 @@
|
||||
}
|
||||
|
||||
//show the message
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
if (!empty($msg) && empty($_POST["persistformvar"])) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
@@ -345,7 +345,7 @@
|
||||
if (is_array($dialplan_details)) {
|
||||
foreach ($dialplan_details as $index => $row) {
|
||||
//unset the empty row
|
||||
if (strlen($row["dialplan_detail_data"]) == 0) {
|
||||
if (empty($row["dialplan_detail_data"])) {
|
||||
unset($dialplan_details[$index]);
|
||||
}
|
||||
}
|
||||
@@ -381,16 +381,16 @@
|
||||
foreach($destination_numbers as $destination_number) {
|
||||
|
||||
//convert the number to a regular expression
|
||||
if (isset($destination_prefix) && strlen($destination_prefix) > 0) {
|
||||
if (isset($destination_prefix) && !empty($destination_prefix)) {
|
||||
$destination_numbers['destination_prefix'] = $destination_prefix;
|
||||
}
|
||||
if (isset($destination_trunk_prefix) && strlen($destination_trunk_prefix) > 0) {
|
||||
if (isset($destination_trunk_prefix) && !empty($destination_trunk_prefix)) {
|
||||
$destination_numbers['destination_trunk_prefix'] = $destination_trunk_prefix;
|
||||
}
|
||||
if (isset($destination_area_code) && strlen($destination_area_code) > 0) {
|
||||
if (isset($destination_area_code) && !empty($destination_area_code)) {
|
||||
$destination_numbers['destination_area_code'] = $destination_area_code;
|
||||
}
|
||||
if (isset($destination_number) && strlen($destination_number) > 0) {
|
||||
if (isset($destination_number) && !empty($destination_number)) {
|
||||
$destination_numbers['destination_number'] = $destination_number;
|
||||
}
|
||||
$destination = new destinations;
|
||||
@@ -433,10 +433,10 @@
|
||||
$dialplan_detail_order = 10;
|
||||
|
||||
//set the dialplan detail type
|
||||
if (strlen($destination_condition_field) > 0) {
|
||||
if (!empty($destination_condition_field)) {
|
||||
$dialplan_detail_type = $destination_condition_field;
|
||||
}
|
||||
elseif (strlen($_SESSION['dialplan']['destination']['text']) > 0) {
|
||||
elseif (!empty($_SESSION['dialplan']['destination']['text'])) {
|
||||
$dialplan_detail_type = $_SESSION['dialplan']['destination']['text'];
|
||||
}
|
||||
else {
|
||||
@@ -471,7 +471,7 @@
|
||||
//add the dialplan xml destination conditions
|
||||
if (is_array($conditions)) {
|
||||
foreach($conditions as $row) {
|
||||
if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && strlen($destination_prefix) > 0) {
|
||||
if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && !empty($destination_prefix)) {
|
||||
$condition_expression = '\+?'.$destination_prefix.'?'.$row['condition_expression'];
|
||||
}
|
||||
else {
|
||||
@@ -492,10 +492,10 @@
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"continue_on_fail=true\" inline=\"true\"/>\n";
|
||||
}
|
||||
|
||||
if (strlen($destination_cid_name_prefix) > 0) {
|
||||
if (!empty($destination_cid_name_prefix)) {
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"effective_caller_id_name=".xml::sanitize($destination_cid_name_prefix)."#\${caller_id_name}\" inline=\"false\"/>\n";
|
||||
}
|
||||
if (strlen($destination_record) > 0 && $destination_record == 'true') {
|
||||
if (!empty($destination_record) && $destination_record == 'true') {
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_path=\${recordings_dir}/\${domain_name}/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_name=\${uuid}.\${record_ext}\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_append=true\" inline=\"true\"/>\n";
|
||||
@@ -503,19 +503,19 @@
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"recording_follow_transfer=true\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"record_session\" data=\"\${record_path}/\${record_name}\" inline=\"false\"/>\n";
|
||||
}
|
||||
if (strlen($destination_hold_music) > 0) {
|
||||
if (!empty($destination_hold_music)) {
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"hold_music=".xml::sanitize($destination_hold_music)."\" inline=\"true\"/>\n";
|
||||
}
|
||||
if (strlen($destination_distinctive_ring) > 0) {
|
||||
if (!empty($destination_distinctive_ring)) {
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"sip_h_Alert-Info=".xml::sanitize($destination_distinctive_ring)."\" inline=\"true\"/>\n";
|
||||
}
|
||||
if (strlen($destination_accountcode) > 0) {
|
||||
if (!empty($destination_accountcode)) {
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"accountcode=".xml::sanitize($destination_accountcode)."\" inline=\"true\"/>\n";
|
||||
}
|
||||
if (strlen($destination_carrier) > 0) {
|
||||
if (!empty($destination_carrier)) {
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"carrier=".xml::sanitize($destination_carrier)."\" inline=\"true\"/>\n";
|
||||
}
|
||||
if (strlen($fax_uuid) > 0) {
|
||||
if (!empty($fax_uuid)) {
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"tone_detect_hits=1\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"execute_on_tone_detect=transfer ".xml::sanitize($fax_extension)." XML \${domain_name}\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"tone_detect\" data=\"fax 1100 r +3000\"/>\n";
|
||||
@@ -547,7 +547,7 @@
|
||||
if (is_array($conditions)) {
|
||||
foreach($conditions as $row) {
|
||||
//prepare the expression
|
||||
if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && strlen($destination_prefix) > 0) {
|
||||
if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && !empty($destination_prefix)) {
|
||||
$condition_expression = '\+?'.$destination_prefix.'?'.$row['condition_expression'];
|
||||
}
|
||||
else {
|
||||
@@ -572,10 +572,10 @@
|
||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
|
||||
if (strlen($destination_condition_field) > 0) {
|
||||
if (!empty($destination_condition_field)) {
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $destination_condition_field;
|
||||
}
|
||||
elseif (strlen($_SESSION['dialplan']['destination']['text']) > 0) {
|
||||
elseif (!empty($_SESSION['dialplan']['destination']['text'])) {
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text'];
|
||||
}
|
||||
else {
|
||||
@@ -618,7 +618,7 @@
|
||||
$dialplan_detail_order = $dialplan_detail_order + 10;
|
||||
|
||||
//set the caller id name prefix
|
||||
if (strlen($destination_cid_name_prefix) > 0) {
|
||||
if (!empty($destination_cid_name_prefix)) {
|
||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
|
||||
@@ -633,7 +633,7 @@
|
||||
}
|
||||
|
||||
//set the call accountcode
|
||||
if (strlen($destination_accountcode) > 0) {
|
||||
if (!empty($destination_accountcode)) {
|
||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
|
||||
@@ -648,7 +648,7 @@
|
||||
}
|
||||
|
||||
//set the call carrier
|
||||
if (strlen($destination_carrier) > 0) {
|
||||
if (!empty($destination_carrier)) {
|
||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
|
||||
@@ -663,7 +663,7 @@
|
||||
}
|
||||
|
||||
//set the hold music
|
||||
if (strlen($destination_hold_music) > 0) {
|
||||
if (!empty($destination_hold_music)) {
|
||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
|
||||
@@ -675,7 +675,7 @@
|
||||
}
|
||||
|
||||
//set the distinctive ring
|
||||
if (strlen($destination_distinctive_ring) > 0) {
|
||||
if (!empty($destination_distinctive_ring)) {
|
||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
|
||||
@@ -1084,7 +1084,7 @@
|
||||
|
||||
//decode the json to an array
|
||||
$destination_conditions = json_decode($destination_conditions, true);
|
||||
$destination_actions = json_decode($destination_actions, true);
|
||||
$destination_actions = json_decode($destination_actions ?? '', true);
|
||||
|
||||
//prepare the conditions array, add an empty row
|
||||
if (is_array($destination_conditions)) {
|
||||
@@ -1131,7 +1131,7 @@
|
||||
if ($row['dialplan_detail_type'] == "tone_detect") {
|
||||
unset($dialplan_details[$x]);
|
||||
}
|
||||
if (substr($dialplan_detail_data,0,22) == "execute_on_tone_detect") {
|
||||
if (substr($dialplan_detail_data ?? '',0,22) == "execute_on_tone_detect") {
|
||||
unset($dialplan_details[$x]);
|
||||
}
|
||||
if ($row['dialplan_detail_type'] == "answer") {
|
||||
@@ -1148,10 +1148,10 @@
|
||||
}
|
||||
|
||||
//set the defaults
|
||||
if (strlen($destination_order) == 0) { $destination_order = '100'; }
|
||||
if (strlen($destination_type) == 0) { $destination_type = 'inbound'; }
|
||||
if (strlen($destination_context) == 0) { $destination_context = 'public'; }
|
||||
if (strlen($destination_enabled) == 0) { $destination_enabled = 'true'; }
|
||||
if (empty($destination_order)) { $destination_order = '100'; }
|
||||
if (empty($destination_type)) { $destination_type = 'inbound'; }
|
||||
if (empty($destination_context)) { $destination_context = 'public'; }
|
||||
if (empty($destination_enabled)) { $destination_enabled = 'true'; }
|
||||
if ($destination_type =="outbound") { $destination_context = $_SESSION['domain_name']; }
|
||||
if ($destination_type =="local") { $destination_context = $_SESSION['domain_name']; }
|
||||
|
||||
@@ -1703,7 +1703,7 @@
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='domain_uuid' id='destination_domain' onchange='context_control();'>\n";
|
||||
if (strlen($domain_uuid) == 0) {
|
||||
if (empty($domain_uuid)) {
|
||||
echo " <option value='' selected='selected'>".$text['select-global']."</option>\n";
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user