1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
| <?php
require_once 'global/init.php';
//Application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/'));
define('CHEMIN_LIB', 'library/');
define('BASE_PATH', '');
//Application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', 'production');
//Application include
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/library/'),
realpath(APPLICATION_PATH . '/models/'),
realpath(APPLICATION_PATH . '/views/'),
realpath(APPLICATION_PATH . '/forms/'),
realpath(APPLICATION_PATH . '/global/'),
get_include_path()
)));
//Application View & helpers
require_once 'Zend/View.php';
$view = new Zend_View();
$view->setHelperPath(realpath(APPLICATION_PATH . '/views/helpers'));
$view->setScriptPath('/');
$view->addScriptPath('/');
//Application Bootstrap & config
require_once 'Zend/Application.php';
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/config/config.ini'
);
//Chargement de la Config
$config = new Zend_Config_Ini('config/config.ini', 'production');
Zend_Layout::startMvc();
//*********** BASE DE DONNEES ************//
//***************************************//
$db = Zend_Db::factory('Pdo_Mysql',array
(
'host' => $config->database->host,
'username' => $config->database->params->username,
'password' => $config->database->params->password,
'dbname' => $config->database->params->dbname,
));
Zend_Db_Table::setDefaultAdapter($db); //connexion à la base db par défaut.
$registry = Zend_Registry::getInstance(); //Stockage de la connexion dans le registre
$registry->set('db', $db);
//*************************************//
//***** Chargement des class *********//
//************************************//
Zend_Loader::loadClass('Zend_Auth');
/**********************************/
//***** ZEND AUTH & ACL **********//
//*************************/
$auth = Zend_Auth::getInstance();
$auth->setStorage(new Zend_Auth_Storage_Session('Auth'));
require_once 'library/My/Controllers/helper/Acl.php';
$helper= new My_Controller_Helper_Acl();
$helper->setRoles();
$helper->setResources();
$helper->setPrivilages();
$helper->setAcl();
require_once 'library/My/Controllers/plugin/Acl.php';
$frontController = Zend_Controller_Front::getInstance();
$frontController->registerPlugin(new My_Controller_Plugin_Acl($auth));
//Execution
$application->bootstrap();
$application->run(); |
Partager