-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtache_docnum.php
More file actions
executable file
·83 lines (69 loc) · 3.01 KB
/
tache_docnum.php
File metadata and controls
executable file
·83 lines (69 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// | creator : PMB Services |
// +-------------------------------------------------+
// $Id: tache_docnum.php,v 1.5 2015-04-03 11:16:23 jpermanne Exp $
// définition du minimum nécéssaire
$base_path = ".";
$base_auth = ADMINISTRATION_AUTH; //"CIRCULATION_AUTH";
$base_title = "";
$base_noheader = 1;
$base_nobody = 1;
require_once ("$base_path/includes/init.inc.php");
require_once ("$include_path/explnum.inc.php");
require_once ($class_path."/upload_folder.class.php");
$resultat = pmb_mysql_query("SELECT id_tache_docnum, tache_docnum_nomfichier, tache_docnum_mimetype, tache_docnum_data, tache_docnum_extfichier,
tache_docnum_repertoire, tache_docnum_path, concat(repertoire_path,tache_docnum_path,tache_docnum_nomfichier) as path
FROM taches_docnum left join upload_repertoire on repertoire_id=tache_docnum_repertoire WHERE id_tache_docnum = '$tache_docnum_id' ", $dbh);
$nb_res = pmb_mysql_num_rows($resultat) ;
if (!$nb_res) {
header("Location: images/mimetype/unknown.gif");
exit ;
}
$ligne = pmb_mysql_fetch_object($resultat);
if (($ligne->tache_docnum_data)||($ligne->tache_docnum_path)) {
if ($ligne->tache_docnum_path) {
$up = new upload_folder($ligne->tache_docnum_repertoire);
$path = $up->repertoire_path.$ligne->tache_docnum_path.$ligne->tache_docnum_nomfichier.".".$ligne->tache_docnum_extfichier;
$path = str_replace("//","/",$path);
$path=$up->encoder_chaine($path);
$fo = fopen($path,'rb');
$ligne->tache_docnum_data=fread($fo,filesize($path));
fclose($fo);
}
create_tableau_mimetype() ;
$name=$_mimetypes_bymimetype_[$ligne->tache_docnum_mimetype]["plugin"] ;
if ($name) {
$type = "" ;
// width='700' height='525'
$name = " name='$name' ";
} else $type="type='$ligne->tache_docnum_mimetype'" ;
if ($_mimetypes_bymimetype_[$ligne->tache_docnum_mimetype]["embeded"]=="yes") {
print "<html><body><EMBED src=\"./doc_num_data.php?explnum_id=$explnum_id\" $type $name controls='console' ></EMBED></body></html>" ;
exit ;
}
$nomfichier="";
if ($ligne->tache_docnum_nomfichier) {
$nomfichier=$ligne->tache_docnum_nomfichier;
}
elseif ($ligne->tache_docnum_extfichier)
$nomfichier="pmb".$ligne->id_tache_docnum.".".$ligne->tache_docnum_extfichier;
if ($nomfichier) header("Content-Disposition: inline; filename=".$nomfichier);
header("Content-Type: ".$ligne->tache_docnum_mimetype);
print $ligne->tache_docnum_data;
exit ;
}
if ($ligne->tache_docnum_mimetype=="URL") {
if ($ligne->tache_docnum_url) header("Location: $ligne->tache_docnum_url");
exit ;
}
//if($ligne->explnum_path){
// $up = new upload_folder($ligne->repertoire_id);
// $path = str_replace("//","/",$ligne->path);
// $path=$up->encoder_chaine($path);
// $fo = fopen($path,'rb');
// header("Content-Type: ".$ligne->explnum_mimetype);
// fpassthru($fo);
// exit;
//}