2013-11-05 11:18:30 +00:00
|
|
|
<?php
|
|
|
|
class FichierController extends Zend_Controller_Action
|
|
|
|
{
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bodaccAction()
|
|
|
|
{
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
if ( $auth->hasIdentity() ) {
|
|
|
|
|
|
|
|
$directory = '/mnt/bodacc';
|
|
|
|
|
|
|
|
$q = $this->getRequest()->getParam('q');
|
|
|
|
$file = base64_decode($q);
|
|
|
|
|
|
|
|
$output_file = $directory.'/'.$file;
|
|
|
|
|
|
|
|
if (file_exists($output_file) && filesize($output_file)>0) {
|
2014-03-25 20:16:44 +00:00
|
|
|
|
|
|
|
//Log de la requete
|
|
|
|
$data = array(
|
|
|
|
'login' => $auth->getIdentity()->username,
|
|
|
|
'idClient' => $auth->getIdentity()->idClient,
|
|
|
|
'page' => 'histobodacc',
|
|
|
|
'siren' => '',
|
|
|
|
'nic' => '',
|
|
|
|
'params' => $file,
|
|
|
|
'test' => 0,
|
|
|
|
'raisonSociale' => '',
|
|
|
|
'cp' => '',
|
|
|
|
'ville' => '',
|
|
|
|
'ipClient' => $_SERVER['REMOTE_ADDR'],
|
|
|
|
);
|
|
|
|
$logs = new Application_Model_Sdv1Logs();
|
|
|
|
$logs->insert($data);
|
|
|
|
|
|
|
|
//Deliver file
|
2013-11-05 11:18:30 +00:00
|
|
|
$content_type = 'application/pdf';
|
|
|
|
header('Content-type: '.$content_type.'');
|
|
|
|
header('Content-Length: '.filesize($output_file));
|
|
|
|
header('Content-MD5: '.base64_encode(md5_file($output_file)));
|
|
|
|
header('Content-Disposition: inline; filename="'.basename($output_file).'"');
|
|
|
|
header('Cache-Control: private, max-age=0, must-revalidate');
|
|
|
|
header('Pragma: public');
|
|
|
|
ini_set('zlib.output_compression','0');
|
|
|
|
echo file_get_contents($output_file);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
echo "Erreur lors de l'affichage du fichier.";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
echo "Authentification échoué.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function logsAction()
|
|
|
|
{
|
|
|
|
$file = $this->getRequest()->getParam('fichier');
|
|
|
|
$content_type = 'application/csv-tab-delimited-table';
|
|
|
|
$c = Zend_Registry::get('config');
|
2014-02-07 16:14:36 +00:00
|
|
|
$path = APPLICATION_PATH . '/../data/files/';
|
2013-11-05 11:18:30 +00:00
|
|
|
//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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function csvAction()
|
|
|
|
{
|
|
|
|
$file = $this->getRequest()->getParam('fichier');
|
|
|
|
$content_type = 'application/csv-tab-delimited-table';
|
|
|
|
$c = Zend_Registry::get('config');
|
2014-02-07 16:14:36 +00:00
|
|
|
$path = APPLICATION_PATH . '/../data/files/';
|
2013-11-05 11:18:30 +00:00
|
|
|
//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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function kbisAction()
|
|
|
|
{
|
|
|
|
$file = $this->getRequest()->getParam('fichier');
|
|
|
|
$content_type = 'application/pdf';
|
|
|
|
$c = Zend_Registry::get('config');
|
|
|
|
$path = realpath($c->profil->path->secure).'/kbis/';
|
|
|
|
//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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function associationsAction()
|
|
|
|
{
|
|
|
|
$file = $this->getRequest()->getParam('fichier');
|
|
|
|
$content_type = 'application/pdf';
|
|
|
|
$c = Zend_Registry::get('config');
|
2014-02-07 16:14:36 +00:00
|
|
|
$path = APPLICATION_PATH . '/../data/files/associations/';
|
|
|
|
//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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function greffesAction()
|
|
|
|
{
|
|
|
|
$file = $this->getRequest()->getParam('fichier');
|
|
|
|
$content_type = 'application/pdf';
|
|
|
|
$c = Zend_Registry::get('config');
|
|
|
|
$path = APPLICATION_PATH . '/../data/files/greffes/';
|
2013-11-05 11:18:30 +00:00
|
|
|
//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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|