예제 #1
0
 /**
  * @see WCF::initTPL()
  */
 protected function initTPL()
 {
     // init style to get template pack id
     $this->initStyle();
     global $packageDirs;
     require_once WCF_DIR . 'lib/system/template/StructuredTemplate.class.php';
     self::$tplObj = new StructuredTemplate(self::getStyle()->templatePackID, self::getLanguage()->getLanguageID(), ArrayUtil::appendSuffix($packageDirs, 'templates/'));
     $this->assignDefaultTemplateVariables();
     // init cronjobs
     $this->initCronjobs();
     // check offline mode
     if (OFFLINE && !self::getUser()->getPermission('user.board.canViewBoardOffline')) {
         $showOfflineError = true;
         foreach (self::$availablePagesDuringOfflineMode as $type => $names) {
             if (isset($_REQUEST[$type])) {
                 foreach ($names as $name) {
                     if ($_REQUEST[$type] == $name) {
                         $showOfflineError = false;
                         break 2;
                     }
                 }
                 break;
             }
         }
         if ($showOfflineError) {
             self::getTPL()->display('offline');
             exit;
         }
     }
     // user ban
     if (self::getUser()->banned && (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'LegalNotice')) {
         throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.user.banned'));
     }
 }