27if ( ! defined (
'ALLOWED')) die (
_(
'Non autorisé'));
29include_once NOALYSS_INCLUDE.
'/lib/ac_common.php';
34 $js_id=
$http->get(
'js_id',
"number");
42$cn=Dossier::connect();
49 $jrn_def_id=
$cn->get_value(
"select jr_def_id from jrn_sup_document join jrn using (jr_id) where js_id=$1",array($js_id));
52 if ($jrn_def_id ==
"" ||
$g_user->check_jrn($jrn_def_id) ==
'X' )
61 ini_set(
'zlib.output_compression',
'Off');
62 header(
"Pragma: public");
63 header(
"Expires: Mon, 26 Jul 1997 05:00:00 GMT");
64 header(
"Last-Modified: " . gmdate(
"D, d M Y H:i:s") .
" GMT");
65 header(
"Cache-Control: must-revalidate");
66 header(
'Content-type: '.
$jrn->js_mimetype);
67 header(
'Content-Disposition: attachment;filename="'.
$jrn->js_filename.
'"',FALSE);
68 header(
"Accept-Ranges: bytes");
69 echo
$cn->lo_read(
$jrn->js_lob);
78 $jrn_def_id=
$cn->get_value(
"select jr_def_id from jrn where jr_id=$1",array(
$operation_id));
81 if ($jrn_def_id ==
"" ||
$g_user->check_jrn($jrn_def_id) ==
'X' )
87 $jr_internal=
$cn->get_value(
"select jr_internal from jrn where jr_id=$1",array(
$operation_id));
92 $a_file=
$cn->get_array(
"select js_lob,js_filename from jrn_sup_document where jr_id=$1",
95 if ( count ($a_file) == 0 ) {
100 $store = tempnam($_ENV[
'TMP'],
'pdf_');
103 $nb_file=count($a_file);
104 for(
$i=0;
$i < $nb_file;
$i++)
106 $filename=sprintf(
"%s".DIRECTORY_SEPARATOR.
"%s",
108 $a_file[
$i][
'js_filename']);
111 if (file_exists($filename)) {
114 $filename=sprintf(
"%s".DIRECTORY_SEPARATOR.
"%s-%s",
117 $a_file[
$i][
'js_filename']);
119 }
while ( file_exists($filename));
122 $cn->lo_export($a_file[
$i][
'js_lob'], $filename);
123 $a_file_dwn[]=$filename;
129 $zip_file=sprintf(
"%s".DIRECTORY_SEPARATOR.
"%s.zip"
134 $res=$zip->open($zip_file, ZipArchive::CREATE);
135 foreach ($a_file_dwn as $item)
137 $zip->addFile(basename($item));
141 header(
'Content-Type: application/zip');
142 header(
'Content-Disposition: attachment; filename="document-'.$jr_internal.
'.zip"');
143 header(
'Cache-Control: private, max-age=0, must-revalidate');
144 header(
'Pragma: public');
145 echo file_get_contents($zip_file);
147 }
catch (Exception $exc) {
NoAccess($js=1)
Echo no access and stop.
record_log($p_message)
Record an error message into the log file of the server or in the log folder of NOALYSS Record also t...
global $g_user
if no group available , then stop
_("actif, passif,charge,...")
abstract of the table public.jrn_sup_document
for($e=0; $e< count($afiche); $e++) exit