Doctrine
This commit is contained in:
parent
a9ede731f5
commit
3c595a2929
@ -1,18 +1,24 @@
|
||||
<?php
|
||||
class FichierController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
/**
|
||||
* PDO Connection with Doctrine
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
}
|
||||
|
||||
public function bodaccAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ( $auth->hasIdentity() ) {
|
||||
|
||||
$c = Zend_Registry::get('config');
|
||||
if ($auth->hasIdentity()) {
|
||||
$c = Zend_Registry::get('config');
|
||||
$directory = $c->profil->path->shared.'/datafile/bodacc/histo';
|
||||
|
||||
$q = $this->getRequest()->getParam('q');
|
||||
@ -20,7 +26,7 @@ class FichierController extends Zend_Controller_Action
|
||||
|
||||
$file = $directory.'/'.$filename;
|
||||
|
||||
if (file_exists($file) && filesize($file)>0) {
|
||||
if (file_exists($file) && filesize($file) > 0) {
|
||||
|
||||
//Log de la requete
|
||||
$data = array(
|
||||
@ -36,8 +42,7 @@ class FichierController extends Zend_Controller_Action
|
||||
'ville' => '',
|
||||
'ipClient' => $_SERVER['REMOTE_ADDR'],
|
||||
);
|
||||
$logs = new Application_Model_Sdv1Logs();
|
||||
$logs->insert($data);
|
||||
$this->conn->insert('sdv1.logs', $data);
|
||||
|
||||
$content_type = 'application/pdf';
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
@ -62,7 +67,8 @@ class FichierController extends Zend_Controller_Action
|
||||
} else {
|
||||
echo "Erreur lors de l'affichage du fichier.";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo "Authentification échoué.";
|
||||
}
|
||||
}
|
||||
@ -124,7 +130,8 @@ class FichierController extends Zend_Controller_Action
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user