/** * The main entry to serves a page request. */ public function run() { $this->init(); if ($this->state === self::STATE_OFF) { $this->errorHandler->handleError(TErrorHandler::CASE_SITEOFF); } try { //handle all the service requests if (!$this->handleServiceRequest()) { //not a service request $this->beginRequest(); $pageName = $this->request->getRequestedPage(); // make sure page contains a valid string if (!preg_match('/^(\\w+:)?(\\w+)$/', $pageName)) { $this->errorHandler->handleError(TErrorHandler::CASE_PAGENOTFOUND); } $page = $this->loadPage($pageName); $page->execute(); $this->endRequest(); } } catch (Exception $e) { $this->errorHandler->handleError(TErrorHandler::CASE_INTERNALERROR, $e); } }
/** * The main entry to serves a page request. */ public function run() { $this->init(); if ($this->state === self::STATE_OFF) { $this->errorHandler->handleError(TErrorHandler::CASE_SITEOFF); } //use exception handlers to allow other process to handle exceptions set_exception_handler(array($this, 'handleException')); if (!$this->handleServiceRequest()) { //not a service request $this->beginRequest(); $pageName = $this->request->getRequestedPage(); // make sure page contains a valid string if (!preg_match('/^(\\w+:)?(\\w+)$/', $pageName)) { $this->errorHandler->handleError(TErrorHandler::CASE_PAGENOTFOUND); } $page = $this->loadPage($pageName); $page->execute(); $this->endRequest(); } restore_exception_handler(); }