- switch($status) {
-
- case 403:
- include_spip('inc/minipres');
- echo minipres();
- break;
-
- case 404:
- http_status(404);
- include_spip('inc/minipres');
- echo minipres(_T('erreur').' 404',
- _T('medias:info_document_indisponible'));
- break;
-
- default:
- header("Content-Type: ". $doc['mime_type']);
-
- // pour les images ne pas passer en attachment
- // sinon, lorsqu'on pointe directement sur leur adresse,
- // le navigateur les downloade au lieu de les afficher
-
- if ($doc['inclus']=='non') {
-
- // Si le fichier a un titre avec extension,
- // ou si c'est un nom bien connu d'Unix, le prendre
- // sinon l'ignorer car certains navigateurs pataugent
-
- $f = basename($file);
- if (isset($doc['titre'])
- AND (preg_match('/^\w+[.]\w+$/', $doc['titre']) OR $doc['titre'] == 'Makefile'))
- $f = $doc['titre'];
-
- // ce content-type est necessaire pour eviter des corruptions de zip dans ie6
- header('Content-Type: application/octet-stream');
-
- header("Content-Disposition: attachment; filename=\"$f\";");
- header("Content-Transfer-Encoding: binary");
-
- // fix for IE catching or PHP bug issue
- header("Pragma: public");
- header("Expires: 0"); // set expiration time
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
-
- }
+ switch ($status) {
+ case 403:
+ include_spip('inc/minipres');
+ echo minipres();
+ break;
+
+ case 404:
+ http_status(404);
+ include_spip('inc/minipres');
+ echo minipres(_T('erreur') . ' 404', _T('medias:info_document_indisponible'));
+ break;
+
+ default:
+ header('Content-Type: ' . $doc['mime_type']);
+
+ // pour les images ne pas passer en attachment
+ // sinon, lorsqu'on pointe directement sur leur adresse,
+ // le navigateur les downloade au lieu de les afficher
+
+ if ($doc['inclus'] == 'non') {
+ // Si le fichier a un titre avec extension,
+ // ou si c'est un nom bien connu d'Unix, le prendre
+ // sinon l'ignorer car certains navigateurs pataugent
+
+ $f = basename($file);
+ if (isset($doc['titre'])
+ and (preg_match('/^\w+[.]\w+$/', $doc['titre']) or $doc['titre'] == 'Makefile')
+ ) {
+ $f = $doc['titre'];
+ }
+
+ // ce content-type est necessaire pour eviter des corruptions de zip dans ie6
+ header('Content-Type: application/octet-stream');
+
+ header("Content-Disposition: attachment; filename=\"$f\";");
+ header('Content-Transfer-Encoding: binary');
+
+ // fix for IE catching or PHP bug issue
+ header('Pragma: public');
+ header('Expires: 0'); // set expiration time
+ header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+ }