2017-01-11 15:53:24 +01:00

20 lines
975 B
PHP
Executable File

<?php
include dirname(__FILE__).'/../../../../config/config.inc.php';
if((Tools::getValue('token') === Tools::getAdminToken('AdminMondialRelaySummary'.(int) Tab::getIdFromClassName('AdminMondialRelaySummary').(int) Tools::getValue('id_employee')))
&& ($pdf_date = Tools::getValue('date')) && ($pdf_dm = Tools::getValue('dm')) && in_array($pdf_dm, array('24r', 'dri', 'ld1', 'lds', 'hom'))) {
$pdf_date = (string) (int) $pdf_date;
$pdf_date = substr($pdf_date, 0, 4).'-'.substr($pdf_date, 4, 2).'-'.substr($pdf_date, 6);
if(is_file(dirname(__FILE__).'/summaries/'.$pdf_date.'_'.$pdf_dm.'.pdf')) {
header('Content-type: application/pdf');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Content-disposition: inline; filename="'.$pdf_date.'_'.$pdf_dm.'.pdf"');
readfile(dirname(__FILE__).'/summaries/'.$pdf_date.'_'.$pdf_dm.'.pdf');
} else {
echo 'ERROR - File not found';
}
}