/** * initialize the current page */ protected function initializeCurrentPage() { $pageId = $this->router->getCurrentUrl(); Event::triggerEvent('request_uri', ['uri' => $pageId]); $page = $this->pageRepository->findByPath($pageId); $found = $page instanceof Page; if ($found && $pageId !== $page->getPageId()) { $url = $this->router->urlForPage($page->getPageId()); $this->response->redirect($url, 301); } if (!$found) { $this->response->setStatusCode(404); $page = $this->pageRepository->findByPath('404'); Event::triggerEvent('after_404'); } Event::triggerEvent('after_resolve_page', ['pageId' => $pageId, 'page' => &$page]); $this->page = $page; }
/** * check the setup */ protected function checkSetup() { /** * @triggerEvent before_setup_check this event is triggered before the setup check */ Event::triggerEvent('before_setup_check'); if (!Registry::isRegistered('templateVars')) { Registry::set('templateVars', []); } if (!isset($this->settings['encryptionKey']) || strlen($this->settings['encryptionKey']) == 0) { if ($this->router->getCurrentUrl() !== 'setup') { $this->response->redirect($this->router->url('setup')); return; } } else { if (is_file(CONTENT_DIR . 'setup.md')) { unlink(CONTENT_DIR . 'setup.md'); } } /** * @triggerEvent after_setup_check this event is triggered after the setup check */ Event::triggerEvent('after_setup_check'); }