2011-04-28 12:16:41 +00:00
|
|
|
<?php
|
|
|
|
class FichierController extends Zend_Controller_Action
|
|
|
|
{
|
2011-05-10 08:19:24 +00:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
}
|
|
|
|
|
2011-04-28 12:16:41 +00:00
|
|
|
public function indexAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
print_r($request->getParams());
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
/**
|
|
|
|
* Gestion du chargement des logos
|
|
|
|
*/
|
2011-04-28 12:16:41 +00:00
|
|
|
public function logoAction()
|
|
|
|
{
|
2011-05-10 08:19:24 +00:00
|
|
|
$file = $this->getRequest()->getParam('fichier');
|
|
|
|
$explode = explode('.', $file);
|
|
|
|
switch ($explode[1]) {
|
|
|
|
case 'png' : $content_type = 'image/png'; break;
|
|
|
|
case 'gif' : $content_type = 'image/gif'; break;
|
|
|
|
case 'jpeg':
|
|
|
|
case 'jpg' : $content_type = 'image/jpeg'; break;
|
|
|
|
}
|
|
|
|
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
|
|
|
|
$path = realpath($config->data).'/'.$config->logos;
|
|
|
|
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);
|
|
|
|
} else {
|
|
|
|
echo 'Impossible de charger le logo.';
|
|
|
|
}
|
2011-04-28 12:16:41 +00:00
|
|
|
exit;
|
|
|
|
}
|
2011-04-28 15:16:08 +00:00
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
/**
|
|
|
|
* Gestion du chargement des images du cache
|
|
|
|
*/
|
2011-04-28 15:16:08 +00:00
|
|
|
public function imgcacheAction()
|
|
|
|
{
|
|
|
|
$content_type = 'image/png';
|
|
|
|
$path = APPLICATION_PATH.'/../cache/pages/imgcache/';
|
|
|
|
$file = $this->getRequest()->getParam('fichier');
|
|
|
|
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);
|
|
|
|
} else {
|
|
|
|
echo 'Impossible de charger le fichier.';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
/**
|
|
|
|
* Gestion du chargement des fichiers des marques
|
|
|
|
*/
|
2011-05-02 13:38:52 +00:00
|
|
|
public function marqueAction()
|
|
|
|
{
|
|
|
|
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
|
|
|
|
$directory = realpath($config->data).'/'.$config->marques;
|
|
|
|
$file = $this->getRequest()->getParam('fichier');
|
|
|
|
//On affiche le fichier en vérifiant qu'il existe
|
|
|
|
if(file_exists($directory.'/'.$file) && filesize($directory.'/'.$file)>0) {
|
|
|
|
//On affiche le fichier
|
|
|
|
header("Pragma: public");
|
|
|
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
|
|
|
header("Cache-Control: must-revalidate");
|
|
|
|
header("Content-type: application/pdf");
|
|
|
|
header("Content-Disposition: inline; filename=\"$file\"");
|
|
|
|
print file_get_contents($directory.'/'.$file);
|
|
|
|
}else{
|
|
|
|
print "Une erreur c'est produite lors de l'affichage du fichier.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-11 13:38:14 +00:00
|
|
|
/**
|
|
|
|
* Gestion des fichiers Actes et Bilans
|
|
|
|
*/
|
|
|
|
public function pdfAction()
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-04-28 12:16:41 +00:00
|
|
|
}
|