38 |
|
|
39 |
$original_file = urldecode($_GET["file"]); |
$original_file = urldecode($_GET["file"]); |
40 |
$modulepart = urldecode($_GET["modulepart"]); |
$modulepart = urldecode($_GET["modulepart"]); |
41 |
$type = urldecode($_GET["type"]); |
// Défini type et attachment |
42 |
if (! $type) $type='application/pdf'; |
$type = urldecode($_GET["type"]); $attachment = true; |
43 |
|
if (eregi('\.html',$original_file)) { $type='text/html'; $attachment = false; } |
44 |
|
if (eregi('\.pdf',$original_file)) { $type='application/pdf'; $attachment = true; } |
45 |
|
|
46 |
//Suppression de la chaine de caractère ../ dans $original_file |
//Suppression de la chaine de caractère ../ dans $original_file |
47 |
$original_file = str_replace("../","/", "$original_file"); |
$original_file = str_replace("../","/", "$original_file"); |
173 |
$original_file=$conf->produit->dir_output.'/'.$original_file; |
$original_file=$conf->produit->dir_output.'/'.$original_file; |
174 |
} |
} |
175 |
|
|
176 |
|
// Wrapping pour les factures |
177 |
|
if ($modulepart == 'don') |
178 |
|
{ |
179 |
|
$user->getrights('don'); |
180 |
|
if ($user->rights->don->lire) |
181 |
|
{ |
182 |
|
$accessallowed=1; |
183 |
|
} |
184 |
|
$original_file=$conf->don->dir_output.'/'.$original_file; |
185 |
|
} |
186 |
|
|
187 |
} |
} |
188 |
|
|
189 |
// Limite accès si droits non corrects |
// Limite accès si droits non corrects |
208 |
// Les drois sont ok et fichier trouvé, on l'envoie |
// Les drois sont ok et fichier trouvé, on l'envoie |
209 |
dolibarr_syslog("document.php download $filename content-type=$type"); |
dolibarr_syslog("document.php download $filename content-type=$type"); |
210 |
|
|
211 |
header('Content-type: '.$type); |
if ($type) header('Content-type: '.$type); |
212 |
header('Content-Disposition: attachment; filename="'.$filename.'"'); |
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
213 |
|
|
214 |
// Ajout directives pour résoudre bug IE |
// Ajout directives pour résoudre bug IE |
215 |
header('Cache-Control: Public, must-revalidate'); |
header('Cache-Control: Public, must-revalidate'); |