Transformation de tous les liens pour le module file

This commit is contained in:
Michael RICOIS 2016-02-08 09:06:03 +00:00
parent d898342447
commit 8c21ed8911
14 changed files with 507 additions and 536 deletions

View File

@ -56,13 +56,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
));
$router->addRoute('localauth', $localauthRoute);
$fichierRoute = new Zend_Controller_Router_Route('fichier/:action/:fichier', array(
'module' => 'default',
'controller' => 'fichier',
'fichier' => '',
));
$router->addRoute('fichier', $fichierRoute);
$printRoute = new Zend_Controller_Router_Route('editer/:action/:fichier', array(
'module' => 'default',
'controller' => 'print',

View File

@ -1,487 +0,0 @@
<?php
class FichierController extends Zend_Controller_Action
{
public function init()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
}
public function indexAction(){}
/**
* Gestion du chargement des logos
*/
public function logoAction()
{
$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;
}
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->data).'/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.';
}
}
/**
* Gestion du chargement des images du cache
*/
public function imgcacheAction()
{
$content_type = 'image/png';
$c = Zend_Registry::get('config');
$path = $c->profil->path->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.';
}
}
/**
* Gestion du chargement des fichiers des marques
*/
public function marqueAction()
{
$content_type = 'application/pdf';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->data).'/marques/';
$file = $this->getRequest()->getParam('fichier');
if(file_exists($path.$file) && filesize($path.$file)>0) {
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 "Erreur lors de l'affichage du fichier.";
}
}
/**
* Gestion des fichiers Actes et Bilans
*/
public function pdfAction()
{
$file = $this->getRequest()->getParam('fichier');
$content_type = 'application/pdf';
$c = Zend_Registry::get('config');
//bilan
if (preg_match('/^bilan-[0-9]{9}-(consolides|sociaux)-([0-9]{8})/', $file, $matches)) {
$path = realpath($c->profil->path->data).
'/greffes/bilans/'.$matches[1].'/'.substr($matches[2],0,4).'/';
}
//acte
else if (preg_match('/^acte-[0-9]{9}-(.*)-([0-9]{8})-.*-.*-.*-.*-.*-.*$/', $file, $matches)) {
$type = $matches[1];
$date = $matches[2];
$annee = substr($date,0,4);
$mois = substr($date,4,2);
$path = realpath($c->profil->path->data).'/greffes/actes/'.$annee.'/'.$mois.'/';
}
Zend_Registry::get('firebug')->info($path);
if(file_exists($path.$file) && filesize($path.$file)>0) {
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 "Erreur lors de l'affichage du fichier.";
}
}
/**
* Gestion des fichiers Actes et Bilans
*/
public function pdfassociationAction()
{
$content_type = 'application/pdf';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->data).'/association/';
$file = $this->getRequest()->getParam('fichier');
$type = $this->getRequest()->getParam('type');
$file = $type.'/'.$file;
if(file_exists($path.$file) && filesize($path.$file)>0) {
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 "Erreur lors de l'affichage du fichier.";
}
}
/**
* Gestion des liasses au format excel
*/
public function liasseAction()
{
$content_type = 'application/vnd.ms-excel';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->files).'/';
$file = $this->getRequest()->getParam('fichier');
//Envoi du fichier sur la sortie standard
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.';
}
}
/**
* Gestion des log de consommation
*/
public function consommationAction()
{
$file = $this->getRequest()->getParam('fichier');
$content_type = 'application/csv-tab-delimited-table';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->files).'/';
//Envoi du fichier sur la sortie standard
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.';
}
}
/**
* Export du portefeuille au format CSV
*/
public function portefeuilleAction()
{
$file = $this->getRequest()->getParam('fichier');
$content_type = 'application/csv-tab-delimited-table';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->files).'/';
//Envoi du fichier sur la sortie standard
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.';
}
}
/**
* Export de la liste des surveillances au format CSV
*/
public function surveillanceAction()
{
$file = $this->getRequest()->getParam('fichier');
$content_type = 'application/csv-tab-delimited-table';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->files).'/';
//Envoi du fichier sur la sortie standard
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.';
}
}
/**
* Gestion des fichiers bilan saisie par les clients
*/
public function bilanclientAction()
{
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->data).'/bilanclient/';
$file = $this->getRequest()->getParam('fichier');
$explode = explode('.', $file);
switch ($explode[1]) {
case 'pdf' : $content_type = 'application/pdf'; break;
case 'tiff' : $content_type = 'image/tiff'; break;
}
if ( file_exists($path.$file) && filesize($path.$file)>0 ) {
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 "Erreur lors de l'affichage du fichier.";
}
}
/**
* Gestion des kbis
*/
public function kbisAction()
{
$content_type = 'application/pdf';
$file = $this->getRequest()->getParam('fichier');
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->files).'/';
if ( file_exists($path.$file) && filesize($path.$file)>0 ) {
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 "Erreur lors de l'affichage du fichier.";
}
}
/**
* Gestion des rapports personnalisés
*/
public function customrapportAction()
{
$content_type = 'application/pdf';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->pages).'/';
$file = $this->getRequest()->getParam('fichier');
$output_file = $directory.'/'.$file;
if ( file_exists($path.$file) && filesize($path.$file)>0 ) {
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.";
}
}
/**
* Gestion bodacc au format PDF
*/
public function bodaccAction()
{
$content_type = 'application/pdf';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->data).'/bodacc/';
$file = $this->getRequest()->getParam('fichier');
//Construire le chemin du dossier
preg_match('/BODACC_(A|B|C)_([0-9]{4})_(.*)\.pdf/', $file, $matches);
$path.= $matches[1].'/'.$matches[2].'/';
if ( file_exists($path.$file) && filesize($path.$file)>0 ) {
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.";
}
}
/**
* Gestion des fichiers PDF des nouveautés
*/
public function newAction()
{
$content_type = 'application/pdf';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->data).'/nouveautes/';
$file = $this->getRequest()->getParam('fichier');
if ( file_exists($path.$file) && filesize($path.$file)>0 ) {
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.";
}
}
/**
* Bodacc history file
*/
public function histopdfAction()
{
$content_type = 'application/pdf';
$file = $this->getRequest()->getParam('fichier');
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->files).'/';
if ( file_exists($path.$file) && filesize($path.$file)>0 ) {
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.";
}
}
/**
* Internal files for groupes
*/
public function groupesAction()
{
$content_type = 'application/pdf';
$file = $this->getRequest()->getParam('fichier');
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->data).'/groupes/';
if ( file_exists($path.$file) && filesize($path.$file)>0 ) {
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.";
}
}
/**
* Bilan : Association
*/
public function greffeAction()
{
$content_type = 'application/pdf';
$file = $this->getRequest()->getParam('fichier');
$c = Zend_Registry::get('config');
$path = $c->profil->path->files.'/';
Zend_Registry::get('firebug')->info($path.$file);
if ( file_exists($path.$file) && filesize($path.$file)>0 ) {
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.";
}
}
/**
* Façade d'immeuble
*/
public function streetviewAction()
{
$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;
}
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->data).'/google/streetview/';
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 file_get_contents(APPLICATION_PATH.'/../public/themes/default/images/1x1.png');
}
}
}

View File

@ -396,7 +396,7 @@ class JuridiqueController extends Zend_Controller_Action
}
//On vérfie que le fichier existe après le téléchargement
if(file_exists($directory.'/'.$file) && filesize($directory.'/'.$file)>0) {
$href = $this->view->baseUrl().'/fichier/marque/'.$file;
$href = $this->view->url(array('module'=>'file', 'controller'=>'index', 'action'=>'marque', 'q'=>$file), 'default', true);
echo '<a href="'.$href.'" target="_blank">Télécharger le PDF de l\'insciption au BOPI.</a>';
} else {
echo 'Document introuvable.';

View File

@ -490,10 +490,8 @@ class PiecesController extends Zend_Controller_Action
$c = Zend_Registry::get('config');
$file = 'bilan-'.$siren.'-'.$type.'-'.$dateCloture.'.pdf';
if (copy($stream->getStreamName(), $c->profil->path->files . '/' . $file)) {
$this->view->assign('url', $this->view->url(array(
'controller' => 'fichier',
'action' => 'greffe',
), 'default', true).'/'.$file);
$this->view->assign('url', $this->view->url(array('module'=>'file',
'controller'=>'greffe', 'action'=>'bilan', 'q'=>$file), 'default', true));
} else {
$this->view->assign('msg', "Impossible de distribuer le fichier.");
}
@ -620,10 +618,8 @@ class PiecesController extends Zend_Controller_Action
$c = Zend_Registry::get('config');
$file = 'acte-'.$siren.'-'.$depotNum.'-'.$acteNum.'.pdf';
if (copy($stream->getStreamName(), $c->profil->path->files . '/' . $file)) {
$this->view->assign('url', $this->view->url(array(
'controller' => 'fichier',
'action' => 'greffe',
), 'default', true).'/'.$file);
$this->view->assign('url', $this->view->url(array('module'=>'file',
'controller'=>'greffe', 'action'=>'acte', 'q'=>$file), 'default', true));
} else {
$this->view->assign('msg', "Impossible de distribuer le fichier.");
}
@ -894,8 +890,8 @@ class PiecesController extends Zend_Controller_Action
$c = Zend_Registry::get('config');
$file = 'ST-'.$siren.'-'.$date.'.pdf';
if (copy($stream->getStreamName(), $c->profil->path->files . '/' . $file)) {
$this->view->assign('url', $this->view->url(array('controller' => 'fichier',
'action' => 'greffe'), 'default', true).'/'.$file);
$this->view->assign('url', $this->view->url(array('module'=>'file', 'controller'=>'greffe',
'action'=>'association', 'q'=>$file), 'default', true));
} else {
$this->view->assign('msg', "Impossible de distribuer le fichier.");
}
@ -1057,7 +1053,7 @@ class PiecesController extends Zend_Controller_Action
if ( file_exists($path.'kbis-'.$siren.'.pdf')
&& date('Ymd', filemtime($path.'kbis-'.$siren.'.pdf'))==date('Ymd')
&& filesize($path.'kbis-'.$siren.'.pdf')>2000 ) {
$msg = '<u><a title="Cliquez ici pour visualiser le kbis" target="_blank" href="/fichier/kbis/kbis-'.$siren.'.pdf">Visualiser le Kbis <img src="/themes/default/images/interfaces/icone_pdf.gif"></a></u>';
$msg = '<u><a title="Cliquez ici pour visualiser le kbis" target="_blank" href="/file/greffe/kbis/q/kbis-'.$siren.'.pdf">Visualiser le Kbis <img src="/themes/default/images/interfaces/icone_pdf.gif"></a></u>';
$this->view->assign('message', $msg);
$this->view->assign('mode', $mode);
$ws->setLog('kbis', $siren, 0, 'direct');
@ -1078,7 +1074,7 @@ class PiecesController extends Zend_Controller_Action
$response = $client->request('GET');
//Ecriture du fichier sur le serveur en local
if ( $response->isSuccessful() && copy($response->getStreamName(), $path.'kbis-'.$siren.'.pdf') ) {
$msg = '<u><a title="Cliquez ici pour visualiser le kbis" target="_blank" href="/fichier/kbis/kbis-'.$siren.'.pdf">Visualiser le Kbis <img src="/themes/default/images/interfaces/icone_pdf.gif"></a></u>';
$msg = '<u><a title="Cliquez ici pour visualiser le kbis" target="_blank" href="/file/greffe/kbis/q/kbis-'.$siren.'.pdf">Visualiser le Kbis <img src="/themes/default/images/interfaces/icone_pdf.gif"></a></u>';
$this->view->assign('message', $msg);
$this->view->assign('mode', $mode);
}

View File

@ -137,9 +137,10 @@ class TelechargementController extends Zend_Controller_Action
}
// --- Fichier disponible
elseif ( file_exists($this->path.'/'.$file) ) {
echo '<u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/consommation/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger le fichier.</a></u>';
echo '<u><a title="Télécharger le fichier"'.
' target="_blank" href="'.$this->url(array('module'=>'file', 'controller'=>'index',
'action'=>'consommation', 'q'=>$file), 'default', true).
'">Cliquez-ici pour télécharger le fichier.</a></u>';
}
}
}
@ -185,9 +186,10 @@ class TelechargementController extends Zend_Controller_Action
}
// --- Fichier disponible
elseif ( file_exists($this->path.'/'.$file) ) {
echo '<u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/surveillance/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger le fichier.</a></u>';
echo '<u><a title="Télécharger le fichier"'.
' target="_blank" href="'$this->url(array('module'=>'file', 'controller'=>'index',
'action'=>'surveillance', 'q'=>$file), 'default', true)..
'">Cliquez-ici pour télécharger le fichier.</a></u>';
}
}
@ -232,9 +234,10 @@ class TelechargementController extends Zend_Controller_Action
}
// --- Fichier disponible
elseif ( file_exists($this->path.'/'.$file) ) {
echo '<u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/portefeuille/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger le fichier.</a></u>';
echo '<u><a title="Télécharger le fichier"'.
' target="_blank" href="'.$this->url(array('module'=>'file', 'controller'=>'index',
'action'=>'portefeuille', 'q'=>$file), 'default', true).
'">Cliquez-ici pour télécharger le fichier.</a></u>';
}
}
}
@ -270,8 +273,9 @@ class TelechargementController extends Zend_Controller_Action
// --- Fichier disponible
elseif ( file_exists($this->path.'/'.$file) ) {
if (filesize($this->path.'/'.$file) > 0) {
echo '<u><a title="Télécharger le fichier" target="_blank" href="/file/bodacc/histo/q/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger le fichier.</a></u>';
echo '<u><a title="Télécharger le fichier" target="_blank" href="'.$this->url(array('module'=>'file',
'controller'=>'bodacc', 'action'=>'histo', 'q'=>$file), 'default', true)
'">Cliquez-ici pour télécharger le fichier.</a></u>';
} else {
echo "Erreur lors du téléchargement du fichier.";
}
@ -311,9 +315,9 @@ class TelechargementController extends Zend_Controller_Action
// --- Fichier disponible
elseif ( file_exists($this->path.'/'.$file) ) {
if (filesize($this->path.'/'.$file) > 0) {
echo '<br/><u><a title="T&eacute;l&eacute;charger le fichier"'.
' target="_blank" href="/fichier/bilan/'.$file.
'">Cliquez-ici pour t&eacute;l&eacute;charger le fichier.</a></u>';
echo '<br/><u><a title="Télécharger le fichier" target="_blank" href="'.$this->url(array(
'module'=>'file', 'controller'=>'greffe', 'action'=>'bilan', 'q'=>$file), 'default', true).
'">Cliquez-ici pour télécharger le fichier.</a></u>';
} else {
echo "<br/>Erreur lors du téléchargement du fichier.";
}

View File

@ -5,7 +5,8 @@
<strong>Nouveau !</strong>
<?php $cpt = 0;?>
<?php foreach ( $this->nouveautes as $nouveaute) {?>
<a href="<?=$this->url(array('controller'=>'fichier', 'action'=>'new', 'fichier'=>$nouveaute->fichier))?>" target="_blank">
<a href="<?=$this->url(array('module'=>'file','controller'=>'index', 'action'=>'new',
'q'=>$nouveaute->fichier))?>" target="_blank">
<?=$nouveaute->intitule?></a>
<?php $cpt++;?>
<?php if ( $cpt < count($this->nouveautes) ) {?>,<?php }?>

View File

@ -27,8 +27,8 @@ table td { border:1px solid; padding:5px; }
<tr>
<td><?=substr($nouveau->date,8,2).'/'.substr($nouveau->date,5,2).'/'.substr($nouveau->date,0,4)?></td>
<td>
<a href="<?=$this->url(array('controller'=>'fichier',
'action'=>'new', 'fichier'=>$nouveau->fichier))?>" target="_blank">
<a href="<?=$this->url(array('module'=>'file', 'controller'=>'index', 'action'=>'new',
'q'=>$nouveau->fichier))?>" target="_blank">
<?=$nouveau->intitule?></a>
</td>
<td><?=$nouveau->categorie?></td>

View File

@ -1,5 +1,6 @@
<?php if (!empty($this->file)) { ?>
<a href="/fichier/liasse/<?=$this->file?>" target="_blank">Télécharger le fichier excel.</a>
<a href="<?=$this->url(array('module'=>'file', 'controller'=>'index', 'action'=>'liasse', 'q'=>$this->file),
'default', true)?>" target="_blank">Télécharger le fichier excel.</a>
<?php } else { ?>
Erreur lors de la construction du fichier.
<?php }?>

View File

@ -1,7 +1,7 @@
<?php if (isset($this->upload) && $this->upload == true){?>
<strong>Fichier envoyé <a href="<?=$this->url(array('controller'=>'fichier', 'action'=>'bilanclient',
'fichier'=>$this->file),'default',true)?>"></a></strong>
<strong>Fichier envoyé <a href="<?=$this->url(array('module'=>'file', 'controller'=>'index', 'action'=>'bilanclient',
'q'=>$this->file), 'default', true)?>"></a></strong>
<script>
$('#dialogbilanclient').dialog({ buttons: [ {
text: "Quitter",

View File

@ -5,9 +5,11 @@ Aucun document.
foreach ( $this->docs as $key=>$doc ) {
$class = ($key<$limit)?'first':'all';?>
<div class="<?=$class?>" id="<?=$key ?>">
<a target="_blank" href="/fichier/groupes/<?=$doc->url?>" id="<?=$doc->date?>" class="lienDocDate"><?=$doc->label?></a>
<a target="_blank" href="<?=$this->url(array('module'=>'file', 'controller'=>'lien', 'action'=>'groupe',
'q'=>$doc->url), 'default', true)?>" id="<?=$doc->date?>" class="lienDocDate"><?=$doc->label?></a>
<?php if ($this->edition) {?>
<a class="dialog" title="Supprimer le document" href="<?=$this->url(array('controller'=>'saisie','action'=>'liendoc','mode'=>'delete','id'=>$doc->id), 'default', true)?>">
<a class="dialog" title="Supprimer le document" href="<?=$this->url(array('controller'=>'saisie', 'action'=>'liendoc',
'mode'=>'delete', 'id'=>$doc->id), 'default', true)?>">
<img style="vertical-align:middle;" src="/themes/default/images/interfaces/supprimer.png" />
</a>
<?php }?>

View File

@ -0,0 +1,136 @@
<?php
class File_GreffeController extends Zend_Controller_Action
{
public function init()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
}
public function associationAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = realpath($c->profil->path->data).'/association/'.$filename;
$content_type = 'application/pdf';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
public function bilanAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = $c->profil->path->files.'/'.$filename;
$content_type = 'application/pdf';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
public function acteAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = $c->profil->path->files.'/'.$filename;
$content_type = 'application/pdf';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
/**
* Distribution des kbis
*/
public function kbisAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = realpath($c->profil->path->files).'/'.$filename;
$content_type = 'application/pdf';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
}

View File

@ -1,5 +1,287 @@
<?php
class File_IndexController extends Zend_Controller_Action
{
public function init()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
}
public function indexAction(){}
/**
* Gestion du chargement des fichiers des marques
*/
public function marqueAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = realpath($c->profil->path->data).'/marques/'.$filename;
$content_type = 'application/pdf';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
/**
* Gestion des liasses au format excel
*/
public function liasseAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = realpath($c->profil->path->files).'/'.$filename;
$content_type = 'application/vnd.ms-excel';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
/**
* Gestion des log de consommation
*/
public function consommationAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = realpath($c->profil->path->files).'/'.$filename;
$content_type = 'application/csv-tab-delimited-table';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
/**
* Export du portefeuille au format CSV
*/
public function portefeuilleAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = realpath($c->profil->path->files).'/'.$filename;
$content_type = 'application/csv-tab-delimited-table';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
/**
* Export de la liste des surveillances au format CSV
*/
public function surveillanceAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = realpath($c->profil->path->files).'/'.$filename;
$content_type = 'application/csv-tab-delimited-table';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
/**
* Gestion des fichiers bilan saisie par les clients
*/
public function bilanclientAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = realpath($c->profil->path->data).'/bilanclient/'.$filename;
$explode = explode('.', $file);
switch ($explode[1]) {
case 'pdf' : $content_type = 'application/pdf'; break;
case 'tiff' : $content_type = 'image/tiff'; break;
}
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
/**
* Gestion des rapports personnalisés
*/
public function customrapportAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = realpath($c->profil->path->pages).'/'.$filename;
$content_type = 'application/pdf';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
/**
* Gestion des fichiers PDF des nouveautés
*/
public function newAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = realpath($c->profil->path->data).'/nouveautes/'.$filename;
$content_type = 'application/pdf';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
}

View File

@ -0,0 +1,43 @@
<?php
class File_LienController extends Zend_Controller_Action
{
public function init()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
}
/**
* Internal files for groupes
*/
public function groupeAction()
{
$filename = $this->getRequest()->getParam('q');
$c = Zend_Registry::get('config');
$file = realpath($c->profil->path->data).'/groupes/'.$filename;
$content_type = 'application/pdf';
//Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header ('X-Sendfile: ' . $file);
header ('Content-Type: ' . $content_type);
header ('Content-Disposition: attachment; filename="' . $content_type . '"');
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else {
echo "Impossible de charger le fichier";
}
}
}

View File

@ -16,7 +16,7 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
$checkAuth = false;
}
if ($request->getControllerName()=='fichier' && $request->getClientIp(false)=='78.31.45.206') {
if ($request->getModuleName()=='file' && $request->getClientIp(false)=='78.31.45.206') {
$checkAuth = false;
}