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
+40 -40
View File
@@ -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 {
+27 -27
View File
@@ -68,11 +68,11 @@
$destination_record = $_POST["destination_record"];
//set the defaults
if (strlen($destination_type) == 0) { $destination_type = 'inbound'; }
if (strlen($destination_context) == 0) { $destination_context = 'public'; }
if (empty($destination_type)) { $destination_type = 'inbound'; }
if (empty($destination_context)) { $destination_context = 'public'; }
if ($destination_type =="outbound" && $destination_context == "public") { $destination_context = $_SESSION['domain_name']; }
if ($destination_type =="outbound" && strlen($destination_context) == 0) { $destination_context = $_SESSION['domain_name']; }
if (strlen($from_row) == 0) { $from_row = '2'; }
if ($destination_type =="outbound" && empty($destination_context)) { $destination_context = $_SESSION['domain_name']; }
if (empty($from_row)) { $from_row = '2'; }
//save the data to the csv file
if (isset($_POST['data'])) {
@@ -96,7 +96,7 @@
}
//get the schema
if (strlen($delimiter) > 0) {
if (!empty($delimiter)) {
//get the first line
$line = fgets(fopen($_SESSION['file'], 'r'));
$line_fields = explode($delimiter, $line);
@@ -148,7 +148,7 @@
}
//upload the destination csv
if (file_exists($_SESSION['file']) && $action == 'add') {
if (file_exists($_SESSION['file'] ?? '') && $action == 'add') {
//validate the token
$token = new token;
@@ -199,8 +199,8 @@
}
//build the data array
if (strlen($table_name) > 0) {
if (strlen($parent) == 0) {
if (!empty($table_name)) {
if (empty($parent)) {
$array[$table_name][$row_id]['domain_uuid'] = $domain_uuid;
$array[$table_name][$row_id][$field_name] = $result[$key];
}
@@ -235,7 +235,7 @@
$destination_description = $row['destination_description'];
//convert the number to a regular expression
if (isset($destination_prefix) && strlen($destination_prefix) > 0) {
if (isset($destination_prefix) && !empty($destination_prefix)) {
$destination_number_regex = string_to_regex($destination_number, $destination_prefix);
}
else {
@@ -269,7 +269,7 @@
$dialplan_detail_order = $dialplan_detail_order + 10;
//set the dialplan detail type
if (strlen($_SESSION['dialplan']['destination']['text']) > 0) {
if (!empty($_SESSION['dialplan']['destination']['text'])) {
$dialplan_detail_type = $_SESSION['dialplan']['destination']['text'];
}
else {
@@ -294,10 +294,10 @@
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"export\" data=\"call_direction=inbound\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"domain_uuid=".$_SESSION['domain_uuid']."\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"domain_name=".$_SESSION['domain_name']."\" inline=\"true\"/>\n";
if (strlen($destination_cid_name_prefix) > 0) {
if (!empty($destination_cid_name_prefix)) {
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"effective_caller_id_name=".xml::sanitize($destination_cid_name_prefix)."#\${caller_id_name}\" inline=\"true\"/>\n";
}
if (strlen($destination_record) > 0) {
if (!empty($destination_record)) {
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"record_path=\${recordings_dir}/\${domain_name}/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"record_name=\${uuid}.\${record_ext}\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"record_append=true\" inline=\"true\"/>\n";
@@ -305,13 +305,13 @@
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"recording_follow_transfer=true\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"record_session\" data=\"\${record_path}/\${record_name}\" inline=\"false\"/>\n";
}
if (strlen($destination_accountcode) > 0) {
if (!empty($destination_accountcode)) {
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"accountcode=".xml::sanitize($destination_accountcode)."\" inline=\"true\"/>\n";
}
if (strlen($destination_carrier) > 0) {
if (!empty($destination_carrier)) {
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"carrier=".xml::sanitize($destination_carrier)."\" inline=\"true\"/>\n";
}
if (strlen($fax_uuid) > 0) {
if (!empty($fax_uuid)) {
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"tone_detect_hits=1\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"execute_on_tone_detect=transfer ".xml::sanitize($fax_extension)." XML \${domain_name}\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"tone_detect\" data=\"fax 1100 r +5000\"/>\n";
@@ -327,7 +327,7 @@
//check the destination number
$array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
if (strlen($_SESSION['dialplan']['destination']['text']) > 0) {
if (!empty($_SESSION['dialplan']['destination']['text'])) {
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text'];
}
else {
@@ -341,7 +341,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)) {
$array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = "set";
@@ -414,7 +414,7 @@
}
//set the call accountcode
if (strlen($destination_accountcode) > 0) {
if (!empty($destination_accountcode)) {
$array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = "set";
@@ -427,7 +427,7 @@
}
//set the destination app and data
if (strlen($destination_app) > 0 && strlen($destination_data) > 0) {
if (strlen($destination_app) > 0 && !empty($destination_data)) {
$array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = $destination_app;
@@ -491,7 +491,7 @@
}
//upload the destination csv
if (file_exists($_SESSION['file']) && $action == 'delete') {
if (file_exists($_SESSION['file'] ?? '') && $action == 'delete') {
//validate the token
$token = new token;
@@ -543,8 +543,8 @@
}
//build the data array
if (strlen($table_name) > 0) {
if (strlen($parent) == 0) {
if (!empty($table_name)) {
if (empty($parent)) {
$array[$table_name][$row_id]['domain_uuid'] = $domain_uuid;
$array[$table_name][$row_id][$field_name] = $result[$key];
}
@@ -567,7 +567,7 @@
$destination_number = $row['destination_number'];
//get the dialplan uuid
if (strlen($row['destination_number']) == 0 || !is_uuid($row['dialplan_uuid'])) {
if (empty($row['destination_number']) || !is_uuid($row['dialplan_uuid'])) {
$sql = "select * from v_destinations ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and destination_number = :destination_number; ";
@@ -581,7 +581,7 @@
//add to the array
//$array['destinations'][$row_id] = $destinations[0];
$array['destinations'][$row_id]['destination_uuid'] = $destinations[0]['destination_uuid'];
if (strlen($row['dialplan_uuid']) > 0) {
if (!empty($row['dialplan_uuid'])) {
$array['destinations'][$row_id]['dialplan_uuid'] = $destinations[0]['dialplan_uuid'];
//$array['dialplans'][$row_id]['dialplan_uuid'] = $destinations[0]['dialplan_uuid'];
}
@@ -678,7 +678,7 @@
}
//match the column names to the field names
if (strlen($delimiter) > 0 && file_exists($_SESSION['file']) && ($action !== 'add' or $action !== 'delete')) {
if (!empty($delimiter) && file_exists($_SESSION['file']) && ($action !== 'add' or $action !== 'delete')) {
//create token
$object = new token;
@@ -705,7 +705,7 @@
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
if (isset($_SESSION['file_name']) && strlen($_SESSION['file_name']) > 0) {
if (isset($_SESSION['file_name']) && !empty($_SESSION['file_name'])) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-file_name']."\n";
@@ -825,7 +825,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 {
+5 -5
View File
@@ -112,7 +112,7 @@
$order = $_GET["order"];
//add the search term
$search = strtolower($_GET["search"]);
$search = strtolower($_GET["search"] ?? '');
//prepare to page the results
$sql = "select count(*) from v_destinations ";
@@ -121,7 +121,7 @@
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid;
}
if (strlen($search) > 0) {
if (!empty($search)) {
$sql .= "and (";
$sql .= "lower(destination_type) like :search ";
$sql .= "or lower(destination_number) like :search ";
@@ -149,7 +149,7 @@
$param .= "&show=all";
}
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page;
@@ -161,7 +161,7 @@
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid;
}
if (strlen($search) > 0) {
if (!empty($search)) {
$sql .= "and (";
$sql .= "lower(destination_type) like :search ";
$sql .= "or lower(destination_number) like :search ";
@@ -306,7 +306,7 @@
echo " </td>\n";
}
if ($_GET['show'] == "all" && permission_exists('destination_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) {
if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
}
else {
@@ -103,7 +103,7 @@ if (!class_exists('destinations')) {
}
//add prefix
if (strlen($destination_prefix) > 0) {
if (!empty($destination_prefix)) {
$destination_prefix = str_replace("+", "", $destination_prefix);
$plus = '\+?';
if (strlen($destination_prefix) == 1) {
@@ -345,7 +345,7 @@ if (!class_exists('destinations')) {
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
}
if (is_array($row['result']['data']) && count($row['result']['data']) > 0 and strlen($row['select_value'][$destination_type]) > 0) {
if (is_array($row['result']['data']) && count($row['result']['data']) > 0 and !empty($row['select_value'][$destination_type])) {
$response .= " <optgroup label='".$text2['title-'.$label]."'>\n";
$label2 = $label;
foreach ($row['result']['data'] as $data) {
@@ -363,9 +363,9 @@ if (!class_exists('destinations')) {
if (strpos($value,',') !== false) {
$keys = explode(",", $value);
foreach ($keys as $k) {
if (strlen($data[$k]) > 0) {
if (!empty($data[$k])) {
$select_value = str_replace("\${".$key."}", $data[$k], $select_value);
if (strlen($data['label']) == 0) {
if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$k], $select_label);
}
else {
@@ -376,9 +376,9 @@ if (!class_exists('destinations')) {
}
}
else {
$select_value = str_replace("\${".$key."}", $data[$key], $select_value);
if (strlen($data['label']) == 0) {
$select_label = str_replace("\${".$key."}", $data[$key], $select_label);
$select_value = str_replace("\${".$key."}", $data[$key] ?? '', $select_value ?? '');
if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$key] ?? '', $select_label ?? '');
}
else {
$label = $data['label'];
@@ -386,7 +386,7 @@ if (!class_exists('destinations')) {
}
}
//application: hangup
if (strlen($data['application']) > 0) {
if (!empty($data['application'])) {
$select_value = str_replace("transfer", $data['application'], $select_value);
}
}
@@ -408,7 +408,7 @@ if (!class_exists('destinations')) {
}
}
if (!$select_found) {
$destination_label = str_replace(":", " ", $destination_value);
$destination_label = str_replace(":", " ", $destination_value ?? '');
$destination_label = str_replace("menu-exec-app", "", $destination_label);
$destination_label = str_replace("transfer", "", $destination_label);
$destination_label = str_replace("XML ".$this->domain_name, "", $destination_label);
@@ -661,7 +661,7 @@ if (!class_exists('destinations')) {
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
}
if (is_array($row['result']['data']) && strlen($row['select_value'][$destination_type]) > 0) {
if (is_array($row['result']['data']) && !empty($row['select_value'][$destination_type])) {
$label2 = $label;
foreach ($row['result']['data'] as $data) {
$select_value = $row['select_value'][$destination_type];
@@ -678,9 +678,9 @@ if (!class_exists('destinations')) {
if (strpos($value,',') !== false) {
$keys = explode(",", $value);
foreach ($keys as $k) {
if (strlen($data[$k]) > 0) {
if (!empty($data[$k])) {
$select_value = str_replace("\${".$key."}", $data[$k], $select_value);
if (strlen($data['label']) == 0) {
if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$k], $select_label);
}
else {
@@ -691,9 +691,9 @@ if (!class_exists('destinations')) {
}
}
else {
$select_value = str_replace("\${".$key."}", $data[$key], $select_value);
if (strlen($data['label']) == 0) {
$select_label = str_replace("\${".$key."}", $data[$key], $select_label);
$select_value = str_replace("\${".$key."}", $data[$key] ?? '', $select_value);
if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$key] ?? '', $select_label);
}
else {
$label = $data['label'];
@@ -701,7 +701,7 @@ if (!class_exists('destinations')) {
}
}
//application: hangup
if (strlen($data['application']) > 0) {
if (!empty($data['application'])) {
$select_value = str_replace("transfer", $data['application'], $select_value);
}
}
@@ -722,8 +722,9 @@ if (!class_exists('destinations')) {
}
}
if (!$select_found) {
$destination_label = str_replace(":", " ", $destination_value);
$destination_label = str_replace("menu-exec-app", "", $destination_label);
if(!empty($destination_value))
$destination_label = str_replace(":", " ", $destination_value);
$destination_label = str_replace("menu-exec-app", "", $destination_label ?? '');
$destination_label = str_replace("transfer", "", $destination_label);
$destination_label = str_replace("XML ".$this->domain_name, "", $destination_label);
$array[$label][$destination_label] = $destination_value;
@@ -874,7 +875,7 @@ if (!class_exists('destinations')) {
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
}
if (is_array($row['result']['data']) && strlen($row['select_value'][$destination_type]) > 0) {
if (is_array($row['result']['data']) && !empty($row['select_value'][$destination_type])) {
$label2 = $label;
foreach ($row['result']['data'] as $data) {
$select_value = $row['select_value'][$destination_type];
@@ -892,9 +893,9 @@ if (!class_exists('destinations')) {
if (strpos($value,',') !== false) {
$keys = explode(",", $value);
foreach ($keys as $k) {
if (strlen($data[$k]) > 0) {
if (!empty($data[$k])) {
$select_value = str_replace("\${".$key."}", $data[$k], $select_value);
if (strlen($data['label']) == 0) {
if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$k], $select_label);
}
else {
@@ -906,7 +907,7 @@ if (!class_exists('destinations')) {
}
else {
$select_value = str_replace("\${".$key."}", $data[$key], $select_value);
if (strlen($data['label']) == 0) {
if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$key], $select_label);
}
else {
@@ -915,7 +916,7 @@ if (!class_exists('destinations')) {
}
}
//application: hangup
if (strlen($data['application']) > 0) {
if (!empty($data['application'])) {
$select_value = str_replace("transfer", $data['application'], $select_value);
}
}