use wcf\system\cache\builder\ControllerCacheBuilder;
use wcf\system\exception\AJAXException;
use wcf\system\exception\IllegalLinkException;
+use wcf\system\exception\NamedUserException;
use wcf\system\exception\SystemException;
use wcf\system\menu\page\PageMenu;
use wcf\system\SingletonFactory;
* @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);
+ try {
+ $this->isACPRequest = $isACPRequest;
+
+ if (!RouteHandler::getInstance()->matches()) {
+ if (ENABLE_DEBUG_MODE) {
+ throw new SystemException("Cannot handle request, no valid route provided.");
}
else {
- @header('HTTP/1.1 503 Service Unavailable');
- WCF::getTPL()->assign(array(
- 'templateName' => 'offline',
- 'templateNameApplication' => 'wcf'
- ));
- WCF::getTPL()->display('offline');
+ 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;
}
-
- exit;
}
+
+ // start request
+ $this->activeRequest->execute();
+ }
+ catch (NamedUserException $e) {
+ $e->show();
+ exit;
}
-
- // start request
- $this->activeRequest->execute();
}
/**