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 13:46:37 -03:00
committed by GitHub
parent ebbb2f1a72
commit fef8165be2
230 changed files with 1948 additions and 1937 deletions

View File

@@ -90,7 +90,7 @@
}
}
}
if (strlen($_REQUEST["mos_comparison"]) > 0) {
if (!empty($_REQUEST["mos_comparison"])) {
switch($_REQUEST["mos_comparison"]) {
case 'less': $mos_comparison = "<"; break;
case 'greater': $mos_comparison = ">"; break;
@@ -137,41 +137,41 @@
}
//set the param variable which is used with paging
$param = "&cdr_id=".urlencode($cdr_id);
$param .= "&missed=".urlencode($missed);
$param .= "&direction=".urlencode($direction);
$param .= "&caller_id_name=".urlencode($caller_id_name);
$param .= "&caller_id_number=".urlencode($caller_id_number);
$param .= "&caller_destination=".urlencode($caller_destination);
$param .= "&extension_uuid=".urlencode($extension_uuid);
$param .= "&destination_number=".urlencode($destination_number);
$param .= "&context=".urlencode($context);
$param .= "&start_stamp_begin=".urlencode($start_stamp_begin);
$param .= "&start_stamp_end=".urlencode($start_stamp_end);
$param .= "&answer_stamp_begin=".urlencode($answer_stamp_begin);
$param .= "&answer_stamp_end=".urlencode($answer_stamp_end);
$param .= "&end_stamp_begin=".urlencode($end_stamp_begin);
$param .= "&end_stamp_end=".urlencode($end_stamp_end);
$param .= "&start_epoch=".urlencode($start_epoch);
$param .= "&stop_epoch=".urlencode($stop_epoch);
$param .= "&duration_min=".urlencode($duration_min);
$param .= "&duration_max=".urlencode($duration_max);
$param .= "&billsec=".urlencode($billsec);
$param .= "&hangup_cause=".urlencode($hangup_cause);
$param .= "&call_result=".urlencode($call_result);
$param .= "&xml_cdr_uuid=".urlencode($xml_cdr_uuid);
$param .= "&bleg_uuid=".urlencode($bleg_uuid);
$param .= "&accountcode=".urlencode($accountcode);
$param .= "&read_codec=".urlencode($read_codec);
$param .= "&write_codec=".urlencode($write_codec);
$param .= "&remote_media_ip=".urlencode($remote_media_ip);
$param .= "&network_addr=".urlencode($network_addr);
$param .= "&bridge_uuid=".urlencode($bridge_uuid);
$param .= "&mos_comparison=".urlencode($mos_comparison);
$param .= "&mos_score=".urlencode($mos_score);
$param .= "&tta_min=".urlencode($tta_min);
$param .= "&tta_max=".urlencode($tta_max);
$param .= "&recording=".urlencode($recording);
$param = "&cdr_id=".urlencode($cdr_id ?? '');
$param .= "&missed=".urlencode($missed ?? '');
$param .= "&direction=".urlencode($direction ?? '');
$param .= "&caller_id_name=".urlencode($caller_id_name ?? '');
$param .= "&caller_id_number=".urlencode($caller_id_number ?? '');
$param .= "&caller_destination=".urlencode($caller_destination ?? '');
$param .= "&extension_uuid=".urlencode($extension_uuid ?? '');
$param .= "&destination_number=".urlencode($destination_number ?? '');
$param .= "&context=".urlencode($context ?? '');
$param .= "&start_stamp_begin=".urlencode($start_stamp_begin ?? '');
$param .= "&start_stamp_end=".urlencode($start_stamp_end ?? '');
$param .= "&answer_stamp_begin=".urlencode($answer_stamp_begin ?? '');
$param .= "&answer_stamp_end=".urlencode($answer_stamp_end ?? '');
$param .= "&end_stamp_begin=".urlencode($end_stamp_begin ?? '');
$param .= "&end_stamp_end=".urlencode($end_stamp_end ?? '');
$param .= "&start_epoch=".urlencode($start_epoch ?? '');
$param .= "&stop_epoch=".urlencode($stop_epoch ?? '');
$param .= "&duration_min=".urlencode($duration_min ?? '');
$param .= "&duration_max=".urlencode($duration_max ?? '');
$param .= "&billsec=".urlencode($billsec ?? '');
$param .= "&hangup_cause=".urlencode($hangup_cause ?? '');
$param .= "&call_result=".urlencode($call_result ?? '');
$param .= "&xml_cdr_uuid=".urlencode($xml_cdr_uuid ?? '');
$param .= "&bleg_uuid=".urlencode($bleg_uuid ?? '');
$param .= "&accountcode=".urlencode($accountcode ?? '');
$param .= "&read_codec=".urlencode($read_codec ?? '');
$param .= "&write_codec=".urlencode($write_codec ?? '');
$param .= "&remote_media_ip=".urlencode($remote_media_ip ?? '');
$param .= "&network_addr=".urlencode($network_addr ?? '');
$param .= "&bridge_uuid=".urlencode($bridge_uuid ?? '');
$param .= "&mos_comparison=".urlencode($mos_comparison ?? '');
$param .= "&mos_score=".urlencode($mos_score ?? '');
$param .= "&tta_min=".urlencode($tta_min ?? '');
$param .= "&tta_max=".urlencode($tta_max ?? '');
$param .= "&recording=".urlencode($recording ?? '');
if (is_array($_SESSION['cdr']['field'])) {
foreach ($_SESSION['cdr']['field'] as $field) {
$array = explode(",", $field);
@@ -189,8 +189,8 @@
}
//create the sql query to get the xml cdr records
if (strlen($order_by) == 0) { $order_by = "start_stamp"; }
if (strlen($order) == 0) { $order = "desc"; }
if (empty($order_by)) { $order_by = "start_stamp"; }
if (empty($order)) { $order = "desc"; }
//set a default number of rows to show
$num_rows = '0';
@@ -303,20 +303,20 @@
$sql .= "and false \n";
}
}
if (strlen($start_epoch) > 0 && strlen($stop_epoch) > 0) {
if (!empty($start_epoch) && !empty($stop_epoch)) {
$sql .= "and start_epoch between :start_epoch and :stop_epoch \n";
$parameters['start_epoch'] = $start_epoch;
$parameters['stop_epoch'] = $stop_epoch;
}
if (strlen($cdr_id) > 0) {
if (!empty($cdr_id)) {
$sql .= "and cdr_id like :cdr_id \n";
$parameters['cdr_id'] = '%'.$cdr_id.'%';
}
if (strlen($direction) > 0) {
if (!empty($direction)) {
$sql .= "and direction = :direction \n";
$parameters['direction'] = $direction;
}
if (strlen($caller_id_name) > 0) {
if (!empty($caller_id_name)) {
$mod_caller_id_name = str_replace("*", "%", $caller_id_name);
if (strstr($mod_caller_id_name, '%')) {
$sql .= "and caller_id_name like :caller_id_name \n";
@@ -327,7 +327,7 @@
$parameters['caller_id_name'] = $mod_caller_id_name;
}
}
if (strlen($caller_id_number) > 0) {
if (!empty($caller_id_number)) {
$mod_caller_id_number = str_replace("*", "%", $caller_id_number);
$mod_caller_id_number = preg_replace("#[^\+0-9.%/]#", "", $mod_caller_id_number);
if (strstr($mod_caller_id_number, '%')) {
@@ -340,11 +340,11 @@
}
}
if (strlen($extension_uuid) > 0 && is_uuid($extension_uuid)) {
if (!empty($extension_uuid) && is_uuid($extension_uuid)) {
$sql .= "and e.extension_uuid = :extension_uuid \n";
$parameters['extension_uuid'] = $extension_uuid;
}
if (strlen($caller_destination) > 0) {
if (!empty($caller_destination)) {
$mod_caller_destination = str_replace("*", "%", $caller_destination);
$mod_caller_destination = preg_replace("#[^\+0-9.%/]#", "", $mod_caller_destination);
if (strstr($mod_caller_destination, '%')) {
@@ -356,7 +356,7 @@
$parameters['caller_destination'] = $mod_caller_destination;
}
}
if (strlen($destination_number) > 0) {
if (!empty($destination_number)) {
$mod_destination_number = str_replace("*", "%", $destination_number);
$mod_destination_number = preg_replace("#[^\+0-9.%/]#", "", $mod_destination_number);
if (strstr($mod_destination_number, '%')) {
@@ -368,17 +368,17 @@
$parameters['destination_number'] = $mod_destination_number;
}
}
if (strlen($context) > 0) {
if (!empty($context)) {
$sql .= "and context like :context \n";
$parameters['context'] = '%'.$context.'%';
}
if (is_array($_SESSION['cdr']['field'])) {
if (!empty($_SESSION['cdr']['field']) && is_array($_SESSION['cdr']['field'])) {
foreach ($_SESSION['cdr']['field'] as $field) {
$array = explode(",", $field);
$field_name = end($array);
if (isset($$field_name)) {
$$field_name = $_REQUEST[$field_name];
if (strlen($$field_name) > 0) {
if (!empty($$field_name)) {
if (strstr($$field_name, '%')) {
$sql .= "and $field_name like :".$field_name." \n";
$parameters[$field_name] = $$field_name;
@@ -392,47 +392,47 @@
}
}
if (strlen($start_stamp_begin) > 0 && strlen($start_stamp_end) > 0) {
if (!empty($start_stamp_begin) && !empty($start_stamp_end)) {
$sql .= "and start_stamp between :start_stamp_begin::timestamptz and :start_stamp_end::timestamptz \n";
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000 '.$time_zone;
$parameters['start_stamp_end'] = $start_stamp_end.':59.999 '.$time_zone;
}
else {
if (strlen($start_stamp_begin) > 0) {
if (!empty($start_stamp_begin)) {
$sql .= "and start_stamp >= :start_stamp_begin \n";
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000 '.$time_zone;
}
if (strlen($start_stamp_end) > 0) {
if (!empty($start_stamp_end)) {
$sql .= "and start_stamp <= :start_stamp_end \n";
$parameters['start_stamp_end'] = $start_stamp_end.':59.999 '.$time_zone;
}
}
if (strlen($answer_stamp_begin) > 0 && strlen($answer_stamp_end) > 0) {
if (!empty($answer_stamp_begin) && !empty($answer_stamp_end)) {
$sql .= "and answer_stamp between :answer_stamp_begin::timestamptz and :answer_stamp_end::timestamptz \n";
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000 '.$time_zone;
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999 '.$time_zone;
}
else {
if (strlen($answer_stamp_begin) > 0) {
if (!empty($answer_stamp_begin)) {
$sql .= "and answer_stamp >= :answer_stamp_begin \n";
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000 '.$time_zone;;
}
if (strlen($answer_stamp_end) > 0) {
if (!empty($answer_stamp_end)) {
$sql .= "and answer_stamp <= :answer_stamp_end \n";
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999 '.$time_zone;
}
}
if (strlen($end_stamp_begin) > 0 && strlen($end_stamp_end) > 0) {
if (!empty($end_stamp_begin) && !empty($end_stamp_end)) {
$sql .= "and end_stamp between :end_stamp_begin::timestamptz and :end_stamp_end::timestamptz \n";
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000 '.$time_zone;
$parameters['end_stamp_end'] = $end_stamp_end.':59.999 '.$time_zone;
}
else {
if (strlen($end_stamp_begin) > 0) {
if (!empty($end_stamp_begin)) {
$sql .= "and end_stamp >= :end_stamp_begin \n";
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000 '.$time_zone;
}
if (strlen($end_stamp_end) > 0) {
if (!empty($end_stamp_end)) {
$sql .= "and end_stamp <= :end_stamp_end \n";
$parameters['end_stamp'] = $end_stamp_end.':59.999 '.$time_zone;
}
@@ -445,11 +445,11 @@
$sql .= "and duration <= :duration_max \n";
$parameters['duration_max'] = $duration_max;
}
if (strlen($billsec) > 0) {
if (!empty($billsec)) {
$sql .= "and billsec like :billsec \n";
$parameters['billsec'] = '%'.$billsec.'%';
}
if (strlen($hangup_cause) > 0) {
if (!empty($hangup_cause)) {
$sql .= "and hangup_cause like :hangup_cause \n";
$parameters['hangup_cause'] = '%'.$hangup_cause.'%';
}
@@ -459,7 +459,7 @@
$sql .= "and hangup_cause != 'LOSE_RACE' \n";
}
if (strlen($call_result) > 0) {
if (!empty($call_result)) {
switch ($call_result) {
case 'answered':
$sql .= "and (answer_stamp is not null and bridge_uuid is not null) \n";
@@ -511,40 +511,40 @@
//$sql .= "and (answer_stamp is null and bridge_uuid is null and billsec = 0 and sip_hangup_disposition = 'send_refuse') ";
}
}
if (strlen($xml_cdr_uuid) > 0) {
if (!empty($xml_cdr_uuid)) {
$sql .= "and xml_cdr_uuid = :xml_cdr_uuid \n";
$parameters['xml_cdr_uuid'] = $xml_cdr_uuid;
}
if (strlen($bleg_uuid) > 0) {
if (!empty($bleg_uuid)) {
$sql .= "and bleg_uuid = :bleg_uuid \n";
$parameters['bleg_uuid'] = $bleg_uuid;
}
if (strlen($accountcode) > 0) {
if (!empty($accountcode)) {
$sql .= "and c.accountcode = :accountcode \n";
$parameters['accountcode'] = $accountcode;
}
if (strlen($read_codec) > 0) {
if (!empty($read_codec)) {
$sql .= "and read_codec like :read_codec \n";
$parameters['read_codec'] = '%'.$read_codec.'%';
}
if (strlen($write_codec) > 0) {
if (!empty($write_codec)) {
$sql .= "and write_codec like :write_codec \n";
$parameters['write_codec'] = '%'.$write_codec.'%';
}
if (strlen($remote_media_ip) > 0) {
if (!empty($remote_media_ip)) {
$sql .= "and remote_media_ip like :remote_media_ip \n";
$parameters['remote_media_ip'] = $remote_media_ip;
}
if (strlen($network_addr) > 0) {
if (!empty($network_addr)) {
$sql .= "and network_addr like :network_addr \n";
$parameters['network_addr'] = '%'.$network_addr.'%';
}
//if (strlen($mos_comparison) > 0 && strlen($mos_score) > 0 ) {
//if (strlen($mos_comparison) > 0 && !empty($mos_score) ) {
// $sql .= "and rtp_audio_in_mos = :mos_comparison :mos_score ";
// $parameters['mos_comparison'] = $mos_comparison;
// $parameters['mos_score'] = $mos_score;
//}
if (strlen($leg) > 0) {
if (!empty($leg)) {
$sql .= "and leg = :leg \n";
$parameters['leg'] = $leg;
}
@@ -569,7 +569,7 @@
$sql .= "and (cc_side is null or cc_side != 'agent') \n";
}
//end where
if (strlen($order_by) > 0) {
if (!empty($order_by)) {
$sql .= order_by($order_by, $order);
}
if ($_REQUEST['export_format'] !== "csv" && $_REQUEST['export_format'] !== "pdf") {