libretime/legacy/application/Bootstrap.php

94 lines
2.7 KiB
PHP
Raw Permalink Normal View History

<?php
2021-10-11 16:10:47 +02:00
require_once 'preload.php';
2013-01-14 20:43:02 +01:00
$CC_CONFIG = Config::getConfig();
require_once CONFIG_PATH . '/ACL.php';
2014-11-28 21:30:11 +01:00
// Since we initialize the database during the configuration check,
// check the $configRun global to avoid reinitializing unnecessarily
if (!isset($configRun) || !$configRun) {
Propel::init(PROPEL_CONFIG_FILEPATH);
2014-11-28 21:30:11 +01:00
}
Logging::setLogPath(LIBRETIME_LOG_FILEPATH);
2012-05-06 04:29:31 +02:00
if (APPLICATION_ENV != 'testing') {
Zend_Session::setOptions([
'strict' => true,
'serialize_handler' => 'php_serialize',
]);
$db = Zend_Db::factory('PDO_' . $CC_CONFIG['dsn']['phptype'], [
'host' => $CC_CONFIG['dsn']['host'],
'port' => $CC_CONFIG['dsn']['port'],
'username' => $CC_CONFIG['dsn']['username'],
'password' => $CC_CONFIG['dsn']['password'],
'dbname' => $CC_CONFIG['dsn']['database'],
]);
Zend_Db_Table_Abstract::setDefaultAdapter($db);
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable([
'name' => 'sessions',
'primary' => 'id',
'modifiedColumn' => 'modified',
'dataColumn' => 'data',
'lifetimeColumn' => 'lifetime',
]));
}
2013-01-14 20:43:02 +01:00
Config::setAirtimeVersion();
require_once CONFIG_PATH . '/navigation.php';
2021-10-11 16:10:47 +02:00
Zend_Validate::setDefaultNamespaces('Zend');
$front = Zend_Controller_Front::getInstance();
2012-01-16 09:56:57 +01:00
$front->registerPlugin(new RabbitMqPlugin());
$front->throwExceptions(false);
2012-01-16 09:56:57 +01:00
/* The bootstrap class should only be used to initialize actions that return a view.
Actions that return JSON will not use the bootstrap class! */
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initDoctype()
{
$this->bootstrap('view');
$view = $this->getResource('view');
$view->doctype('XHTML1_STRICT');
}
/**
2021-10-11 16:10:47 +02:00
* initialize front controller.
*
* This is call ZFrontController to ensure it is executed last in the bootstrap process.
*/
protected function _initZFrontController()
{
2014-11-04 17:06:17 +01:00
Zend_Controller_Front::getInstance()->throwExceptions(false);
}
2012-01-16 09:56:57 +01:00
protected function _initRouter()
{
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$front->setBaseUrl(Config::getBasePath());
$router->addRoute(
'password-change',
2021-10-11 16:10:47 +02:00
new Zend_Controller_Router_Route('password-change/:user_id/:token', [
'module' => 'default',
2012-04-17 18:16:10 +02:00
'controller' => 'login',
'action' => 'password-change',
2021-10-11 16:10:47 +02:00
])
);
}
public function _initPlugins()
{
$front = Zend_Controller_Front::getInstance();
$front->registerPlugin(new Zend_Controller_Plugin_Maintenance());
$front->registerPlugin(new PageLayoutInitPlugin($this));
}
}