Fax Server: Add option for Download Link on received fax notifications, instead of attachment.
This commit is contained in:
parent
9eaef8a242
commit
12eead4b4d
|
|
@ -536,6 +536,11 @@
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
|
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||||
$z++;
|
$z++;
|
||||||
|
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "fax_file";
|
||||||
|
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||||
|
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
|
||||||
|
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||||
|
$z++;
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "fax_email_connection_type";
|
$apps[$x]['db'][$y]['fields'][$z]['name'] = "fax_email_connection_type";
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "IMAP or POP3 connection.";
|
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "IMAP or POP3 connection.";
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
$array['email_templates'][$x]['template_body'] .= "Extension: \${fax_extension}<br>";
|
$array['email_templates'][$x]['template_body'] .= "Extension: \${fax_extension}<br>";
|
||||||
$array['email_templates'][$x]['template_body'] .= "Messages: \${fax_messages} <br>";
|
$array['email_templates'][$x]['template_body'] .= "Messages: \${fax_messages} <br>";
|
||||||
$array['email_templates'][$x]['template_body'] .= "\${fax_file_warning}<br>";
|
$array['email_templates'][$x]['template_body'] .= "\${fax_file_warning}<br>";
|
||||||
|
$array['email_templates'][$x]['template_body'] .= "\${fax_file_message}<br>";
|
||||||
$array['email_templates'][$x]['template_body'] .= "</body>\n";
|
$array['email_templates'][$x]['template_body'] .= "</body>\n";
|
||||||
$array['email_templates'][$x]['template_body'] .= "</html>\n";
|
$array['email_templates'][$x]['template_body'] .= "</html>\n";
|
||||||
$array['email_templates'][$x]['template_type'] = "html";
|
$array['email_templates'][$x]['template_type'] = "html";
|
||||||
|
|
@ -58,6 +59,7 @@
|
||||||
$array['email_templates'][$x]['template_body'] .= "Extension: \${fax_extension}<br>";
|
$array['email_templates'][$x]['template_body'] .= "Extension: \${fax_extension}<br>";
|
||||||
$array['email_templates'][$x]['template_body'] .= "Messages: \${fax_messages} <br>";
|
$array['email_templates'][$x]['template_body'] .= "Messages: \${fax_messages} <br>";
|
||||||
$array['email_templates'][$x]['template_body'] .= "\${fax_file_warning}<br>";
|
$array['email_templates'][$x]['template_body'] .= "\${fax_file_warning}<br>";
|
||||||
|
$array['email_templates'][$x]['template_body'] .= "\${fax_file_message}<br>";
|
||||||
$array['email_templates'][$x]['template_body'] .= "</body>\n";
|
$array['email_templates'][$x]['template_body'] .= "</body>\n";
|
||||||
$array['email_templates'][$x]['template_body'] .= "</html>\n";
|
$array['email_templates'][$x]['template_body'] .= "</html>\n";
|
||||||
$array['email_templates'][$x]['template_type'] = "html";
|
$array['email_templates'][$x]['template_type'] = "html";
|
||||||
|
|
@ -139,6 +141,7 @@
|
||||||
$array['email_templates'][$x]['template_body'] .= "Nebenstelle: \${fax_extension}<br>";
|
$array['email_templates'][$x]['template_body'] .= "Nebenstelle: \${fax_extension}<br>";
|
||||||
$array['email_templates'][$x]['template_body'] .= "Nachrichten: \${fax_messages} <br>";
|
$array['email_templates'][$x]['template_body'] .= "Nachrichten: \${fax_messages} <br>";
|
||||||
$array['email_templates'][$x]['template_body'] .= "\${fax_file_warning}<br>";
|
$array['email_templates'][$x]['template_body'] .= "\${fax_file_warning}<br>";
|
||||||
|
$array['email_templates'][$x]['template_body'] .= "\${fax_file_message}<br>";
|
||||||
$array['email_templates'][$x]['template_body'] .= "</body>\n";
|
$array['email_templates'][$x]['template_body'] .= "</body>\n";
|
||||||
$array['email_templates'][$x]['template_body'] .= "</html>\n";
|
$array['email_templates'][$x]['template_body'] .= "</html>\n";
|
||||||
$array['email_templates'][$x]['template_type'] = "html";
|
$array['email_templates'][$x]['template_type'] = "html";
|
||||||
|
|
|
||||||
|
|
@ -5096,4 +5096,56 @@ $text['fax-active_status_fail']['zh-cn'] = "失败";
|
||||||
$text['fax-active_status_fail']['ja-jp'] = "失敗";
|
$text['fax-active_status_fail']['ja-jp'] = "失敗";
|
||||||
$text['fax-active_status_fail']['ko-kr'] = "실패하다";
|
$text['fax-active_status_fail']['ko-kr'] = "실패하다";
|
||||||
|
|
||||||
?>
|
$text['option-attachment']['en-us'] = "Attachment";
|
||||||
|
$text['option-attachment']['en-gb'] = "Attachment";
|
||||||
|
$text['option-attachment']['ar-eg'] = "مرفق";
|
||||||
|
$text['option-attachment']['de-at'] = "Anhang";
|
||||||
|
$text['option-attachment']['de-ch'] = "Anhang";
|
||||||
|
$text['option-attachment']['de-de'] = "Anhang";
|
||||||
|
$text['option-attachment']['el-gr'] = "Επισύναψη";
|
||||||
|
$text['option-attachment']['es-cl'] = "Adjunto";
|
||||||
|
$text['option-attachment']['es-mx'] = "Adjunto";
|
||||||
|
$text['option-attachment']['fr-ca'] = "Pièce Jointe";
|
||||||
|
$text['option-attachment']['fr-fr'] = "Pièce Jointe";
|
||||||
|
$text['option-attachment']['he-il'] = "הִתקַשְׁרוּת";
|
||||||
|
$text['option-attachment']['it-it'] = "Attaccamento";
|
||||||
|
$text['option-attachment']['nl-nl'] = "Toevoeging";
|
||||||
|
$text['option-attachment']['pl-pl'] = "Załącznik";
|
||||||
|
$text['option-attachment']['pt-br'] = "Anexo";
|
||||||
|
$text['option-attachment']['pt-pt'] = "Anexo";
|
||||||
|
$text['option-attachment']['ro-ro'] = "Atașament";
|
||||||
|
$text['option-attachment']['ru-ru'] = "Вложение";
|
||||||
|
$text['option-attachment']['sv-se'] = "Anknytning";
|
||||||
|
$text['option-attachment']['uk-ua'] = "вкладення";
|
||||||
|
$text['option-attachment']['tr-tr'] = "EK";
|
||||||
|
$text['option-attachment']['zh-cn'] = "依恋";
|
||||||
|
$text['option-attachment']['ja-jp'] = "付属品";
|
||||||
|
$text['option-attachment']['ko-kr'] = "부착";
|
||||||
|
|
||||||
|
$text['option-download_link']['en-us'] = "Download Link (Login Required)";
|
||||||
|
$text['option-download_link']['en-gb'] = "Download Link (Login Required)";
|
||||||
|
$text['option-download_link']['ar-eg'] = "رابط التحميل (يتطلب تسجيل الدخول)";
|
||||||
|
$text['option-download_link']['de-at'] = "Download-Link (Anmeldung erforderlich)";
|
||||||
|
$text['option-download_link']['de-ch'] = "Download-Link (Anmeldung erforderlich)";
|
||||||
|
$text['option-download_link']['de-de'] = "Download-Link (Anmeldung erforderlich)";
|
||||||
|
$text['option-download_link']['el-gr'] = "Σύνδεσμος λήψης (Απαιτείται σύνδεση)";
|
||||||
|
$text['option-download_link']['es-cl'] = "Enlace de descarga (se requiere iniciar sesión)";
|
||||||
|
$text['option-download_link']['es-mx'] = "Enlace de descarga (se requiere iniciar sesión)";
|
||||||
|
$text['option-download_link']['fr-ca'] = "Lien de téléchargement (connexion requise)";
|
||||||
|
$text['option-download_link']['fr-fr'] = "Lien de téléchargement (connexion requise)";
|
||||||
|
$text['option-download_link']['he-il'] = "קישור להורדה (נדרשת כניסה)";
|
||||||
|
$text['option-download_link']['it-it'] = "Link per il download (richiesto login)";
|
||||||
|
$text['option-download_link']['nl-nl'] = "Downloadlink (inloggen vereist)";
|
||||||
|
$text['option-download_link']['pl-pl'] = "Link do pobrania (wymagane zalogowanie)";
|
||||||
|
$text['option-download_link']['pt-br'] = "Link para download (é necessário fazer login)";
|
||||||
|
$text['option-download_link']['pt-pt'] = "Link para download (login necessário)";
|
||||||
|
$text['option-download_link']['ro-ro'] = "Link de descărcare (autentificare obligatorie)";
|
||||||
|
$text['option-download_link']['ru-ru'] = "Ссылка для скачивания (требуется вход в систему)";
|
||||||
|
$text['option-download_link']['sv-se'] = "Nedladdningslänk (inloggning krävs)";
|
||||||
|
$text['option-download_link']['uk-ua'] = "Посилання для завантаження (потрібно ввійти)";
|
||||||
|
$text['option-download_link']['tr-tr'] = "İndirme Bağlantısı (Giriş Gereklidir)";
|
||||||
|
$text['option-download_link']['zh-cn'] = "下载链接(需要登录)";
|
||||||
|
$text['option-download_link']['ja-jp'] = "ダウンロードリンク(ログインが必要です)";
|
||||||
|
$text['option-download_link']['ko-kr'] = "다운로드 링크 (로그인 필요)";
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
@ -119,6 +119,7 @@
|
||||||
$fax_destination_number = $_POST["fax_destination_number"];
|
$fax_destination_number = $_POST["fax_destination_number"];
|
||||||
$fax_prefix = $_POST["fax_prefix"];
|
$fax_prefix = $_POST["fax_prefix"];
|
||||||
$fax_email = implode(',',array_filter($_POST["fax_email"] ?? []));
|
$fax_email = implode(',',array_filter($_POST["fax_email"] ?? []));
|
||||||
|
$fax_file = $_POST["fax_file"];
|
||||||
$fax_email_connection_type = $_POST["fax_email_connection_type"];
|
$fax_email_connection_type = $_POST["fax_email_connection_type"];
|
||||||
$fax_email_connection_host = $_POST["fax_email_connection_host"];
|
$fax_email_connection_host = $_POST["fax_email_connection_host"];
|
||||||
$fax_email_connection_port = $_POST["fax_email_connection_port"];
|
$fax_email_connection_port = $_POST["fax_email_connection_port"];
|
||||||
|
|
@ -332,6 +333,7 @@
|
||||||
$array['fax'][0]['fax_name'] = $fax_name;
|
$array['fax'][0]['fax_name'] = $fax_name;
|
||||||
if (permission_exists('fax_email')) {
|
if (permission_exists('fax_email')) {
|
||||||
$array['fax'][0]['fax_email'] = $fax_email;
|
$array['fax'][0]['fax_email'] = $fax_email;
|
||||||
|
$array['fax'][0]['fax_file'] = $fax_file;
|
||||||
}
|
}
|
||||||
if (permission_exists('fax_caller_id_name')) {
|
if (permission_exists('fax_caller_id_name')) {
|
||||||
$array['fax'][0]['fax_caller_id_name'] = $fax_caller_id_name;
|
$array['fax'][0]['fax_caller_id_name'] = $fax_caller_id_name;
|
||||||
|
|
@ -426,6 +428,7 @@
|
||||||
$fax_prefix = $row["fax_prefix"];
|
$fax_prefix = $row["fax_prefix"];
|
||||||
$fax_name = $row["fax_name"];
|
$fax_name = $row["fax_name"];
|
||||||
$fax_email = $row["fax_email"];
|
$fax_email = $row["fax_email"];
|
||||||
|
$fax_file = $row["fax_file"];
|
||||||
$fax_caller_id_name = $row["fax_caller_id_name"];
|
$fax_caller_id_name = $row["fax_caller_id_name"];
|
||||||
$fax_caller_id_number = $row["fax_caller_id_number"];
|
$fax_caller_id_number = $row["fax_caller_id_number"];
|
||||||
$fax_toll_allow = $row["fax_toll_allow"];
|
$fax_toll_allow = $row["fax_toll_allow"];
|
||||||
|
|
@ -602,7 +605,7 @@
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
echo "<table border='0' cellpadding='2' cellspacing='0'>\n";
|
echo "<table border='0' cellpadding='2' cellspacing='0'>\n";
|
||||||
$x = 0;
|
$x = 0;
|
||||||
foreach($fax_emails as $email) {
|
foreach ($fax_emails as $email) {
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo "<td>\n";
|
echo "<td>\n";
|
||||||
echo " <input class='formfld' type=\"text\" name=\"fax_email[".$x."]\" maxlength='255' style=\"width: 90%;\"value=\"".escape($email)."\">\n";
|
echo " <input class='formfld' type=\"text\" name=\"fax_email[".$x."]\" maxlength='255' style=\"width: 90%;\"value=\"".escape($email)."\">\n";
|
||||||
|
|
@ -618,6 +621,20 @@
|
||||||
echo " ".$text['description-email']."\n";
|
echo " ".$text['description-email']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
echo " ".($text['label-email_fax_file'] ?? 'Fax File')."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td class='vtable' align='left'>\n";
|
||||||
|
echo " <select class='formfld' name='fax_file' id='fax_file'>\n";
|
||||||
|
echo " <option value='attach' ".(empty($fax_file) || $fax_fax_file == 'attach' ? "selected='selected'" : null).">".$text['option-attachment']."</option>\n";
|
||||||
|
echo " <option value='link' ".($fax_file == "link" ? "selected='selected'" : null).">".$text['option-download_link']."</option>\n";
|
||||||
|
echo " </select>\n";
|
||||||
|
echo "<br />\n";
|
||||||
|
echo ($text['description-email_fax_file'] ?? 'Select a fax file option.')."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permission_exists('fax_caller_id_name')) {
|
if (permission_exists('fax_caller_id_name')) {
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//download the fax
|
//download the fax
|
||||||
if (isset($fax_dir) && !empty($_GET['a']) && $_GET['a'] == "download") {
|
if (isset($fax_dir) && !empty($_GET['a']) && ($_GET['a'] == "download" || $_GET['a'] == 'download_link')) {
|
||||||
|
|
||||||
//sanitize the values that are used in the file name and path
|
//sanitize the values that are used in the file name and path
|
||||||
$fax_extension = preg_replace('/[^0-9]/', '', $_GET['ext']);
|
$fax_extension = preg_replace('/[^0-9]/', '', $_GET['ext']);
|
||||||
|
|
@ -158,6 +158,7 @@
|
||||||
$fax->order_by = $_GET['order_by'] ?? '';
|
$fax->order_by = $_GET['order_by'] ?? '';
|
||||||
$fax->order = $_GET['order'] ?? '';
|
$fax->order = $_GET['order'] ?? '';
|
||||||
$fax->box = $_GET['box'] ?? '';
|
$fax->box = $_GET['box'] ?? '';
|
||||||
|
$fax->download = $_GET['a'] == 'download_link' ? true : false;
|
||||||
$fax->fax_file_toggle($fax_files);
|
$fax->fax_file_toggle($fax_files);
|
||||||
unset($fax, $fax_files);
|
unset($fax, $fax_files);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ if (!class_exists('fax')) {
|
||||||
public $box;
|
public $box;
|
||||||
public $order_by;
|
public $order_by;
|
||||||
public $order;
|
public $order;
|
||||||
|
public $download;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* declare private variables
|
* declare private variables
|
||||||
|
|
@ -668,11 +669,13 @@ if (!class_exists('fax')) {
|
||||||
$text = $language->get();
|
$text = $language->get();
|
||||||
|
|
||||||
//validate the token
|
//validate the token
|
||||||
$token = new token;
|
if (empty($this->download) || $this->download == false) {
|
||||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
$token = new token;
|
||||||
message::add($text['message-invalid_token'],'negative');
|
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||||
header('Location: fax_files.php?order_by='.urlencode($this->order_by).'&order='.urlencode($this->order).'&id='.urlencode($this->fax_uuid).'&box='.urlencode($this->box));
|
message::add($text['message-invalid_token'],'negative');
|
||||||
exit;
|
header('Location: fax_files.php?order_by='.urlencode($this->order_by).'&order='.urlencode($this->order).'&id='.urlencode($this->fax_uuid).'&box='.urlencode($this->box));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//toggle multiple records
|
//toggle multiple records
|
||||||
|
|
|
||||||
|
|
@ -214,28 +214,6 @@
|
||||||
fax_file_name = array[count(array)];
|
fax_file_name = array[count(array)];
|
||||||
end
|
end
|
||||||
|
|
||||||
--fax to email
|
|
||||||
cmd = quote(shell_esc(php_dir).."/"..shell_esc(php_bin)).." "..quote(shell_esc(document_root).."/secure/fax_to_email.php").." ";
|
|
||||||
cmd = cmd .. "email="..quote(shell_esc(fax_email)).." ";
|
|
||||||
cmd = cmd .. "extension="..quote(shell_esc(fax_extension)).." ";
|
|
||||||
cmd = cmd .. "name="..quote(shell_esc(fax_file)).." ";
|
|
||||||
cmd = cmd .. "messages=" .. quote("result:"..shell_esc(fax_result_text).." sender:"..shell_esc(fax_remote_station_id).." pages:"..shell_esc(fax_document_total_pages)).." ";
|
|
||||||
cmd = cmd .. "domain="..quote(shell_esc(domain_name)).." ";
|
|
||||||
cmd = cmd .. "caller_id_name=" .. quote(shell_esc(caller_id_name) or '') .. " ";
|
|
||||||
cmd = cmd .. "caller_id_number=" .. quote(shell_esc(caller_id_number) or '') .. " ";
|
|
||||||
if #fax_forward_number > 0 then
|
|
||||||
cmd = cmd .. "fax_relay=true ";
|
|
||||||
else
|
|
||||||
cmd = cmd .. "fax_relay=false ";
|
|
||||||
end
|
|
||||||
if #fax_prefix > 0 then
|
|
||||||
cmd = cmd .. "fax_prefix=true ";
|
|
||||||
else
|
|
||||||
cmd = cmd .. "fax_prefix=false ";
|
|
||||||
end
|
|
||||||
freeswitch.consoleLog("notice", "[fax] command: " .. cmd .. "\n");
|
|
||||||
os.execute(cmd);
|
|
||||||
|
|
||||||
--add to fax logs
|
--add to fax logs
|
||||||
sql = "insert into v_fax_logs ";
|
sql = "insert into v_fax_logs ";
|
||||||
sql = sql .. "(";
|
sql = sql .. "(";
|
||||||
|
|
@ -421,6 +399,29 @@
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--fax to email
|
||||||
|
cmd = quote(shell_esc(php_dir).."/"..shell_esc(php_bin)).." "..quote(shell_esc(document_root).."/secure/fax_to_email.php").." ";
|
||||||
|
cmd = cmd .. "email="..quote(shell_esc(fax_email)).." ";
|
||||||
|
cmd = cmd .. "extension="..quote(shell_esc(fax_extension)).." ";
|
||||||
|
cmd = cmd .. "name="..quote(shell_esc(fax_file)).." ";
|
||||||
|
cmd = cmd .. "messages=" .. quote("Result: "..shell_esc(fax_result_text)..", Sender: "..shell_esc(fax_remote_station_id)..", Pages:"..shell_esc(fax_document_total_pages)).." ";
|
||||||
|
cmd = cmd .. "domain="..quote(shell_esc(domain_name)).." ";
|
||||||
|
cmd = cmd .. "caller_id_name=" .. quote(shell_esc(caller_id_name) or '') .. " ";
|
||||||
|
cmd = cmd .. "caller_id_number=" .. quote(shell_esc(caller_id_number) or '') .. " ";
|
||||||
|
cmd = cmd .. "fax_file_uuid=" .. quote(shell_esc(uuid)) .. " ";
|
||||||
|
if #fax_forward_number > 0 then
|
||||||
|
cmd = cmd .. "fax_relay=true ";
|
||||||
|
else
|
||||||
|
cmd = cmd .. "fax_relay=false ";
|
||||||
|
end
|
||||||
|
if #fax_prefix > 0 then
|
||||||
|
cmd = cmd .. "fax_prefix=true ";
|
||||||
|
else
|
||||||
|
cmd = cmd .. "fax_prefix=false ";
|
||||||
|
end
|
||||||
|
freeswitch.consoleLog("notice", "[fax] command: " .. cmd .. "\n");
|
||||||
|
os.execute(cmd);
|
||||||
|
|
||||||
--add to the fax queue when the fax_forward_number is set
|
--add to the fax queue when the fax_forward_number is set
|
||||||
if (fax_forward_number ~= nil) then
|
if (fax_forward_number ~= nil) then
|
||||||
sql = "insert into v_fax_queue ";
|
sql = "insert into v_fax_queue ";
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,7 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
case 'fax_extension':
|
case 'fax_extension':
|
||||||
case 'debug_level':
|
case 'debug_level':
|
||||||
case 'config_file':
|
case 'config_file':
|
||||||
|
case 'fax_file_uuid':
|
||||||
//tansform the name of the key into the name of the variable using $$
|
//tansform the name of the key into the name of the variable using $$
|
||||||
$$key = $value;
|
$$key = $value;
|
||||||
break;
|
break;
|
||||||
|
|
@ -323,7 +324,7 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
//ensure we have a domain_uuid
|
//ensure we have a domain_uuid
|
||||||
if (empty($domain_uuid)) {
|
if (empty($domain_uuid)) {
|
||||||
exit("Domain '$domain_name' not found\n");
|
exit("Domain '$domain_name' not found\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//ensure we have a fax extension
|
//ensure we have a fax extension
|
||||||
if (empty($fax_extension)) {
|
if (empty($fax_extension)) {
|
||||||
|
|
@ -346,6 +347,7 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
$row = $database->select($sql, $parameters, 'row');
|
$row = $database->select($sql, $parameters, 'row');
|
||||||
if (is_array($row) && @sizeof($row) != 0) {
|
if (is_array($row) && @sizeof($row) != 0) {
|
||||||
$fax_email = $row["fax_email"];
|
$fax_email = $row["fax_email"];
|
||||||
|
$fax_email_file = $row["fax_file"];
|
||||||
$fax_uuid = $row["fax_uuid"];
|
$fax_uuid = $row["fax_uuid"];
|
||||||
$fax_accountcode = $row["fax_accountcode"];
|
$fax_accountcode = $row["fax_accountcode"];
|
||||||
$fax_prefix = $row["fax_prefix"];
|
$fax_prefix = $row["fax_prefix"];
|
||||||
|
|
@ -451,7 +453,7 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//get the email template from the database
|
//get the email template from the database
|
||||||
if (!empty($fax_email) && !empty($domain_uuid)) {
|
if (!empty($domain_uuid)) {
|
||||||
$sql = "select template_subject, template_body from v_email_templates ";
|
$sql = "select template_subject, template_body from v_email_templates ";
|
||||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||||
$sql .= "and template_language = :template_language ";
|
$sql .= "and template_language = :template_language ";
|
||||||
|
|
@ -470,37 +472,40 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
$email_body = $row['template_body'];
|
$email_body = $row['template_body'];
|
||||||
}
|
}
|
||||||
unset($sql, $parameters);
|
unset($sql, $parameters);
|
||||||
}
|
|
||||||
|
|
||||||
//replace variables in email subject
|
//replace variables in email subject
|
||||||
$email_subject = str_replace('${domain_name}', $domain_name, $email_subject);
|
$email_subject = str_replace('${domain_name}', $domain_name, $email_subject);
|
||||||
$email_subject = str_replace('${fax_file_name}', $fax_file_name, $email_subject);
|
$email_subject = str_replace('${fax_file_name}', $fax_file_name, $email_subject);
|
||||||
$email_subject = str_replace('${fax_extension}', $fax_extension, $email_subject);
|
$email_subject = str_replace('${fax_extension}', $fax_extension, $email_subject);
|
||||||
$email_subject = str_replace('${fax_messages}', $fax_messages, $email_subject);
|
$email_subject = str_replace('${fax_messages}', $fax_messages, $email_subject);
|
||||||
$email_subject = str_replace('${fax_file_warning}', $fax_file_warning, $email_subject);
|
$email_subject = str_replace('${fax_file_warning}', $fax_file_warning, $email_subject);
|
||||||
$email_subject = str_replace('${fax_subject_tag}', $fax_email_inbound_subject_tag, $email_subject);
|
$email_subject = str_replace('${fax_subject_tag}', $fax_email_inbound_subject_tag, $email_subject);
|
||||||
|
|
||||||
//replace variables in email body
|
//replace variables in email body
|
||||||
$email_body = str_replace('${domain_name}', $domain_name, $email_body);
|
$email_body = str_replace('${domain_name}', $domain_name, $email_body);
|
||||||
$email_body = str_replace('${fax_file_name}', $fax_file_name, $email_body);
|
$email_body = str_replace('${fax_file_name}', $fax_file_name, $email_body);
|
||||||
$email_body = str_replace('${fax_extension}', $fax_extension, $email_body);
|
$email_body = str_replace('${fax_extension}', $fax_extension, $email_body);
|
||||||
$email_body = str_replace('${fax_messages}', $fax_messages, $email_body);
|
$email_body = str_replace('${fax_messages}', $fax_messages, $email_body);
|
||||||
$email_body = str_replace('${fax_file_warning}', $fax_file_warning, $email_body);
|
$email_body = str_replace('${fax_file_warning}', $fax_file_warning, $email_body);
|
||||||
$email_body = str_replace('${fax_subject_tag}', $fax_email_inbound_subject_tag, $email_body);
|
$email_body = str_replace('${fax_subject_tag}', $fax_email_inbound_subject_tag, $email_body);
|
||||||
|
if ($fax_email_file == 'link') {
|
||||||
|
$email_body = str_replace('${fax_file_message}', "<a href='https://".$domain_name.PROJECT_PATH.'/app/fax/fax_files.php?id='.$fax_uuid.'&fax_file_uuid='.$fax_file_uuid.'&a=download_link&type=fax_inbox&box=inbox&ext='.$fax_extension.'&filename='.urlencode($fax_file_name).(!empty($pdf_file) && file_exists($pdf_file) ? '.pdf' : '.tif')."'>".($text['label-fax_download'] ?? 'Download Fax')."</a>", $email_body);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$email_body = str_replace('${fax_file_message}', ($text['label-fax_attached'] ?? 'Fax Attached'), $email_body);
|
||||||
|
}
|
||||||
|
|
||||||
//debug info
|
//debug info
|
||||||
//echo "<hr />\n";
|
//echo "<hr />\n";
|
||||||
//echo "email_address ".$fax_email."<br />\n";
|
//echo "email_address ".$fax_email."<br />\n";
|
||||||
//echo "email_subject ".$email_subject."<br />\n";
|
//echo "email_subject ".$email_subject."<br />\n";
|
||||||
//echo "email_body ".$email_body."<br />\n";
|
//echo "email_body ".$email_body."<br />\n";
|
||||||
//echo "<hr />\n";
|
//echo "<hr />\n";
|
||||||
|
|
||||||
//send the email
|
|
||||||
if (isset($fax_email) && !empty($fax_email)) {
|
|
||||||
//add the attachment
|
//add the attachment
|
||||||
if (!empty($fax_file_name)) {
|
if (!empty($fax_file_name) && $fax_email_file != 'link') {
|
||||||
$email_attachments[0]['type'] = 'file';
|
$email_attachments[0]['type'] = 'file';
|
||||||
if ($pdf_file && file_exists($pdf_file)) {
|
if (!empty($pdf_file) && file_exists($pdf_file)) {
|
||||||
$email_attachments[0]['name'] = $fax_file_name.'.pdf';
|
$email_attachments[0]['name'] = $fax_file_name.'.pdf';
|
||||||
$email_attachments[0]['value'] = $pdf_file;
|
$email_attachments[0]['value'] = $pdf_file;
|
||||||
}
|
}
|
||||||
|
|
@ -510,14 +515,16 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//$email_response = send_email($email_address, $email_subject, $email_body);
|
//send the email
|
||||||
$email = new email;
|
$email = new email;
|
||||||
$email->recipients = $fax_email;
|
$email->recipients = $fax_email;
|
||||||
$email->subject = $email_subject;
|
$email->subject = $email_subject;
|
||||||
$email->body = $email_body;
|
$email->body = $email_body;
|
||||||
$email->from_address = $email_from_address;
|
$email->from_address = $email_from_address;
|
||||||
$email->from_name = $email_from_name;
|
$email->from_name = $email_from_name;
|
||||||
$email->attachments = $email_attachments;
|
if ($fax_email_file != 'link') {
|
||||||
|
$email->attachments = $email_attachments;
|
||||||
|
}
|
||||||
//$email->debug_level = 3;
|
//$email->debug_level = 3;
|
||||||
$response = $mail->error;
|
$response = $mail->error;
|
||||||
$sent = $email->send();
|
$sent = $email->send();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue