diff --git a/app/scripts/resources/scripts/app/voicemail/resources/functions/send_email.lua b/app/scripts/resources/scripts/app/voicemail/resources/functions/send_email.lua index 5e4de39ed8..630b363a04 100644 --- a/app/scripts/resources/scripts/app/voicemail/resources/functions/send_email.lua +++ b/app/scripts/resources/scripts/app/voicemail/resources/functions/send_email.lua @@ -194,7 +194,7 @@ if (voicemail_file == "attach") then body = body:gsub("${message}", text['label-attached']); elseif (voicemail_file == "link") then - body = body:gsub("${message}", ""..text['label-download']..""); + body = body:gsub("${message}", ""..text['label-download']..""); else body = body:gsub("${message}", ""..text['label-listen']..""); end diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php index 5b999eceed..05158fb54d 100644 --- a/app/voicemails/resources/classes/voicemail.php +++ b/app/voicemails/resources/classes/voicemail.php @@ -37,6 +37,7 @@ public $voicemail_message_uuid; public $order_by; public $order; + public $type; /** * declare private variables @@ -676,7 +677,7 @@ } if ($file_path != '') { $fd = fopen($file_path, "rb"); - if ($_GET['t'] == "bin") { + if ($this->type == 'bin') { header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); diff --git a/app/voicemails/voicemail_messages.php b/app/voicemails/voicemail_messages.php index 8f0f4aadf7..75dc93fe82 100644 --- a/app/voicemails/voicemail_messages.php +++ b/app/voicemails/voicemail_messages.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - 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. Contributor(s): @@ -27,17 +27,8 @@ //includes require_once "root.php"; require_once "resources/require.php"; - require_once "resources/check_auth.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 if ( $_REQUEST["action"] == "download" @@ -47,14 +38,18 @@ ) { $voicemail = new voicemail; $voicemail->domain_uuid = $_SESSION['domain_uuid']; - $voicemail->voicemail_id = $_REQUEST["id"]; - $voicemail->voicemail_uuid = $_REQUEST["voicemail_uuid"]; - $voicemail->voicemail_message_uuid = $_REQUEST["uuid"]; + $voicemail->type = $_REQUEST['t']; + $voicemail->voicemail_id = $_REQUEST['id']; + $voicemail->voicemail_uuid = $_REQUEST['voicemail_uuid']; + $voicemail->voicemail_message_uuid = $_REQUEST['uuid']; $result = $voicemail->message_download(); unset($voicemail); exit; } +//include after download function + require_once "resources/check_auth.php"; + //check permissions if (permission_exists('voicemail_message_view')) { //access granted @@ -64,6 +59,14 @@ 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 if (is_array($_POST['voicemail_messages'])) { $action = $_POST['action']; @@ -305,7 +308,7 @@ echo " "; echo ""; 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 " \n"; echo " ".escape($row['message_length_label'])."\n"; if ($_SESSION['voicemail']['storage_type']['text'] != 'base64') {