BugFix-Add PROJECT_PATH for lua (#1740)

added project_path for lua to use where it needs to build urls
This commit is contained in:
Mafoo 2016-07-08 20:12:37 +01:00 committed by FusionPBX
parent cae644c8a1
commit 904a52434a
4 changed files with 21 additions and 3 deletions

View File

@ -159,6 +159,14 @@ if (!class_exists('scripts')) {
//get the recordings directory
$recordings_dir = $_SESSION['switch']['recordings']['dir'];
//get the http_protocol
if (!isset($_SERVER['HTTP_PROTOCOL'])) {
$_SERVER['HTTP_PROTOCOL'] = 'http';
if (isset($_SERVER['REQUEST_SCHEME'])) { $_SERVER['HTTP_PROTOCOL'] = $_SERVER['REQUEST_SCHEME']; }
if ($_SERVER['HTTPS'] == 'on') { $_SERVER['HTTP_PROTOCOL'] = 'https'; }
if ($_SERVER['SERVER_PORT'] == '443') { $_SERVER['HTTP_PROTOCOL'] = 'https'; }
}
//find the location to write the config.lua
if (is_dir("/etc/fusionpbx")){
$config = "/etc/fusionpbx/config.lua";
@ -205,6 +213,8 @@ if (!class_exists('scripts')) {
$tmp .= " php_bin = \"php5\";\n";
}
$tmp .= $this->correct_path(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n");
$tmp .= $this->correct_path(" project_path = [[".PROJECT_PATH."]];\n");
$tmp .= $this->correct_path(" http_protocol = [[".$_SERVER['HTTP_PROTOCOL'])."]];\n");
$tmp .= "\n";
$tmp .= "--store settings in memcache\n";

View File

@ -87,6 +87,9 @@
moderator_pin = string.lower(row["moderator_pin"]);
end);
--get the link_address
link_address = http_protocol.."://"..domain_name..project_path;
--prepare the headers
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
@ -101,6 +104,7 @@
subject = subject:gsub("${conference_date_end}", conference_date_end);
--subject = subject:gsub("${conference_duration}", message_length_formatted);
subject = subject:gsub("${domain_name}", domain_name);
subject = subject:gsub("${link_address}", link_address);
subject = trim(subject);
subject = '=?utf-8?B?'..base64.enc(subject)..'?=';
@ -113,6 +117,7 @@
body = body:gsub("${conference_uuid}", conference_session_uuid);
--body = body:gsub("${conference_duration}", message_length_formatted);
body = body:gsub("${domain_name}", domain_name);
body = body:gsub("${link_address}", link_address);
body = body:gsub(" ", " ");
body = body:gsub("%s+", "");
body = body:gsub(" ", " ");

View File

@ -1,6 +1,6 @@
<font face="arial">
<p>The conference moderator pin is ${moderator_pin} and it ended on ${conference_date_end}.</p>
<p>You can download your conference recording by clicking <a href='http://${domain_name}/app/conference_centers/conference_session_details.php?uuid=${conference_uuid}'>here</a>.</p>
<p>You can download your conference recording by clicking <a href='${link_address}/app/conference_centers/conference_session_details.php?uuid=${conference_uuid}'>here</a>.</p>
<hr noshade="noshade" size="1"/>
Moderator PIN: ${moderator_pin}
Ended: ${conference_date_end}<br/>

View File

@ -105,6 +105,9 @@
file_body = scripts_dir.."/app/voicemail/resources/templates/en/us/email_body.tpl";
end
--get the link_address
link_address = http_protocol.."://"..domain_name..project_path;
--prepare the headers
local headers = {
["X-FusionPBX-Domain-UUID"] = domain_uuid;
@ -141,9 +144,9 @@
if (voicemail_file == "attach") then
body = body:gsub("${message}", text['label-attached']);
elseif (voicemail_file == "link") then
body = body:gsub("${message}", "<a href='https://"..domain_name.."/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&type=vm&t=bin&id="..id.."&voicemail_uuid="..db_voicemail_uuid.."&uuid="..uuid.."&src=email'>"..text['label-download'].."</a>");
else
body = body:gsub("${message}", "<a href='https://"..domain_name.."/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
body = body:gsub(" ", "&nbsp;");
body = body:gsub("%s+", "");