Fax Server - Fax to Email: Fix population of cover page labels.
This commit is contained in:
parent
aae7cbdc5a
commit
15cad2369c
|
|
@ -266,8 +266,7 @@ if (!empty($result) && @sizeof($result) != 0) {
|
||||||
|
|
||||||
//send fax
|
//send fax
|
||||||
$cwd = getcwd();
|
$cwd = getcwd();
|
||||||
$included = true;
|
require "fax_send.php";
|
||||||
require("fax_send.php");
|
|
||||||
if($cwd){
|
if($cwd){
|
||||||
chdir($cwd);
|
chdir($cwd);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,19 @@
|
||||||
Corey Moullas <cmoullas@emak.tech>
|
Corey Moullas <cmoullas@emak.tech>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//set included to boolean
|
|
||||||
if (!isset($included)) { $included = false; }
|
|
||||||
|
|
||||||
//check if windows
|
//check if windows
|
||||||
if (stristr(PHP_OS, 'WIN')) { $IS_WINDOWS = true; } else { $IS_WINDOWS = false; }
|
if (stristr(PHP_OS, 'WIN')) { $IS_WINDOWS = true; } else { $IS_WINDOWS = false; }
|
||||||
|
|
||||||
//send email through browser
|
//executed via command line
|
||||||
if (!$included) {
|
if (defined('STDIN')) {
|
||||||
|
|
||||||
|
//add multi-lingual support
|
||||||
|
$language = new text;
|
||||||
|
$text = $language->get($setting->get('domain','language','en-us'), 'app/fax');
|
||||||
|
|
||||||
|
}
|
||||||
|
//executed via browser
|
||||||
|
else {
|
||||||
|
|
||||||
//includes files
|
//includes files
|
||||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||||
|
|
@ -124,6 +129,7 @@ if (!$included) {
|
||||||
$fax_cover_font = $setting->get('fax','cover_font') ?? null;
|
$fax_cover_font = $setting->get('fax','cover_font') ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//define function correct_path
|
||||||
if (!function_exists('correct_path')) {
|
if (!function_exists('correct_path')) {
|
||||||
function correct_path($p) {
|
function correct_path($p) {
|
||||||
global $IS_WINDOWS;
|
global $IS_WINDOWS;
|
||||||
|
|
@ -206,7 +212,7 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
|
|
||||||
//send the fax
|
//send the fax
|
||||||
$continue = false;
|
$continue = false;
|
||||||
if (!$included) {
|
if (!defined('STDIN')) {
|
||||||
if (!empty($_POST['action']) && $_POST['action'] == "send" && $domain_enabled == true) {
|
if (!empty($_POST['action']) && $_POST['action'] == "send" && $domain_enabled == true) {
|
||||||
//get the values from the HTTP POST
|
//get the values from the HTTP POST
|
||||||
$fax_numbers = $_POST['fax_numbers'];
|
$fax_numbers = $_POST['fax_numbers'];
|
||||||
|
|
@ -300,10 +306,10 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
|
|
||||||
//process uploaded or emailed files (if any)
|
//process uploaded or emailed files (if any)
|
||||||
$fax_page_count = 0;
|
$fax_page_count = 0;
|
||||||
$_files = (!$included) ? $_FILES['fax_files'] : $emailed_files;
|
$_files = (!defined('STDIN')) ? $_FILES['fax_files'] : $emailed_files;
|
||||||
unset($tif_files);
|
unset($tif_files);
|
||||||
foreach ($_files['tmp_name'] as $index => $fax_tmp_name) {
|
foreach ($_files['tmp_name'] as $index => $fax_tmp_name) {
|
||||||
$uploaded_file = (!$included) ? is_uploaded_file($fax_tmp_name) : true;
|
$uploaded_file = (!defined('STDIN')) ? is_uploaded_file($fax_tmp_name) : true;
|
||||||
if ( $uploaded_file && $_files['error'][$index] == 0 && $_files['size'][$index] > 0 ) {
|
if ( $uploaded_file && $_files['error'][$index] == 0 && $_files['size'][$index] > 0 ) {
|
||||||
//get the file extension
|
//get the file extension
|
||||||
$fax_file_extension = strtolower(pathinfo($_files['name'][$index], PATHINFO_EXTENSION));
|
$fax_file_extension = strtolower(pathinfo($_files['name'][$index], PATHINFO_EXTENSION));
|
||||||
|
|
@ -323,7 +329,7 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
}
|
}
|
||||||
unset($attachment_file_name);
|
unset($attachment_file_name);
|
||||||
|
|
||||||
if (!$included) {
|
if (!defined('STDIN')) {
|
||||||
//check if directory exists
|
//check if directory exists
|
||||||
if (!is_dir($dir_fax_temp)) {
|
if (!is_dir($dir_fax_temp)) {
|
||||||
mkdir($dir_fax_temp, 0770);
|
mkdir($dir_fax_temp, 0770);
|
||||||
|
|
@ -490,9 +496,8 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
//field values
|
//field values
|
||||||
$pdf->SetFont($pdf_font, "", 12);
|
$pdf->SetFont($pdf_font, "", 12);
|
||||||
$pdf->SetXY($x + 2.0, $y + 1.65);
|
$pdf->SetXY($x + 2.0, $y + 1.65);
|
||||||
if ($_REQUEST['submit'] != '' && $_REQUEST['submit'] != 'preview') {
|
if (defined('STDIN') || ($_REQUEST['submit'] != '' && $_REQUEST['submit'] != 'preview')) {
|
||||||
$time_zone = isset($_SESSION['domain']['time_zone']['name']) ? $_SESSION['domain']['time_zone']['name'] : date_default_timezone_get();
|
$date = new DateTime('now', new DateTimeZone( $setting->get('domain','time_zone', date_default_timezone_get() ) ));
|
||||||
$date = new DateTime('now', new DateTimeZone($time_zone) );
|
|
||||||
$pdf->Write(0.3, $date->format('d M Y @ h:i:s A'));
|
$pdf->Write(0.3, $date->format('d M Y @ h:i:s A'));
|
||||||
}
|
}
|
||||||
$pdf->SetXY($x + 2.0, $y + 1.95);
|
$pdf->SetXY($x + 2.0, $y + 1.95);
|
||||||
|
|
@ -624,7 +629,7 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
@unlink($tif_file);
|
@unlink($tif_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (!$included) {
|
elseif (!defined('STDIN')) {
|
||||||
//nothing to send, redirect the browser
|
//nothing to send, redirect the browser
|
||||||
message::add($text['message-invalid-fax'], 'negative', 4000);
|
message::add($text['message-invalid-fax'], 'negative', 4000);
|
||||||
header("Location: fax_send.php?id=".$fax_uuid);
|
header("Location: fax_send.php?id=".$fax_uuid);
|
||||||
|
|
@ -703,13 +708,10 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
unset($row);
|
unset($row);
|
||||||
|
|
||||||
//for email to fax send email notification back to the email sender
|
//for email to fax send email notification back to the email sender
|
||||||
if ($included) {
|
if (defined('STDIN')) {
|
||||||
//use email-to-fax from address
|
//use email-to-fax from address
|
||||||
$mail_to_address = $sender_email;
|
$mail_to_address = $sender_email;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
//send fax through the browser
|
|
||||||
}
|
|
||||||
|
|
||||||
//move the generated tif (and pdf) files to the sent directory
|
//move the generated tif (and pdf) files to the sent directory
|
||||||
//if (file_exists($dir_fax_temp.'/'.$fax_instance_uuid.".tif")) {
|
//if (file_exists($dir_fax_temp.'/'.$fax_instance_uuid.".tif")) {
|
||||||
|
|
@ -852,7 +854,7 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//redirect the browser
|
//redirect the browser
|
||||||
if (!$included && is_uuid($fax_uuid)) {
|
if (!defined('STDIN') && is_uuid($fax_uuid)) {
|
||||||
header("Location: fax_files.php?id=".$fax_uuid."&box=sent");
|
header("Location: fax_files.php?id=".$fax_uuid."&box=sent");
|
||||||
//header("Location: fax_outbox.php?id=".$fax_uuid);
|
//header("Location: fax_outbox.php?id=".$fax_uuid);
|
||||||
exit;
|
exit;
|
||||||
|
|
@ -862,7 +864,7 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
|
|
||||||
|
|
||||||
//show content in the browser
|
//show content in the browser
|
||||||
if (!$included) {
|
if (!defined('STDIN')) {
|
||||||
|
|
||||||
//retrieve current user's assigned groups (uuids)
|
//retrieve current user's assigned groups (uuids)
|
||||||
foreach ($_SESSION['groups'] as $group_data) {
|
foreach ($_SESSION['groups'] as $group_data) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue