21 lines
1.1 KiB
PHP
21 lines
1.1 KiB
PHP
|
<?php
|
||
|
include dirname(__FILE__).'/../../config/config.inc.php';
|
||
|
|
||
|
|
||
|
if((Tools::getValue('token') === Tools::getAdminToken('AdminLaPosteWS'.(int) Tab::getIdFromClassName('AdminLaPosteWS').(int) Tools::getValue('id_employee')))
|
||
|
&& ($label = Tools::getValue('label'))) {
|
||
|
if(Tools::getValue('print')) {
|
||
|
echo '<html><head></head><body><object id="pdf" type="application/pdf" data="'.__PS_BASE_URI__.'modules/lapostews/getlabel.php?id_employee='.(int) Tools::getValue('id_employee').'&label='.$label.'&token='.Tools::getValue('token').'" width="100%" height="500" /><script type="text/javascript">jsPrintSetup.setSilentPrint(true);jsPrintSetup.print();window.close();</script></body></html>';
|
||
|
} else {
|
||
|
if(is_file(dirname(__FILE__).'/labels/'.$label.'.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="'.$label.'.pdf"');
|
||
|
readfile(dirname(__FILE__).'/labels/'.$label.'.pdf');
|
||
|
} else {
|
||
|
echo 'ERROR - File not found';
|
||
|
}
|
||
|
}
|
||
|
}
|