Esempio n. 1
0
 protected function _setupEnvironment()
 {
     error_reporting(E_ALL | E_STRICT);
     set_include_path($this->getPath('library') . PATH_SEPARATOR . $this->getPath('models') . PATH_SEPARATOR . $this->getPath('controllers') . PATH_SEPARATOR . get_include_path());
     require_once 'WebVista/Model/ORM.php';
     require_once 'User.php';
     require_once 'Person.php';
     require_once 'Zend/Session.php';
     require_once 'WebVista/Session/SaveHandler.php';
     Zend_Session::setSaveHandler(new WebVista_Session_SaveHandler());
     Zend_Session::start();
     require_once 'Zend/Loader.php';
     Zend_Loader::registerAutoLoad();
     $sessionTimeout = ini_get('session.gc_maxlifetime') - 5 * 60;
     Zend_Registry::set('sessionTimeout', $sessionTimeout);
     $this->_config = new Zend_Config_Ini($this->getPath('application') . "/config/app.ini", APPLICATION_ENVIRONMENT);
     Zend_Registry::set('config', $this->_config);
     Zend_Registry::set('baseUrl', substr($_SERVER['PHP_SELF'], 0, strpos(strtolower($_SERVER['PHP_SELF']), 'index.php')));
     Zend_Registry::set('basePath', $this->getPath('base') . DIRECTORY_SEPARATOR);
     try {
         date_default_timezone_set(Zend_Registry::get('config')->date->timezone);
     } catch (Zend_Exception $e) {
         die($e->getMessage());
     }
     AuditLog::setDbConfig($this->_config->database->toArray());
     // this MUST be required as this is used as DB connection
     // register shutdown function
     register_shutdown_function(array('AuditLog', 'closeConnection'));
     ob_start();
     // this MUST be required after register shutdown
     return $this;
 }