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
00049
00050 $r=$cn->exec_sql("select jr_def_id from jrn where jr_grpt_id=$jr_grpt_id");
00051 if ( Database::num_row($r) == 0 )
00052 {
00053 echo_error("Invalid operation id jr_grpt_id=$jr_grpt_id");
00054 exit;
00055 }
00056 $a=Database::fetch_array($r,0);
00057 $jrn=$a['jr_def_id'];
00058
00059 if ($g_user->check_jrn($jrn) == 'X' )
00060 {
00061
00062 NoAccess();
00063 exit -1;
00064 }
00065
00066 $cn->start();
00067 $ret=$cn->exec_sql("select jr_pj,jr_pj_name,jr_pj_type from jrn where jr_grpt_id=$jr_grpt_id");
00068 if ( Database::num_row ($ret) == 0 )
00069 return;
00070 $row=Database::fetch_array($ret,0);
00071 if ( $row['jr_pj']==null )
00072 {
00073 ini_set('zlib.output_compression','Off');
00074 header("Pragma: public");
00075 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
00076 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
00077 header("Cache-Control: must-revalidate");
00078 header('Content-type: '.'text/plain');
00079 header('Content-Disposition: attachment;filename=vide.txt',FALSE);
00080 header("Accept-Ranges: bytes");
00081 echo "******************";
00082 echo _("Fichier effacé");
00083 echo "******************";
00084 exit();
00085 }
00086 $tmp=tempnam($_ENV['TMP'],'document_');
00087
00088 $cn->lo_export($row['jr_pj'],$tmp);
00089
00090 ini_set('zlib.output_compression','Off');
00091 header("Pragma: public");
00092 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
00093 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
00094 header("Cache-Control: must-revalidate");
00095 header('Content-type: '.$row['jr_pj_type']);
00096 header('Content-Disposition: attachment;filename="'.$row['jr_pj_name'].'"',FALSE);
00097 header("Accept-Ranges: bytes");
00098 $file=fopen($tmp,'r');
00099 while ( !feof ($file) )
00100 echo fread($file,8192);
00101
00102 fclose($file);
00103
00104 unlink ($tmp);
00105
00106 $cn->commit();