Exemplo n.º 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()) {
			throw new SystemException("Cannot handle request, no valid route provided.");
		}
		
		// 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['X-Requested-With']) && ($_SERVER['X-Requested-With'] == 'XMLHttpRequest')) {
					throw new AJAXException(WCF::getLanguage()->get('wcf.ajax.error.permissionDenied'), AJAXException::INSUFFICIENT_PERMISSIONS);
				}
				else {
					WCF::getTPL()->assign(array(
						'templateName' => 'offline'
					));
					WCF::getTPL()->display('offline');
				}
				
				exit;
			}
		}
		
		// start request
		$this->activeRequest->execute();
	}
Exemplo n.º 2
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()) {
         throw new SystemException("Cannot handle request, no valid route provided.");
     }
     // build request
     $this->buildRequest($application);
     // start request
     $this->activeRequest->execute();
 }