public function init(Website $website, Request $request) { parent::init($website, $request); $categoryRepo = new CategoryRepository($website->getDatabase()); $this->categories = $categoryRepo->getCategoriesComplete(); $this->editLinks = $website->isLoggedInAsStaff(true); }
public function init(Website $website, Request $request) { parent::init($website, $request); $this->newUser = $this->handleUserRequest($website, $request); $this->allRanks = $website->getAuth()->getRanks(); $this->requestToken = RequestToken::generateNew(); $this->requestToken->saveToSession(); }
public function init(Website $website, Request $request) { parent::init($website, $request); if (!$website->getConfig()->get(Config::OPTION_USER_ACCOUNT_CREATION) || $website->isLoggedIn()) { // Pretend page doesn't exist when account creation is disabled, // or when already logged in throw new NotFoundException(); } $this->newUser = $this->handleUserRequest($website, $request); $this->requestToken = RequestToken::generateNew(); $this->requestToken->saveToSession(); }
public static function getPageResponse(Website $website, Request $request, Page $page, ResponseInterface $response) { try { $page->init($website, $request); } catch (NotFoundException $e) { $page = new Error404Page(); $page->init($website, $request); } $pageRenderer = new PageRenderer($website, $request, $page); $body = $response->getBody(); $pageRenderer->render($body); $body->rewind(); return $page->modifyResponse($response); }
public function init(Website $website, Request $request) { parent::init($website, $request); $themeManager = $website->getThemeManager(); if (!$themeManager->canSwitchThemes()) { $this->sendThemeSwitchError($website->getText()); } else { if (Validate::requestToken($request)) { $this->trySwitchTheme($themeManager, $website->getText(), $request); } } $this->availableThemes = $themeManager->getAllThemes(); $this->requestToken = RequestToken::generateNew(); $this->requestToken->saveToSession(); }