| Server IP : 172.67.201.108 / Your IP : 216.73.216.11 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/tgnewdev/admin/ |
Upload File : |
<?php
use PhpOffice\PhpWord\Settings;
session_start();
require_once('mod/_sanitize.php');
include_once('config/config.php');
date_default_timezone_set(APP_TIMEZONE);
try {
$db = new PDO(DB_CONNECT_STRING, DB_USER, DB_PWD);
} catch (Exception $e) {
die('Could not connect: ' . 'Database Error!');
}
$sql_tz = "SET time_zone = '".APP_TIMEZONE."'";
$db->query($sql_tz);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
require_once('mod/_functions.php');
$report_file = trim($_GET['rpt']);
$type = trim($_GET['type']);
if (!empty($_GET['deeplink']) && !empty($_GET['deeplink_data'])) :
$_POST = json_decode($_GET['deeplink_data'], true);
endif;
if (!empty($_SESSION['logged_in']) && !empty($_SESSION['user_id']) && $_SESSION['logged_in'] == true) :
$authorized_call = 1;
$_SESSION['timeout'] = time() + APP_TIMEOUT;
if ($type == 'oo_report') :
ini_set('display_errors', '0');
ini_set("pcre.backtrack_limit","10000000");
ini_set("memory_limit","2048M");
require_once('classes/lcs_db_report_base.php');
require_once('classes/lcs_db_report.php');
get_clean_report_post();
if (($_POST['output_format'] ?? '') === 'email' && !empty($_POST['email_attachment'])) :
$_POST['output_format'] = $_POST['email_attachment'];
$_POST['save_file'] = true;
$_POST['save_file_name'] = 'Report_' . date('Y_m_d_H_i_s');
include('rpt/'.$report_file.'.php');
$_POST['output_format'] = 'email';
endif;
include('rpt/'.$report_file.'.php');
elseif ($type == 'label') :
if ($_GET['fmt'] == 'pdf') :
ini_set('display_errors', '0');
ini_set("pcre.backtrack_limit","10000000");
ini_set("memory_limit","2048M");
include_once('rpt/'.$report_file.'.php');
elseif ($_GET['fmt'] == 'word' || $_GET['fmt'] == 'rtf') :
Settings::loadConfig();
$pdf_path = realpath(__DIR__ . '/vendor/mpdf/mpdf/src');
\PhpOffice\PhpWord\Settings::setPdfRendererPath($pdf_path);
\PhpOffice\PhpWord\Settings::setPdfRendererName('Mpdf');
$phpWord = new \PhpOffice\PhpWord\PhpWord();
include_once('rpt/'.$report_file.'.php');
switch ($_GET['fmt']) :
case 'pdf' :
$file = 'Report.pdf';
$writer = 'PDF';
$content_type = 'application/pdf';
break;
case 'word' :
$file = 'Report.docx';
$writer = 'Word2007';
$content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
break;
case 'rtf' :
$file = 'Report.rtf';
$writer = 'RTF';
$content_type = 'application/rtf';
break;
case 'html' :
$file = 'Report.html';
$writer = 'HTML';
break;
default :
$file = 'Report.docx';
$writer = 'Word2007';
$content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
endswitch;
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="' . $file . '"');
header('Content-Type: '.$content_type);
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("php://output");
endif;
elseif ($type == 'report') :
ini_set('display_errors', '0');
ini_set("pcre.backtrack_limit","10000000");
ini_set("memory_limit","2048M");
include_once('rpt/'.$report_file.'.php');
endif;
//elseif (!empty($_GET['deeplink']) && !empty($_GET['deeplink_data'])) :
else :
check_deeplink_redirect();
echo 'Not Authorized!';
endif;