Example #1
0
 /**
  * Handles a http request.
  * 
  * @param	string		$application
  * @param	boolean		$isACPRequest
  */
 public function handle($application = 'wcf', $isACPRequest = false)
 {
     $this->isACPRequest = $isACPRequest;
     if (!RouteHandler::getInstance()->matches()) {
         if (ENABLE_DEBUG_MODE) {
             throw new SystemException("Cannot handle request, no valid route provided.");
         } else {
             throw new IllegalLinkException();
         }
     }
     // build request
     $this->buildRequest($application);
     // handle offline mode
     if (!$isACPRequest && defined('OFFLINE') && OFFLINE) {
         if (!WCF::getSession()->getPermission('admin.general.canViewPageDuringOfflineMode') && !$this->activeRequest->isAvailableDuringOfflineMode()) {
             if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
                 throw new AJAXException(WCF::getLanguage()->get('wcf.ajax.error.permissionDenied'), AJAXException::INSUFFICIENT_PERMISSIONS);
             } else {
                 @header('HTTP/1.1 503 Service Unavailable');
                 WCF::getTPL()->assign(array('templateName' => 'offline', 'templateNameApplication' => 'wcf'));
                 WCF::getTPL()->display('offline');
             }
             exit;
         }
     }
     // start request
     $this->activeRequest->execute();
 }