2009-07-07 16:02:53 +00:00
|
|
|
<?php
|
|
|
|
$file = $_REQUEST['q'];
|
|
|
|
$type = $_REQUEST['type'];
|
2010-04-13 08:21:31 +00:00
|
|
|
if (empty($type) == false) {
|
|
|
|
switch ($type) {
|
|
|
|
case 'pdf':
|
|
|
|
$content_type = 'application/pdf';
|
2010-06-17 08:37:55 +00:00
|
|
|
$path = PATH_DATA.'/'.$type.'/';
|
2010-04-13 08:21:31 +00:00
|
|
|
break;
|
|
|
|
case 'logos':
|
|
|
|
$explode = explode('.', $file);
|
|
|
|
switch ($explode[1]) {
|
2010-06-17 08:37:55 +00:00
|
|
|
case 'png' : $content_type = 'image/png'; break;
|
|
|
|
case 'gif' : $content_type = 'image/gif'; break;
|
|
|
|
case 'jpeg':
|
|
|
|
case 'jpg' : $content_type = 'image/jpeg'; break;
|
2010-04-13 08:21:31 +00:00
|
|
|
}
|
2010-06-17 08:37:55 +00:00
|
|
|
$path = PATH_DATA.'/'.$type.'/';
|
2010-04-13 08:21:31 +00:00
|
|
|
break;
|
|
|
|
case 'consommation':
|
|
|
|
$content_type = 'application/csv-tab-delimited-table';
|
2010-06-17 08:37:55 +00:00
|
|
|
$path = PATH_DATA.'/'.$type.'/';
|
2010-04-13 08:21:31 +00:00
|
|
|
break;
|
|
|
|
case 'surveillance':
|
|
|
|
$content_type = 'application/csv-tab-delimited-table';
|
2010-06-17 08:37:55 +00:00
|
|
|
$path = PATH_DATA.'/'.$type.'/';
|
2010-04-13 08:21:31 +00:00
|
|
|
break;
|
2010-04-26 09:48:28 +00:00
|
|
|
case 'portefeuille':
|
|
|
|
$content_type = 'application/csv-tab-delimited-table';
|
2010-06-17 08:37:55 +00:00
|
|
|
$path = PATH_DATA.'/'.$type.'/';
|
|
|
|
break;
|
|
|
|
case 'kbis':
|
|
|
|
$path = PATH_DATA.'/infogreffe/'.$type.'/';
|
|
|
|
$content_type = 'application/pdf';
|
2010-04-26 09:48:28 +00:00
|
|
|
break;
|
2010-04-13 08:21:31 +00:00
|
|
|
default:
|
|
|
|
exit;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$path = PATH_DATA.'/';
|
2009-07-07 16:02:53 +00:00
|
|
|
}
|
2010-01-22 08:58:39 +00:00
|
|
|
$firephp->log($path.$file, 'path');
|
2010-04-13 08:21:31 +00:00
|
|
|
if (file_exists($path.$file)) {
|
|
|
|
header('Content-Transfer-Encoding: none');
|
|
|
|
header('Content-type: '.$content_type.'');
|
|
|
|
header('Content-Length: '.filesize($path.$file));
|
|
|
|
header('Content-MD5: '.base64_encode(md5_file($path.$file)));
|
|
|
|
header('Content-Disposition: filename="'.basename($path.$file).'"');
|
|
|
|
header('Cache-Control: private, max-age=0, must-revalidate');
|
|
|
|
header('Pragma: public');
|
|
|
|
ini_set('zlib.output_compression', '0');
|
|
|
|
echo file_get_contents($path.$file);
|
2009-07-07 16:02:53 +00:00
|
|
|
}
|
2010-04-13 08:21:31 +00:00
|
|
|
?>
|