Voicemail: Fix emailed direct message Download feature.

This commit is contained in:
fusionate 2024-03-13 18:08:14 -06:00
parent 41e95766c6
commit a22d766d6a
No known key found for this signature in database
2 changed files with 14 additions and 1 deletions

View File

@ -744,7 +744,7 @@
$this->message_saved();
//set source folder path
$path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$_SESSION['domain_name'].'/'.$this->voicemail_id;
$path = ($_SESSION['switch']['voicemail']['dir'] ?? $_SESSION['switch']['voicemail']).'/default/'.$_SESSION['domain_name'].'/'.$this->voicemail_id;
//prepare base64 content from db, if enabled
if (!empty($_SESSION['voicemail']['storage_type']['text']) && $_SESSION['voicemail']['storage_type']['text'] == 'base64') {

View File

@ -35,6 +35,19 @@
&& !empty($_REQUEST["uuid"]) && is_uuid($_REQUEST["uuid"])
&& !empty($_REQUEST["voicemail_uuid"]) && is_uuid($_REQUEST["voicemail_uuid"])
) {
//if domain uuid not set (due to direct vm download using emailed link, etc), load settings into session based on domain in url
if ((empty($_SESSION['domain_uuid']) || !is_uuid($_SESSION['domain_uuid'])) && !empty($_SERVER['HTTP_HOST'])) {
$sql = 'select domain_uuid from v_domains where domain_name = :domain_name';
$parameters['domain_name'] = $_SERVER['HTTP_HOST'];
$database = new database;
$domain_uuid = $database->select($sql, $parameters, 'column');
if (is_uuid($domain_uuid)) {
$settings = new settings(['domain_uuid'=>$domain_uuid]);
$_SESSION = $settings->get();
$_SESSION['domain_uuid'] = $domain_uuid;
$_SESSION['domain_name'] = $_SERVER['HTTP_HOST'];
}
}
$voicemail = new voicemail;
$voicemail->domain_uuid = $_SESSION['domain_uuid'];
$voicemail->type = $_REQUEST['t'] ?? null;