/** * Load all specific cms data. */ public function loadCms() { $this->fileConfig->loadConfigFromFile(CONFIG_PATH . '/config.php'); if ($this->fileConfig->get('dbUser') !== null) { /* * Cms is installed */ if ($this->fileConfig->get('debugModus') === false) { @ini_set('display_errors', 'off'); error_reporting(0); } $dbFactory = new Database\Factory(); $db = $dbFactory->getInstanceByConfig($this->fileConfig); $databaseConfig = new Config\Database($db); $databaseConfig->loadConfigFromDatabase(); Registry::set('db', $db); Registry::set('config', $databaseConfig); $this->plugin->addPluginData('db', $db); $this->plugin->addPluginData('config', $databaseConfig); $this->plugin->addPluginData('translator', $this->translator); $this->plugin->execute('AfterDatabaseLoad'); $this->router->defineStartPage($databaseConfig->get('start_page'), $this->translator); } else { /* * Cms not installed yet. */ $this->request->setModuleName('install'); if (!empty($_SESSION['language'])) { $this->translator->setLocale($_SESSION['language']); } } }
/** * Fills the request object with the best matched route. */ public function execute() { $this->request->setModuleName(DEFAULT_MODULE); $this->request->setControllerName('index'); $this->request->setActionName('index'); $this->fillQuery(); $query = $this->getQuery(); if (!empty($query)) { $result = $this->match($query); $this->updateRequest(reset($result)); } }
/** * Tests if the module name changed after it got set. */ public function testGetModuleName() { $this->request->setModuleName('moduleNameTest'); $this->assertEquals('moduleNameTest', $this->request->getModuleName(), 'Modulename changed.'); }