mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Update fax send to use empty
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
if (stristr(PHP_OS, 'WIN')) { $IS_WINDOWS = true; } else { $IS_WINDOWS = false; }
|
if (stristr(PHP_OS, 'WIN')) { $IS_WINDOWS = true; } else { $IS_WINDOWS = false; }
|
||||||
|
|
||||||
//command line
|
//command line
|
||||||
if (defined('STDIN')) {
|
if (defined('STDIN')) {
|
||||||
|
|
||||||
//add multi-lingual support
|
//add multi-lingual support
|
||||||
$language = new text;
|
$language = new text;
|
||||||
@@ -250,8 +250,8 @@ if (!function_exists('fax_split_dtmf')) {
|
|||||||
fax_split_dtmf($fax_number, $fax_dtmf);
|
fax_split_dtmf($fax_number, $fax_dtmf);
|
||||||
$fax_number = preg_replace("~[^0-9]~", "", $fax_number);
|
$fax_number = preg_replace("~[^0-9]~", "", $fax_number);
|
||||||
$fax_dtmf = preg_replace("~[^0-9Pp*#]~", "", $fax_dtmf);
|
$fax_dtmf = preg_replace("~[^0-9Pp*#]~", "", $fax_dtmf);
|
||||||
if ($fax_number != ''){
|
if (!empty($fax_number)){
|
||||||
if ($fax_dtmf != '') {$fax_number .= " (" . $fax_dtmf . ")";}
|
if (!empty($fax_dtmf)) {$fax_number .= " (" . $fax_dtmf . ")";}
|
||||||
$fax_numbers[$index] = $fax_number;
|
$fax_numbers[$index] = $fax_number;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -315,7 +315,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||||||
if ($fax_file_extension == "tiff") { $fax_file_extension = "tif"; }
|
if ($fax_file_extension == "tiff") { $fax_file_extension = "tif"; }
|
||||||
|
|
||||||
//block unauthorized files
|
//block unauthorized files
|
||||||
if (in_array($fax_file_extension, $disallowed_file_extensions) || $fax_file_extension == '') { continue; }
|
if (in_array($fax_file_extension, $disallowed_file_extensions) || empty($fax_file_extension)) { continue; }
|
||||||
if (is_array($allowed_file_extensions) && !in_array('.'.$fax_file_extension, $allowed_file_extensions)) { continue; }
|
if (is_array($allowed_file_extensions) && !in_array('.'.$fax_file_extension, $allowed_file_extensions)) { continue; }
|
||||||
|
|
||||||
//use a safe file name
|
//use a safe file name
|
||||||
@@ -360,8 +360,8 @@ if (!function_exists('fax_split_dtmf')) {
|
|||||||
//get the page count
|
//get the page count
|
||||||
$cmd = exec('which tiffinfo')." ".correct_path($dir_fax_temp.'/'.$fax_name).".tif | grep \"Page Number\" | grep -c \"P\"";
|
$cmd = exec('which tiffinfo')." ".correct_path($dir_fax_temp.'/'.$fax_name).".tif | grep \"Page Number\" | grep -c \"P\"";
|
||||||
// echo($cmd . "<br/>\n");
|
// echo($cmd . "<br/>\n");
|
||||||
$tif_page_count = exec($cmd);
|
$tif_page_count = intval(trim(exec($cmd)));
|
||||||
if ($tif_page_count != '') {
|
if ($tif_page_count > 0) {
|
||||||
$fax_page_count += $tif_page_count;
|
$fax_page_count += $tif_page_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||||||
$fax_instance_uuid = uuid();
|
$fax_instance_uuid = uuid();
|
||||||
|
|
||||||
//generate cover page, merge with pdf
|
//generate cover page, merge with pdf
|
||||||
if ($fax_subject != '' || $fax_message != '') {
|
if (!empty($fax_subject) || !empty($fax_message) ) {
|
||||||
|
|
||||||
//load pdf libraries
|
//load pdf libraries
|
||||||
require_once("resources/tcpdf/tcpdf.php");
|
require_once("resources/tcpdf/tcpdf.php");
|
||||||
@@ -412,7 +412,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||||||
if (empty($settings->get('fax','cover_logo'))) {
|
if (empty($settings->get('fax','cover_logo'))) {
|
||||||
$logo = ''; //explicitly empty
|
$logo = ''; //explicitly empty
|
||||||
}
|
}
|
||||||
else if ($settings->get('fax','cover_logo') != '') {
|
elseif (!empty($settings->get('fax','cover_logo'))) {
|
||||||
if (substr($settings->get('fax','cover_logo'), 0, 4) == 'http') {
|
if (substr($settings->get('fax','cover_logo'), 0, 4) == 'http') {
|
||||||
$logo = $settings->get('fax','cover_logo');
|
$logo = $settings->get('fax','cover_logo');
|
||||||
}
|
}
|
||||||
@@ -459,7 +459,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//header
|
//header
|
||||||
if ($fax_header != '') {
|
if (!empty($fax_header)) {
|
||||||
$pdf->SetLeftMargin(0.5);
|
$pdf->SetLeftMargin(0.5);
|
||||||
$pdf->SetFont($pdf_font, "", 10);
|
$pdf->SetFont($pdf_font, "", 10);
|
||||||
$pdf->Write(0.3, $fax_header);
|
$pdf->Write(0.3, $fax_header);
|
||||||
@@ -479,32 +479,32 @@ if (!function_exists('fax_split_dtmf')) {
|
|||||||
//field labels
|
//field labels
|
||||||
$pdf->SetFont($pdf_font, "B", 12);
|
$pdf->SetFont($pdf_font, "B", 12);
|
||||||
$pdf->Text($x + 0.5, $y + 1.7, strtoupper($text['label-sent']).":");
|
$pdf->Text($x + 0.5, $y + 1.7, strtoupper($text['label-sent']).":");
|
||||||
if ($fax_recipient != '' || sizeof($fax_numbers) > 0) {
|
if (!empty($fax_recipient) || sizeof($fax_numbers) > 0) {
|
||||||
$pdf->Text($x + 0.5, $y + 2.0, strtoupper($text['label-fax-recipient']).":");
|
$pdf->Text($x + 0.5, $y + 2.0, strtoupper($text['label-fax-recipient']).":");
|
||||||
}
|
}
|
||||||
if ($fax_sender != '' || $fax_caller_id_number != '') {
|
if (!empty($fax_sender) || !empty($fax_caller_id_number)) {
|
||||||
$pdf->Text($x + 0.5, $y + 2.3, strtoupper($text['label-fax-sender']).":");
|
$pdf->Text($x + 0.5, $y + 2.3, strtoupper($text['label-fax-sender']).":");
|
||||||
}
|
}
|
||||||
if ($fax_page_count > 0) {
|
if ($fax_page_count > 0) {
|
||||||
$pdf->Text($x + 0.5, $y + 2.6, strtoupper($text['label-fax-attached']).":");
|
$pdf->Text($x + 0.5, $y + 2.6, strtoupper($text['label-fax-attached']).":");
|
||||||
}
|
}
|
||||||
if ($fax_subject != '') {
|
if (!empty($fax_subject)) {
|
||||||
$pdf->Text($x + 0.5, $y + 2.9, strtoupper($text['label-fax-subject']).":");
|
$pdf->Text($x + 0.5, $y + 2.9, strtoupper($text['label-fax-subject']).":");
|
||||||
}
|
}
|
||||||
|
|
||||||
//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 (defined('STDIN') || ($_REQUEST['submit'] != '' && $_REQUEST['submit'] != 'preview')) {
|
if (defined('STDIN') || (!empty($_REQUEST['submit']) && $_REQUEST['submit'] != 'preview')) {
|
||||||
$date = new DateTime('now', new DateTimeZone( $settings->get('domain','time_zone', date_default_timezone_get() ) ));
|
$date = new DateTime('now', new DateTimeZone( $settings->get('domain','time_zone', date_default_timezone_get() ) ));
|
||||||
$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);
|
||||||
if ($fax_recipient != '') {
|
if (!empty($fax_recipient)) {
|
||||||
$pdf->Write(0.3, $fax_recipient);
|
$pdf->Write(0.3, $fax_recipient);
|
||||||
}
|
}
|
||||||
if (sizeof($fax_numbers) > 0) {
|
if (sizeof($fax_numbers) > 0) {
|
||||||
$fax_number_string = ($fax_recipient != '') ? ' (' : null;
|
$fax_number_string = (!empty($fax_recipient)) ? ' (' : null;
|
||||||
$fax_number_string .= format_phone($fax_numbers[0]);
|
$fax_number_string .= format_phone($fax_numbers[0]);
|
||||||
if (sizeof($fax_numbers) > 1) {
|
if (sizeof($fax_numbers) > 1) {
|
||||||
for ($n = 1; $n <= sizeof($fax_numbers); $n++) {
|
for ($n = 1; $n <= sizeof($fax_numbers); $n++) {
|
||||||
@@ -513,30 +513,30 @@ if (!function_exists('fax_split_dtmf')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fax_number_string .= (sizeof($fax_numbers) > 4) ? ', +'.(sizeof($fax_numbers) - 4) : null;
|
$fax_number_string .= (sizeof($fax_numbers) > 4) ? ', +'.(sizeof($fax_numbers) - 4) : null;
|
||||||
$fax_number_string .= ($fax_recipient != '') ? ')' : null;
|
$fax_number_string .= (!empty($fax_recipient)) ? ')' : null;
|
||||||
$pdf->Write(0.3, $fax_number_string);
|
$pdf->Write(0.3, $fax_number_string);
|
||||||
}
|
}
|
||||||
$pdf->SetXY($x + 2.0, $y + 2.25);
|
$pdf->SetXY($x + 2.0, $y + 2.25);
|
||||||
if ($fax_sender != '') {
|
if (!empty($fax_sender)) {
|
||||||
$pdf->Write(0.3, $fax_sender);
|
$pdf->Write(0.3, $fax_sender);
|
||||||
if ($fax_caller_id_number != '') {
|
if (!empty($fax_caller_id_number)) {
|
||||||
$pdf->Write(0.3, ' ('.format_phone($fax_caller_id_number).')');
|
$pdf->Write(0.3, ' ('.format_phone($fax_caller_id_number).')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($fax_caller_id_number != '') {
|
if (!empty($fax_caller_id_number)) {
|
||||||
$pdf->Write(0.3, format_phone($fax_caller_id_number));
|
$pdf->Write(0.3, format_phone($fax_caller_id_number));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($fax_page_count > 0) {
|
if ($fax_page_count > 0) {
|
||||||
$pdf->Text($x + 2.0, $y + 2.6, $fax_page_count.' '.$text['label-fax-page'.(($fax_page_count > 1) ? 's' : null)]);
|
$pdf->Text($x + 2.0, $y + 2.6, $fax_page_count.' '.$text['label-fax-page'.(($fax_page_count > 1) ? 's' : null)]);
|
||||||
}
|
}
|
||||||
if ($fax_subject != '') {
|
if (!empty($fax_subject)) {
|
||||||
$pdf->Text($x + 2.0, $y + 2.9, $fax_subject);
|
$pdf->Text($x + 2.0, $y + 2.9, $fax_subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
//message
|
//message
|
||||||
if ($fax_message != '') {
|
if (!empty($fax_message)) {
|
||||||
$pdf->SetAutoPageBreak(true, 0.6);
|
$pdf->SetAutoPageBreak(true, 0.6);
|
||||||
$pdf->SetTopMargin(0.6);
|
$pdf->SetTopMargin(0.6);
|
||||||
$pdf->SetFont($pdf_font, "", 12);
|
$pdf->SetFont($pdf_font, "", 12);
|
||||||
@@ -578,7 +578,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//footer
|
//footer
|
||||||
if ($fax_footer != '') {
|
if (!empty($fax_footer)) {
|
||||||
$pdf->SetAutoPageBreak(true, 0.6);
|
$pdf->SetAutoPageBreak(true, 0.6);
|
||||||
$pdf->SetTopMargin(0.6);
|
$pdf->SetTopMargin(0.6);
|
||||||
$pdf->SetFont("helvetica", "", 8);
|
$pdf->SetFont("helvetica", "", 8);
|
||||||
@@ -642,7 +642,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//preview, if requested
|
//preview, if requested
|
||||||
if (($_REQUEST['submit'] != '') && ($_REQUEST['submit'] == 'preview')) {
|
if (!empty($_REQUEST['submit']) && ($_REQUEST['submit'] == 'preview')) {
|
||||||
unset($file_type);
|
unset($file_type);
|
||||||
if (file_exists($dir_fax_sent.'/'.$fax_instance_uuid.'.pdf')) {
|
if (file_exists($dir_fax_sent.'/'.$fax_instance_uuid.'.pdf')) {
|
||||||
$file_path = $dir_fax_sent.'/'.$fax_instance_uuid.".pdf";
|
$file_path = $dir_fax_sent.'/'.$fax_instance_uuid.".pdf";
|
||||||
@@ -656,7 +656,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||||||
$content_type = 'image/tiff';
|
$content_type = 'image/tiff';
|
||||||
@unlink($dir_fax_sent.'/'.$fax_instance_uuid.".pdf");
|
@unlink($dir_fax_sent.'/'.$fax_instance_uuid.".pdf");
|
||||||
}
|
}
|
||||||
if ($file_type != '') {
|
if (!empty($file_type)) {
|
||||||
//push download
|
//push download
|
||||||
$fd = fopen($file_path, "rb");
|
$fd = fopen($file_path, "rb");
|
||||||
header("Content-Type: application/force-download");
|
header("Content-Type: application/force-download");
|
||||||
@@ -924,14 +924,14 @@ if (!defined('STDIN')) {
|
|||||||
//build the contact labels
|
//build the contact labels
|
||||||
if (is_array($contacts) && @sizeof($contacts) != 0) {
|
if (is_array($contacts) && @sizeof($contacts) != 0) {
|
||||||
foreach ($contacts as $row) {
|
foreach ($contacts as $row) {
|
||||||
if ($row['contact_organization'] != '') {
|
if (!empty($row['contact_organization'])) {
|
||||||
$contact_option_label = $row['contact_organization'];
|
$contact_option_label = $row['contact_organization'];
|
||||||
}
|
}
|
||||||
if ($row['contact_name_given'] != '' || $row['contact_name_family'] != '' || $row['contact_nickname'] != '') {
|
if (!empty($row['contact_name_given']) || !empty($row['contact_name_family']) || !empty($row['contact_nickname'])) {
|
||||||
$contact_option_label .= ($row['contact_organization'] != '') ? "," : null;
|
$contact_option_label .= (!empty($row['contact_organization'])) ? "," : null;
|
||||||
$contact_option_label .= ($row['contact_name_given'] != '') ? (($row['contact_organization'] != '') ? " " : null).$row['contact_name_given'] : null;
|
$contact_option_label .= (!empty($row['contact_name_given'])) ? (!empty($row['contact_organization']) ? " " : null).$row['contact_name_given'] : null;
|
||||||
$contact_option_label .= ($row['contact_name_family'] != '') ? (($row['contact_organization'] != '' || $row['contact_name_given'] != '') ? " " : null).$row['contact_name_family'] : null;
|
$contact_option_label .= (!empty($row['contact_name_family'])) ? (!empty($row['contact_organization']) || !empty($row['contact_name_given']) ? " " : null).$row['contact_name_family'] : null;
|
||||||
$contact_option_label .= ($row['contact_nickname'] != '') ? (($row['contact_organization'] != '' || $row['contact_name_given'] != '' || $row['contact_name_family'] != '') ? " (".$row['contact_nickname'].")" : $row['contact_nickname']) : null;
|
$contact_option_label .= (!empty($row['contact_nickname'])) ? (!empty($row['contact_organization']) || !empty($row['contact_name_given']) || !empty($row['contact_name_family']) ? " (".$row['contact_nickname'].")" : $row['contact_nickname']) : null;
|
||||||
}
|
}
|
||||||
$contact_option_value_recipient = $contact_option_label;
|
$contact_option_value_recipient = $contact_option_label;
|
||||||
$contact_option_value_faxnumber = $row['phone_number'];
|
$contact_option_value_faxnumber = $row['phone_number'];
|
||||||
@@ -1095,7 +1095,7 @@ if (!defined('STDIN')) {
|
|||||||
echo " ".$text['label-fax_files']."\n";
|
echo " ".$text['label-fax_files']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
|
|
||||||
$upload_file_limit = (int)$settings->get('fax','upload_file_limit',5);
|
$upload_file_limit = (int)$settings->get('fax','upload_file_limit',5);
|
||||||
for ($f = 1; $f <= $upload_file_limit; $f++) {
|
for ($f = 1; $f <= $upload_file_limit; $f++) {
|
||||||
echo " <span id='fax_file_".$f."' ".(($f > 1) ? "style='display: none;'" : null).">";
|
echo " <span id='fax_file_".$f."' ".(($f > 1) ? "style='display: none;'" : null).">";
|
||||||
|
|||||||
Reference in New Issue
Block a user