Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once '../include/constant.php';
00025 include_once ("ac_common.php");
00026 require_once('class_dossier.php');
00027 $gDossier=dossier::id();
00028
00029 if ( !isset ($_GET['jrn'] ) ||
00030 !isset($_GET['jr_grpt_id']))
00031 {
00032 echo_error("Missing parameters");
00033 }
00034
00035 require_once('class_database.php');
00036
00037
00038 $jr_grpt_id=$_GET['jr_grpt_id'];
00039
00040 $cn=new Database($gDossier);
00041
00042
00043 include_once ('class_user.php');
00044 global $g_user;
00045 $g_user=new User($cn);
00046 $g_user->Check();
00047 $g_user->check_dossier($gDossier);
00048 if ( isNumber($jr_grpt_id) != 1 ) die (_('Données invalides'));
00049
00050
00051 $r=$cn->exec_sql("select jr_def_id from jrn where jr_grpt_id=$jr_grpt_id");
00052 if ( Database::num_row($r) == 0 )
00053 {
00054 echo_error("Invalid operation id jr_grpt_id=$jr_grpt_id");
00055 exit;
00056 }
00057 $a=Database::fetch_array($r,0);
00058 $jrn=$a['jr_def_id'];
00059
00060 if ($g_user->check_jrn($jrn) == 'X' )
00061 {
00062
00063 NoAccess();
00064 exit -1;
00065 }
00066
00067 $cn->start();
00068 $ret=$cn->exec_sql("select jr_pj,jr_pj_name,jr_pj_type from jrn where jr_grpt_id=$jr_grpt_id");
00069 if ( Database::num_row ($ret) == 0 )
00070 return;
00071 $row=Database::fetch_array($ret,0);
00072 if ( $row['jr_pj']==null )
00073 {
00074 ini_set('zlib.output_compression','Off');
00075 header("Pragma: public");
00076 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
00077 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
00078 header("Cache-Control: must-revalidate");
00079 header('Content-type: '.'text/plain');
00080 header('Content-Disposition: attachment;filename=vide.txt',FALSE);
00081 header("Accept-Ranges: bytes");
00082 echo "******************";
00083 echo _("Fichier effacé");
00084 echo "******************";
00085 exit();
00086 }
00087 $tmp=tempnam($_ENV['TMP'],'document_');
00088
00089 $cn->lo_export($row['jr_pj'],$tmp);
00090
00091 ini_set('zlib.output_compression','Off');
00092 header("Pragma: public");
00093 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
00094 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
00095 header("Cache-Control: must-revalidate");
00096 header('Content-type: '.$row['jr_pj_type']);
00097 header('Content-Disposition: attachment;filename="'.$row['jr_pj_name'].'"',FALSE);
00098 header("Accept-Ranges: bytes");
00099 $file=fopen($tmp,'r');
00100 while ( !feof ($file) )
00101 echo fread($file,8192);
00102
00103 fclose($file);
00104
00105 unlink ($tmp);
00106
00107 $cn->commit();