From d07795c3c5d9dd581fae9e4b4ea8cefd9b7d44a6 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sun, 6 Mar 2005 19:52:59 +0000 Subject: [PATCH] Task 3778 : show the upload document --- html/show_document.php | 63 +++++++++++++++++++++++++++++++++++++++++ include/user_common.php | 5 +++- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 html/show_document.php diff --git a/html/show_document.php b/html/show_document.php new file mode 100644 index 000000000..9520ccddc --- /dev/null +++ b/html/show_document.php @@ -0,0 +1,63 @@ +Check(); + +if ( $User->admin == 0 ) { + if (CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$jrn) == 0 ){ + /* Cannot Access */ + NoAccess(); + exit -1; + } +} + +StartSql($cn); +$ret=ExecSql($cn,"select jr_pj,jr_pj_name,jr_pj_type from jrn where jr_grpt_id=$jr_grpt_id"); +if ( pg_num_rows ($ret) == 0 ) + return; +$row=pg_fetch_array($ret,0); +$tmp=tempnam('/tmp/','document_'); +pg_lo_export($cn,$row['jr_pj'],$tmp); +header('Content-type: '.$row['jr_pj_type']); +header('Content-Disposition: attachment;filename="'.$row['jr_pj_name'].'"',FALSE); +$file=fopen($tmp,'r'); +while ( !feof ($file) ) + echo fread($file,8192); + +fclose($file); + +Commit($cn); diff --git a/include/user_common.php b/include/user_common.php index 7a2090b65..ed360708c 100644 --- a/include/user_common.php +++ b/include/user_common.php @@ -392,7 +392,10 @@ function ListJrn($p_cn,$p_jrn,$p_where="",$p_array=null) } } //document - $r.="".$row['jr_pj_name'].""; + $r.="".sprintf('%s', + $p_jrn, + $row['jr_grpt_id'], + $row['jr_pj_name']).""; // end row $r.="";