Example #1
0
 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // alias for indicating the requested page
     if (isset($_REQUEST['alias'])) {
         $alias = $_REQUEST['alias'];
         $this->pageID = PageCache::getInstance()->getIDByAlias($alias);
     } else {
         if (isset($_REQUEST['id'])) {
             $this->pageID = intval($_REQUEST['id']);
         } else {
             // landing page of the cms
             $page = PageCache::getInstance()->getHomePage();
             if ($page !== null) {
                 $this->pageID = $page->pageID;
             } else {
                 // redirect to system's landing page
                 HeaderUtil::redirect(Linkhandler::getInstance()->getLink(), true);
                 exit;
             }
         }
     }
     $this->page = PageCache::getInstance()->getPage($this->pageID);
     if ($this->page === null) {
         throw new IllegalLinkException();
     }
     // check if offline and view page or exit
     // @see	\wcf\system\request\RequestHandler
     if (OFFLINE) {
         if (!WCF::getSession()->getPermission('admin.general.canViewPageDuringOfflineMode') && !$this->page->availableDuringOfflineMode) {
             @header('HTTP/1.1 503 Service Unavailable');
             WCF::getTPL()->assign(array('templateName' => 'offline'));
             WCF::getTPL()->display('offline');
             exit;
         }
     }
     // check permissions
     if (!$this->page->canRead()) {
         throw new PermissionDeniedException();
     }
 }