Voicemail: Fix email download link.

This commit is contained in:
Nate 2020-02-13 07:15:59 -07:00
parent 2b115a2a5e
commit 3e729537a6
3 changed files with 20 additions and 16 deletions

View File

@ -194,7 +194,7 @@
if (voicemail_file == "attach") then if (voicemail_file == "attach") then
body = body:gsub("${message}", text['label-attached']); body = body:gsub("${message}", text['label-attached']);
elseif (voicemail_file == "link") then elseif (voicemail_file == "link") then
body = body:gsub("${message}", "<a href='"..link_address.."/app/voicemails/voicemail_messages.php?action=download&type=vm&t=bin&id="..id.."&voicemail_uuid="..db_voicemail_uuid.."&uuid="..uuid.."&src=email'>"..text['label-download'].."</a>"); body = body:gsub("${message}", "<a href='"..link_address.."/app/voicemails/voicemail_messages.php?action=download&id="..id.."&voicemail_uuid="..db_voicemail_uuid.."&uuid="..uuid.."&t=bin'>"..text['label-download'].."</a>");
else else
body = body:gsub("${message}", "<a href='"..link_address.."/app/voicemails/voicemail_messages.php?action=autoplay&id="..db_voicemail_uuid.."&uuid="..uuid.."'>"..text['label-listen'].."</a>"); body = body:gsub("${message}", "<a href='"..link_address.."/app/voicemails/voicemail_messages.php?action=autoplay&id="..db_voicemail_uuid.."&uuid="..uuid.."'>"..text['label-listen'].."</a>");
end end

View File

@ -37,6 +37,7 @@
public $voicemail_message_uuid; public $voicemail_message_uuid;
public $order_by; public $order_by;
public $order; public $order;
public $type;
/** /**
* declare private variables * declare private variables
@ -676,7 +677,7 @@
} }
if ($file_path != '') { if ($file_path != '') {
$fd = fopen($file_path, "rb"); $fd = fopen($file_path, "rb");
if ($_GET['t'] == "bin") { if ($this->type == 'bin') {
header("Content-Type: application/force-download"); header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream"); header("Content-Type: application/octet-stream");
header("Content-Type: application/download"); header("Content-Type: application/download");

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2019 Portions created by the Initial Developer are Copyright (C) 2008-2020
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -27,17 +27,8 @@
//includes //includes
require_once "root.php"; require_once "root.php";
require_once "resources/require.php"; require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/paging.php"; require_once "resources/paging.php";
//set the voicemail_uuid
if (is_uuid($_REQUEST['id'])) {
$voicemail_uuid = $_REQUEST['id'];
}
else if (is_numeric($_REQUEST['id'])) {
$voicemail_id = $_REQUEST['id'];
}
//download the message //download the message
if ( if (
$_REQUEST["action"] == "download" $_REQUEST["action"] == "download"
@ -47,14 +38,18 @@
) { ) {
$voicemail = new voicemail; $voicemail = new voicemail;
$voicemail->domain_uuid = $_SESSION['domain_uuid']; $voicemail->domain_uuid = $_SESSION['domain_uuid'];
$voicemail->voicemail_id = $_REQUEST["id"]; $voicemail->type = $_REQUEST['t'];
$voicemail->voicemail_uuid = $_REQUEST["voicemail_uuid"]; $voicemail->voicemail_id = $_REQUEST['id'];
$voicemail->voicemail_message_uuid = $_REQUEST["uuid"]; $voicemail->voicemail_uuid = $_REQUEST['voicemail_uuid'];
$voicemail->voicemail_message_uuid = $_REQUEST['uuid'];
$result = $voicemail->message_download(); $result = $voicemail->message_download();
unset($voicemail); unset($voicemail);
exit; exit;
} }
//include after download function
require_once "resources/check_auth.php";
//check permissions //check permissions
if (permission_exists('voicemail_message_view')) { if (permission_exists('voicemail_message_view')) {
//access granted //access granted
@ -64,6 +59,14 @@
exit; exit;
} }
//set the voicemail_uuid
if (is_uuid($_REQUEST['id'])) {
$voicemail_uuid = $_REQUEST['id'];
}
else if (is_numeric($_REQUEST['id'])) {
$voicemail_id = $_REQUEST['id'];
}
//get the http post data //get the http post data
if (is_array($_POST['voicemail_messages'])) { if (is_array($_POST['voicemail_messages'])) {
$action = $_POST['action']; $action = $_POST['action'];
@ -305,7 +308,7 @@
echo " <td class='button center no-link no-wrap'>"; echo " <td class='button center no-link no-wrap'>";
echo "<audio id='recording_audio_".escape($row['voicemail_message_uuid'])."' style='display: none;' preload='none' ontimeupdate=\"update_progress('".escape($row['voicemail_message_uuid'])."')\" onended=\"recording_reset('".escape($row['voicemail_message_uuid'])."');\" src='voicemail_messages.php?action=download&id=".urlencode($row['voicemail_id'])."&voicemail_uuid=".urlencode($row['voicemail_uuid'])."&uuid=".urlencode($row['voicemail_message_uuid'])."&r=".uuid()."'></audio>"; echo "<audio id='recording_audio_".escape($row['voicemail_message_uuid'])."' style='display: none;' preload='none' ontimeupdate=\"update_progress('".escape($row['voicemail_message_uuid'])."')\" onended=\"recording_reset('".escape($row['voicemail_message_uuid'])."');\" src='voicemail_messages.php?action=download&id=".urlencode($row['voicemail_id'])."&voicemail_uuid=".urlencode($row['voicemail_uuid'])."&uuid=".urlencode($row['voicemail_message_uuid'])."&r=".uuid()."'></audio>";
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.escape($row['voicemail_message_uuid']),'onclick'=>"recording_play('".escape($row['voicemail_message_uuid'])."');"]); echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.escape($row['voicemail_message_uuid']),'onclick'=>"recording_play('".escape($row['voicemail_message_uuid'])."');"]);
echo button::create(['type'=>'button','title'=>$text['label-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>"voicemail_messages.php?action=download&t=bin&id=".urlencode($row['voicemail_id'])."&voicemail_uuid=".escape($row['voicemail_uuid'])."&uuid=".escape($row['voicemail_message_uuid']),'onclick'=>"$(this).closest('tr').children('td').css('font-weight','normal');"]); echo button::create(['type'=>'button','title'=>$text['label-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>"voicemail_messages.php?action=download&id=".urlencode($row['voicemail_id'])."&voicemail_uuid=".escape($row['voicemail_uuid'])."&uuid=".escape($row['voicemail_message_uuid'])."&t=bin&r=".uuid(),'onclick'=>"$(this).closest('tr').children('td').css('font-weight','normal');"]);
echo " </td>\n"; echo " </td>\n";
echo " <td class='right no-wrap hide-xs' ".$style.">".escape($row['message_length_label'])."</td>\n"; echo " <td class='right no-wrap hide-xs' ".$style.">".escape($row['message_length_label'])."</td>\n";
if ($_SESSION['voicemail']['storage_type']['text'] != 'base64') { if ($_SESSION['voicemail']['storage_type']['text'] != 'base64') {