public function __construct($mode = null) { $GLOBALS['ms'] =& $this; try { $config = new ConfigController(); } catch (\Exception $e) { $this->raiseError('Failed to load ConfigController!', true); return false; } $GLOBALS['config'] =& $config; try { $requirements = new RequirementsController(); } catch (\Exception $e) { $this->raiseError('Failed to load RequirementsController!', true); return false; } if (!$requirements->check()) { $this->raiseError('Not all requirements are met - please check on your own!', true); return false; } unset($requirements); try { $db = new DatabaseController(); } catch (\Exception $e) { $this->raiseError('Failed to load DatabaseController!', true); return false; } $GLOBALS['db'] =& $db; if (!$this->isCmdline()) { try { $router = new HttpRouterController(); } catch (\Exception $e) { $this->raiseError('Failed to load HttpRouterController!', true); return false; } $GLOBALS['router'] =& $router; $GLOBALS['query'] = $router->getQuery(); global $query; } if (isset($query) && isset($query->view) && $query->view == "install") { $mode = "install"; } if ($mode != "install" && $this->checkUpgrade()) { return false; } if (isset($mode) and $mode == "install") { try { $installer = new InstallerController(); } catch (\Exception $e) { $this->raiseError('Failed to load InstallerController!'); return false; } if (!$installer->setup()) { exit(1); } unset($installer); exit(0); } try { $session = new SessionController(); } catch (\Exception $e) { $this->raiseError('Failed to load SessionController!', true); return false; } $GLOBALS['session'] =& $session; return true; }