Update call_forward_edit.php changes for PHP 8.1

This commit is contained in:
FusionPBX 2023-05-31 23:52:32 -06:00 committed by GitHub
parent 6793ab363f
commit 7b25e81a8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 19 deletions

View File

@ -94,7 +94,7 @@
$effective_caller_id_number = $row["effective_caller_id_number"];
$outbound_caller_id_name = $row["outbound_caller_id_name"];
$outbound_caller_id_number = $row["outbound_caller_id_number"];
$do_not_disturb = $row["do_not_disturb"] != '' ? $row["do_not_disturb"] : 'false';
$do_not_disturb = !empty($row["do_not_disturb"]) ? $row["do_not_disturb"] : 'false';
$forward_all_destination = $row["forward_all_destination"];
$forward_all_enabled = $row["forward_all_enabled"];
$forward_busy_destination = $row["forward_busy_destination"];
@ -125,8 +125,8 @@
$forward_user_not_registered_enabled = $_POST["forward_user_not_registered_enabled"];
$forward_user_not_registered_destination = $_POST["forward_user_not_registered_destination"];
$cid_name_prefix = $_POST["cid_name_prefix"];
$cid_number_prefix = $_POST["cid_number_prefix"];
$cid_name_prefix = $_POST["cid_name_prefix"] ?? '';
$cid_number_prefix = $_POST["cid_number_prefix"] ?? '';
$follow_me_enabled = $_POST["follow_me_enabled"];
$follow_me_ignore_busy = $_POST["follow_me_ignore_busy"];
@ -138,7 +138,7 @@
$destinations[$n]['delay'] = $field['delay'];
$destinations[$n]['prompt'] = $field['prompt'];
$destinations[$n]['timeout'] = $field['timeout'];
if ($field['destination'] != '') {
if (!empty($field['destination'])) {
$destination_found = true;
}
$n++;
@ -234,7 +234,7 @@
$d = 0;
$destination_found = false;
foreach ($destinations as $field) {
if ($field['destination'] != '') {
if (!empty($field['destination'])) {
//sanitize the destination
$field['destination'] = preg_replace('#[^\*0-9]#', '', $field['destination']);
@ -266,7 +266,6 @@
$database->app_uuid = '19806921-e8ed-dcff-b325-dd3e5da4959d';
$database->save($array);
unset($array);
//$message = $database->message;
//remove the temporary permission
$p->delete("extension_edit", "temp");
@ -351,7 +350,7 @@
*/
//send feature event notify to the phone
if ($_SESSION['device']['feature_sync']['boolean'] == "true") {
if (!empty($_SESSION['device']['feature_sync']['boolean']) && $_SESSION['device']['feature_sync']['boolean'] == "true") {
$ring_count = ceil($call_timeout / 6);
$feature_event_notify = new feature_event_notify;
$feature_event_notify->domain_name = $_SESSION['domain_name'];
@ -434,7 +433,7 @@
}
//synchronize configuration
if (is_readable($_SESSION['switch']['extensions']['dir'])) {
if (!empty($_SESSION['switch']['extensions']['dir']) && is_readable($_SESSION['switch']['extensions']['dir'])) {
require_once "app/extensions/resources/classes/extension.php";
$ext = new extension;
$ext->xml();
@ -476,7 +475,7 @@
$sql = "select * from v_follow_me_destinations ";
$sql .= "where follow_me_uuid = :follow_me_uuid ";
$sql .= "order by follow_me_delay, follow_me_destination asc ";
$sql .= "order by follow_me_order asc ";
$parameters['follow_me_uuid'] = $follow_me_uuid;
$database = new database;
$result = $database->select($sql, $parameters ?? null, 'all');
@ -492,6 +491,15 @@
unset($sql, $parameters, $result, $row);
}
}
//add the pre-defined follow me destinations
for ($n = 0; $n <= (((!empty($_SESSION['follow_me']['max_destinations']['numeric'])) ? $_SESSION['follow_me']['max_destinations']['numeric'] : 5) - 1); $n++) {
if (empty($destinations[$n]['uuid'])) { $destinations[$n]['uuid'] = null; }
if (empty($destinations[$n]['destination'])) { $destinations[$n]['destination'] = null; }
if (empty($destinations[$n]['delay'])) { $destinations[$n]['delay'] = null; }
if (empty($destinations[$n]['prompt'])) { $destinations[$n]['prompt'] = null; }
if (empty($destinations[$n]['timeout'])) { $destinations[$n]['timeout'] = 30; }
}
//get the extensions array - used with autocomplete
$sql = "select * from v_extensions ";
@ -524,7 +532,7 @@
}
}
echo " ];\n";
for ($n = 0; $n <= ((($_SESSION['follow_me']['max_destinations']['numeric'] != '') ? $_SESSION['follow_me']['max_destinations']['numeric'] : 5) - 1); $n++) {
for ($n = 0; $n <= (((!empty($_SESSION['follow_me']['max_destinations']['numeric'])) ? $_SESSION['follow_me']['max_destinations']['numeric'] : 5) - 1); $n++) {
echo " \$(\"#destination_".$n."\").autocomplete({\n";
echo " source: extensions\n";
echo " });\n";
@ -629,14 +637,14 @@
echo "<td class='vtable' align='left'>\n";
$on_click = "document.getElementById('forward_all_disabled').checked=true; ";
$on_click .= "document.getElementById('dnd_disabled').checked=true; ";
echo " <label for='follow_me_disabled'><input type='radio' name='follow_me_enabled' id='follow_me_disabled' onclick=\"$('#tr_follow_me_settings').slideUp('fast');\" value='false' ".(($follow_me_enabled == "false" || $follow_me_enabled == "") ? "checked='checked'" : null)." /> ".$text['label-disabled']."</label> \n";
echo " <label for='follow_me_enabled'><input type='radio' name='follow_me_enabled' id='follow_me_enabled' onclick=\"$('#tr_follow_me_settings').slideDown('fast'); $on_click\" value='true' ".(($follow_me_enabled == "true") ? "checked='checked'" : null)."/> ".$text['label-enabled']."</label> \n";
echo " <label for='follow_me_disabled'><input type='radio' name='follow_me_enabled' id='follow_me_disabled' onclick=\"$('#tr_follow_me_settings').slideUp('fast');\" value='false' ".((!empty($follow_me_enabled) && $follow_me_enabled == "false" || empty($follow_me_enabled)) ? "checked='checked'" : null)." /> ".$text['label-disabled']."</label> \n";
echo " <label for='follow_me_enabled'><input type='radio' name='follow_me_enabled' id='follow_me_enabled' onclick=\"$('#tr_follow_me_settings').slideDown('fast'); $on_click\" value='true' ".((!empty($follow_me_enabled) && $follow_me_enabled == "true") ? "checked='checked'" : null)."/> ".$text['label-enabled']."</label> \n";
unset($on_click);
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
if ($follow_me_enabled == "true" && $dnd_enabled != "true" && $forward_all_enabled != "true") { $style = ''; } else { $style = 'display: none;'; }
if (!empty($follow_me_enabled) && $follow_me_enabled == "true" && $dnd_enabled != "true" && $forward_all_enabled != "true") { $style = ''; } else { $style = 'display: none;'; }
echo "<div id='tr_follow_me_settings' style='$style'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
@ -657,21 +665,22 @@
echo " </tr>\n";
//output destinations
for ($n = 0; $n <= ((($_SESSION['follow_me']['max_destinations']['numeric'] != '') ? $_SESSION['follow_me']['max_destinations']['numeric'] : 5) - 1); $n++) {
echo " <input type='hidden' name='destinations[".$n."][uuid]' value='".(($destinations[$n]['uuid'] != '') ? $destinations[$n]['uuid'] : uuid())."'>\n";
$on_click = "";
foreach ($destinations as $n => $destination) {
echo " <input type='hidden' name='destinations[".$n."][uuid]' value='".((!empty($destination['uuid'])) ? $destination['uuid'] : uuid())."'>\n";
echo " <tr>\n";
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destinations[".$n."][destination]' id='destination_".$n."' maxlength='255' value=\"".escape($destinations[$n]['destination'])."\"></td>\n";
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destinations[".$n."][destination]' id='destination_".$n."' maxlength='255' value=\"".escape($destination['destination'])."\"></td>\n";
echo " <td>\n";
destination_select('destinations['.$n.'][delay]', $destinations[$n]['delay'], '0');
destination_select('destinations['.$n.'][delay]', $destination['delay'], '0');
echo " </td>\n";
echo " <td>\n";
destination_select('destinations['.$n.'][timeout]', $destinations[$n]['timeout'], (($_SESSION['follow_me']['timeout']['numeric'] != '') ? $_SESSION['follow_me']['timeout']['numeric'] : 30));
destination_select('destinations['.$n.'][timeout]', $destination['timeout'], ((!empty($_SESSION['follow_me']['timeout']['numeric'])) ? $_SESSION['follow_me']['timeout']['numeric'] : 30));
echo " </td>\n";
if (permission_exists('follow_me_prompt')) {
echo " <td>\n";
echo " <select class='formfld' style='width: 90px;' name='destinations[".$n."][prompt]'>\n";
echo " <option value=''></option>\n";
echo " <option value='1' ".(($destinations[$n]['prompt'])?"selected='selected'":null).">".$text['label-destination_prompt_confirm']."</option>\n";
echo " <option value='1' ".(($destination['prompt']) ? "selected='selected'" : null).">".$text['label-destination_prompt_confirm']."</option>\n";
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
echo " </select>\n";
echo " </td>\n";