bebeboutik/modules/lapostews/getsummary.php
Srv Bebeboutik 6c0978166c add modules
2016-01-04 12:49:26 +01:00

20 lines
976 B
PHP

<?php
include dirname(__FILE__).'/../../config/config.inc.php';
if((Tools::getValue('token') === Tools::getAdminToken('AdminLaPosteSummary'.(int) Tab::getIdFromClassName('AdminLaPosteSummary').(int) Tools::getValue('id_employee')))
&& ($pdf_date = Tools::getValue('date')) && ($pdf_dm = Tools::getValue('dm')) && in_array($pdf_dm, array('dom', 'cit', 'acp', 'cdi', 'col', 'a2p', 'dos', 'rdv', 'bpr', 'cold'))) {
$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';
}
}