public function __construct() { ob_start(); $this->basePath = realpath(dirname($_SERVER['SCRIPT_FILENAME'])) . '/'; $this->doc = new DOMDocument('1.0', 'utf-8'); $this->doc->xmlStandalone = true; $this->doc->formatOutput = true; $this->url = new Url(); // current url $this->post = new Post(); $this->rootNode = Util::rootTagToXml('page', $this->doc); $this->kernelNode = Util::tagToXml('kernel', $this->rootNode); $this->menuNode = Util::tagToXml('menu', $this->kernelNode); $this->infoNode = Util::tagToXml('infobox', $this->kernelNode); $this->sessionNode = Util::tagToXml('session', $this->kernelNode); Util::valueToXml('title', TITLE_PREFIX . $this->title, $this->rootNode); if (Sessionmanager::isLogged()) { Util::valueToXml('id', Sessionmanager::getUserId(), $this->sessionNode); Util::valueToXml('username', Sessionmanager::getUsername(), $this->sessionNode); Util::valueToXml('userlevel', Sessionmanager::getUserlevel(), $this->sessionNode); Util::valueToXml('url', $this->url->buildUrlString(), $this->sessionNode); } else { Util::valueToXml('username', "Please login.", $this->sessionNode); Util::valueToXml('userlevel', USERLEVEL_NONE, $this->sessionNode); } $this->initializeModules(); }
public function __construct(Kernel $kernel) { $this->kernel = $kernel; if (Util::isAjaxRequest()) { return; } if (Sessionmanager::isLogged()) { $menuUrl = new Url(); $menuUrl->clearPageParams(); $menuUrl->setPage('Mainpage'); $this->kernel->addMenuItem($menuUrl, 'Mainpage'); $menuUrl->clearPageParams(); $menuUrl->setPage('Movies'); $this->kernel->addMenuItem($menuUrl, 'Movies'); $menuUrl->clearPageParams(); $menuUrl->setPage('Series'); $this->kernel->addMenuItem($menuUrl, 'Series'); $menuUrl->clearPageParams(); $menuUrl->setPage('Unhandled'); $this->kernel->addMenuItem($menuUrl, 'Unhandled'); $menuUrl->clearPageParams(); $menuUrl->setPage('Seeking'); $this->kernel->addMenuItem($menuUrl, 'Seeking'); $menuUrl->clearPageParams(); $menuUrl->setPage('Statistics'); $this->kernel->addMenuItem($menuUrl, 'Statistics'); $menuUrl->clearPageParams(); $menuUrl->setPage('Login'); $menuUrl->setParam('logout', 1); $this->kernel->addMenuItem($menuUrl, 'Logout'); } }
} $filename = PATH_CLASS . $class_name . '.class.php'; if (file_exists($filename)) { require_once $filename; } } Sessionmanager::start(); $tmpUrl = new Url(); $page = mb_convert_case($tmpUrl->getPage(), MB_CASE_TITLE); if (!Sessionmanager::isLogged() || isset($tmpUrl->getPageParams()->logout)) { $page = Login; } else { if (empty($page)) { $page = Mainpage; } else { if ($page == Login && Sessionmanager::isLogged()) { $page = Mainpage; } } } $errorCode = NULL; if (class_exists($page)) { $oPage = new $page(); if ($oPage instanceof IPage && $oPage instanceof Kernel) { if (Util::isAjaxRequest()) { $errorCode = $oPage->generateAjax(); // This is the AJAX pipeline. } else { $errorCode = $oPage->generate(); // This is the default pipeline. }