gestion des chemins de fichier sans types

This commit is contained in:
Michael RICOIS 2010-03-30 09:58:01 +00:00
parent af369ce2d8
commit 5871af0979

View File

@ -1,30 +1,34 @@
<?php <?php
$file = $_REQUEST['q']; $file = $_REQUEST['q'];
$type = $_REQUEST['type']; $type = $_REQUEST['type'];
switch($type){ if(!empty($type)){
case 'pdf': switch($type){
$content_type = 'application/pdf'; case 'pdf':
$path = PATH_DATA.'/pdf/'; $content_type = 'application/pdf';
break; $path = PATH_DATA.'/pdf/';
case 'logos': break;
$explode = explode('.', $file); case 'logos':
switch($explode[1]){ $explode = explode('.', $file);
case 'png': $content_type = 'image/png'; break; switch($explode[1]){
case 'gif': $content_type = 'image/gif'; break; case 'png': $content_type = 'image/png'; break;
case 'jpeg': case 'gif': $content_type = 'image/gif'; break;
case 'jpg': $content_type = 'image/jpeg'; break; case 'jpeg':
} case 'jpg': $content_type = 'image/jpeg'; break;
$path = PATH_DATA.'/logos/'; }
break; $path = PATH_DATA.'/logos/';
case 'conso': break;
$content_type = 'application/csv-tab-delimited-table'; case 'conso':
$path = PATH_DATA.'/conso/'; $content_type = 'application/csv-tab-delimited-table';
break; $path = PATH_DATA.'/conso/';
case 'surveillance': break;
$content_type = 'application/csv-tab-delimited-table'; case 'surveillance':
$path = PATH_DATA.'/surveillance/'; $content_type = 'application/csv-tab-delimited-table';
break; $path = PATH_DATA.'/surveillance/';
default: exit; break; break;
default: exit; break;
}
}else{
$path = PATH_DATA.'/';
} }
$firephp->log($path.$file, 'path'); $firephp->log($path.$file, 'path');
if(file_exists($path.$file)) if(file_exists($path.$file))