mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Voicemails: Updates for PHP 8.1
This commit is contained in:
@@ -291,7 +291,7 @@
|
||||
|
||||
//filter out unchecked sip profiles
|
||||
foreach ($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$uuids[] = "'".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
@@ -411,7 +411,7 @@
|
||||
|
||||
//filter out unchecked sip profiles
|
||||
foreach ($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
//build the delete array
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['voicemail_uuid'] = $this->voicemail_uuid;
|
||||
@@ -458,7 +458,7 @@
|
||||
|
||||
//filter out unchecked sip profiles
|
||||
foreach ($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
//build the delete array
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['voicemail_uuid'] = $this->voicemail_uuid;
|
||||
@@ -507,7 +507,7 @@
|
||||
|
||||
//filter out unchecked sip profiles
|
||||
foreach ($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$uuids[] = "'".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
@@ -748,7 +748,7 @@
|
||||
$path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$_SESSION['domain_name'].'/'.$this->voicemail_id;
|
||||
|
||||
//prepare base64 content from db, if enabled
|
||||
if ($_SESSION['voicemail']['storage_type']['text'] == 'base64') {
|
||||
if (!empty($_SESSION['voicemail']['storage_type']['text']) && $_SESSION['voicemail']['storage_type']['text'] == 'base64') {
|
||||
$sql = "select message_base64 ";
|
||||
$sql .= "from ";
|
||||
$sql .= "v_voicemail_messages as m, ";
|
||||
@@ -799,11 +799,6 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
//content-range
|
||||
if (isset($_SERVER['HTTP_RANGE']) && $this->type != 'bin') {
|
||||
$this->range_download($file_path);
|
||||
}
|
||||
|
||||
$fd = fopen($file_path, "rb");
|
||||
if ($this->type == 'bin') {
|
||||
header("Content-Type: application/force-download");
|
||||
@@ -830,10 +825,16 @@
|
||||
header("Content-Length: ".filesize($file_path));
|
||||
}
|
||||
ob_end_clean();
|
||||
|
||||
//content-range
|
||||
if (isset($_SERVER['HTTP_RANGE']) && $this->type != 'bin') {
|
||||
$this->range_download($file_path);
|
||||
}
|
||||
|
||||
fpassthru($fd);
|
||||
|
||||
//if base64, remove temp file
|
||||
if ($_SESSION['voicemail']['storage_type']['text'] == 'base64') {
|
||||
if (!empty($_SESSION['voicemail']['storage_type']['text']) && $_SESSION['voicemail']['storage_type']['text'] == 'base64') {
|
||||
@unlink($path.'/msg_'.$this->voicemail_message_uuid.'.'.$file_ext);
|
||||
}
|
||||
|
||||
@@ -884,7 +885,7 @@
|
||||
// If the range starts with an '-' we start from the beginning
|
||||
// If not, we forward the file pointer
|
||||
// And make sure to get the end byte if spesified
|
||||
if ($range0 == '-') {
|
||||
if (!empty($range0) && $range0 == '-') {
|
||||
// The n-number of the last bytes is requested
|
||||
$c_start = $size - substr($range, 1);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
if (is_uuid($voicemail_uuid)) {
|
||||
$tr_link = "href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php?id=".(permission_exists('voicemail_view') ? $voicemail_uuid : $row['ext'])."'";
|
||||
echo "<tr ".$tr_link." style='cursor: pointer;'>";
|
||||
echo " <td class='".$row_style[$c]." hud_text'><a href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php?id=".(permission_exists('voicemail_view') ? $voicemail_uuid : $row['ext'])."'>".$row['ext']."</a></td>";
|
||||
echo " <td class='".$row_style[$c]." hud_text'><a href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php?id=".(permission_exists('voicemail_view') ? $voicemail_uuid : $row['ext'])."&back=".urlencode($_SERVER["REQUEST_URI"])."'>".$row['ext']."</a></td>";
|
||||
echo " <td class='".$row_style[$c]." hud_text' style='text-align: center;'>".$row['new']."</td>";
|
||||
echo " <td class='".$row_style[$c]." hud_text' style='text-align: center;'>".$row['total']."</td>";
|
||||
echo "</tr>";
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
if (!empty($_POST)) {
|
||||
|
||||
//process the http post data by submitted action
|
||||
if ($_POST['action'] != '' && is_uuid($_POST['voicemail_uuid'])) {
|
||||
if (!empty($_POST['action']) && is_uuid($_POST['voicemail_uuid'])) {
|
||||
$array[0]['checked'] = 'true';
|
||||
$array[0]['uuid'] = $_POST['voicemail_uuid'];
|
||||
|
||||
@@ -98,16 +98,16 @@
|
||||
$voicemail_options = $_POST["voicemail_options"];
|
||||
$voicemail_alternate_greet_id = $_POST["voicemail_alternate_greet_id"];
|
||||
$voicemail_mail_to = $_POST["voicemail_mail_to"];
|
||||
$voicemail_sms_to = $_POST["voicemail_sms_to"];
|
||||
$voicemail_transcription_enabled = $_POST["voicemail_transcription_enabled"];
|
||||
$voicemail_sms_to = $_POST["voicemail_sms_to"] ?? null;
|
||||
$voicemail_transcription_enabled = $_POST["voicemail_transcription_enabled"] ?? null;
|
||||
$voicemail_file = $_POST["voicemail_file"];
|
||||
$voicemail_local_after_email = $_POST["voicemail_local_after_email"];
|
||||
$voicemail_destination = $_POST["voicemail_destination"];
|
||||
$voicemail_enabled = $_POST["voicemail_enabled"] ?? 'false';
|
||||
$voicemail_description = $_POST["voicemail_description"];
|
||||
$voicemail_tutorial = $_POST["voicemail_tutorial"];
|
||||
$voicemail_options_delete = $_POST["voicemail_options_delete"];
|
||||
$voicemail_destinations_delete = $_POST["voicemail_destinations_delete"];
|
||||
$voicemail_options_delete = $_POST["voicemail_options_delete"] ?? null;
|
||||
$voicemail_destinations_delete = $_POST["voicemail_destinations_delete"] ?? null;
|
||||
|
||||
//remove the space
|
||||
$voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to);
|
||||
@@ -211,7 +211,7 @@
|
||||
$array['voicemail_options'][$x]['voicemail_option_order'] = $voicemail_option['voicemail_option_order'];
|
||||
$array['voicemail_options'][$x]['voicemail_option_description'] = $voicemail_option['voicemail_option_description'];
|
||||
}
|
||||
if (is_array($array['voicemail_options']) && @sizeof($array['voicemail_options']) != 0) {
|
||||
if (!empty($array['voicemail_options']) && is_array($array['voicemail_options']) && @sizeof($array['voicemail_options']) != 0) {
|
||||
//grant temporary permission
|
||||
$p->add('voicemail_option_add', 'temp');
|
||||
}
|
||||
@@ -540,7 +540,7 @@
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='greeting_id'>\n";
|
||||
echo " <option value=''>".$text['label-default']."</option>\n";
|
||||
echo " <option value='0' ".(($greeting_id == "0") ? "selected='selected'" : null).">".$text['label-none']."</option>\n";
|
||||
echo " <option value='0' ".(empty($greeting_id) || $greeting_id == "0" ? "selected='selected'" : null).">".$text['label-none']."</option>\n";
|
||||
if (is_array($greetings) && @sizeof($greetings) != 0) {
|
||||
foreach ($greetings as $greeting) {
|
||||
$selected = ($greeting['greeting_id'] == $greeting_id) ? 'selected' : null;
|
||||
@@ -611,7 +611,7 @@
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable' style='border-bottom: none;' align='left'>\n";
|
||||
echo " <select name='voicemail_options[".$c."][voicemail_option_order]' class='formfld' style='width:55px'>\n";
|
||||
if (strlen(htmlspecialchars($voicemail_option_order))> 0) {
|
||||
if (strlen(htmlspecialchars($voicemail_option_order ?? ''))> 0) {
|
||||
echo " <option selected='yes' value='".htmlspecialchars($voicemail_option_order)."'>".htmlspecialchars($voicemail_option_order)."</option>\n";
|
||||
}
|
||||
$i = 0;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
) {
|
||||
$voicemail = new voicemail;
|
||||
$voicemail->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$voicemail->type = $_REQUEST['t'];
|
||||
$voicemail->type = $_REQUEST['t'] ?? null;
|
||||
$voicemail->voicemail_id = $_REQUEST['id'];
|
||||
$voicemail->voicemail_uuid = $_REQUEST['voicemail_uuid'];
|
||||
$voicemail->voicemail_message_uuid = $_REQUEST['uuid'];
|
||||
@@ -64,11 +64,14 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
//set the back button url
|
||||
$_SESSION['back'][$_SERVER['PHP_SELF']] = !empty($_GET['back']) ? urldecode($_GET['back']) : ($_SESSION['back'][$_SERVER['PHP_SELF']] ?? PROJECT_PATH.'/app/voicemails/voicemails.php');
|
||||
|
||||
//set the voicemail_uuid
|
||||
if (is_uuid($_REQUEST['id'])) {
|
||||
if (!empty($_REQUEST['id']) && is_uuid($_REQUEST['id'])) {
|
||||
$voicemail_uuid = $_REQUEST['id'];
|
||||
}
|
||||
else if (is_numeric($_REQUEST['id'])) {
|
||||
else if (!empty($_REQUEST['id']) && is_numeric($_REQUEST['id'])) {
|
||||
$voicemail_id = $_REQUEST['id'];
|
||||
}
|
||||
|
||||
@@ -105,7 +108,7 @@
|
||||
if (is_array($voicemail_messages) && @sizeof($voicemail_messages) != 0) {
|
||||
$messages_toggled = 0;
|
||||
foreach ($voicemail_messages as $voicemail_message) {
|
||||
if ($voicemail_message['checked'] == 'true' && is_uuid($voicemail_message['uuid']) && is_uuid($voicemail_message['voicemail_uuid'])) {
|
||||
if (!empty($voicemail_message['checked']) && $voicemail_message['checked'] == 'true' && is_uuid($voicemail_message['uuid']) && is_uuid($voicemail_message['voicemail_uuid'])) {
|
||||
//delete voicemail message
|
||||
$voicemail = new voicemail;
|
||||
$voicemail->db = $db;
|
||||
@@ -129,7 +132,7 @@
|
||||
if (is_array($voicemail_messages) && @sizeof($voicemail_messages) != 0) {
|
||||
$messages_deleted = 0;
|
||||
foreach ($voicemail_messages as $voicemail_message) {
|
||||
if ($voicemail_message['checked'] == 'true' && is_uuid($voicemail_message['uuid']) && is_uuid($voicemail_message['voicemail_uuid'])) {
|
||||
if (!empty($voicemail_message['checked']) && $voicemail_message['checked'] == 'true' && is_uuid($voicemail_message['uuid']) && is_uuid($voicemail_message['voicemail_uuid'])) {
|
||||
//delete voicemail message
|
||||
$voicemail = new voicemail;
|
||||
$voicemail->db = $db;
|
||||
@@ -172,10 +175,10 @@
|
||||
//get the voicemail
|
||||
$vm = new voicemail;
|
||||
$vm->domain_uuid = $_SESSION['domain_uuid'];
|
||||
if (is_uuid($voicemail_uuid)) {
|
||||
if (!empty($voicemail_uuid) && is_uuid($voicemail_uuid)) {
|
||||
$vm->voicemail_uuid = $voicemail_uuid;
|
||||
}
|
||||
else if (is_numeric($voicemail_id)) {
|
||||
else if (!empty($voicemail_id) && is_numeric($voicemail_id)) {
|
||||
$vm->voicemail_id = $voicemail_id;
|
||||
}
|
||||
$vm->order_by = $order_by;
|
||||
@@ -209,11 +212,12 @@
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-voicemail_messages']." (".$num_rows.")</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>$_SESSION['back'][$_SERVER['PHP_SELF']]]);
|
||||
if ($num_rows) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'name'=>'btn_toggle','collapse'=>'hide-xs','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','collapse'=>'hide-xs','style'=>'margin-left: 15px; display: none;','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
}
|
||||
if (permission_exists('voicemail_message_delete') && $num_rows) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','collapse'=>'hide-xs','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','collapse'=>'hide-xs','style'=>'display: none;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
}
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
@@ -268,7 +272,7 @@
|
||||
$col_count = 0;
|
||||
if (permission_exists('voicemail_message_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_".$field['voicemail_id']."' name='checkbox_all' onclick=\"list_all_toggle('".$field['voicemail_id']."');\" ".(is_array($field['messages']) && @sizeof($field['messages']) > 0 ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_".$field['voicemail_id']."' name='checkbox_all' onclick=\"list_all_toggle('".$field['voicemail_id']."'); checkbox_on_change(this);\" ".(is_array($field['messages']) && @sizeof($field['messages']) > 0 ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
$col_count++;
|
||||
}
|
||||
@@ -282,7 +286,7 @@
|
||||
$col_count++;
|
||||
echo th_order_by('message_length', $text['label-message_length'], $order_by, $order, null, "class='hide-xs right pct-15'");
|
||||
$col_count++;
|
||||
if (!empty($_SESSION['voicemail']['storage_type']['text']) != 'base64') {
|
||||
if (empty($_SESSION['voicemail']['storage_type']['text']) || $_SESSION['voicemail']['storage_type']['text'] != 'base64') {
|
||||
echo "<th class='right pct-15 hide-sm-dn'>".$text['label-message_size']."</th>\n";
|
||||
$col_count++;
|
||||
}
|
||||
@@ -300,7 +304,7 @@
|
||||
$list_row_url = "javascript:recording_play('".escape($row['voicemail_message_uuid'])."');";
|
||||
echo "<tr class='list-row' href=\"".$list_row_url."\">\n";
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='voicemail_messages[$x][checked]' id='checkbox_".$x."' class='checkbox_".$field['voicemail_id']."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_".$field['voicemail_id']."').checked = false; }\">\n";
|
||||
echo " <input type='checkbox' name='voicemail_messages[$x][checked]' id='checkbox_".$x."' class='checkbox_".$field['voicemail_id']."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_".$field['voicemail_id']."').checked = false; } checkbox_on_change(this);\">\n";
|
||||
echo " <input type='hidden' name='voicemail_messages[$x][uuid]' value='".escape($row['voicemail_message_uuid'])."' />\n";
|
||||
echo " <input type='hidden' name='voicemail_messages[$x][voicemail_uuid]' value='".escape($row['voicemail_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
@@ -316,7 +320,7 @@
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='right no-wrap hide-xs' style='".$bold."'>".escape($row['message_length_label'])."</td>\n";
|
||||
if (!empty($_SESSION['voicemail']['storage_type']['text']) != 'base64') {
|
||||
if (empty($_SESSION['voicemail']['storage_type']['text']) || $_SESSION['voicemail']['storage_type']['text'] != 'base64') {
|
||||
echo " <td class='right no-wrap hide-sm-dn' style='".$bold."'>".escape($row['file_size_label'])."</td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
@@ -372,4 +376,4 @@
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -307,7 +307,7 @@
|
||||
}
|
||||
if (permission_exists('voicemail_message_view')) {
|
||||
$tmp_voicemail_string = (array_key_exists($row['voicemail_uuid'], $voicemails_count)) ? " (" . $voicemails_count[$row['voicemail_uuid']] . ")" : " (0)";
|
||||
echo " <a href='voicemail_messages.php?id=".escape($row['voicemail_uuid'])."'>".$text['label-messages'].$tmp_voicemail_string."</a>\n";
|
||||
echo " <a href='voicemail_messages.php?id=".escape($row['voicemail_uuid'])."&back=".urlencode($_SERVER["REQUEST_URI"])."'>".$text['label-messages'].$tmp_voicemail_string."</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user