Beispiel #1
0
 /**
  * Dispatch the current http request into the control loop:
  *  1. Load the ressources
  *  2. Start the MVC Loop from the ClearFW
  *  manage Exception:
  */
 public function dispatch()
 {
     common_Profiler::start('dispatch');
     if (!self::$isDispatched) {
         if (PHP_SAPI == 'cli') {
             $this->dispatchCli();
         } else {
             $this->dispatchHttp();
         }
         self::$isDispatched = true;
     }
     common_Profiler::stop('dispatch');
 }
Beispiel #2
0
 /**
  * Dispatch the current http request into the control loop:
  *  1. Load the ressources
  *  2. Start the MVC Loop from the ClearFW
  *  manage Exception:
  */
 public function dispatch()
 {
     common_Profiler::start('dispatch');
     if (!self::$isDispatched) {
         $isAjax = tao_helpers_Request::isAjax();
         if (tao_helpers_Context::check('APP_MODE')) {
             if (!$isAjax) {
                 $this->scripts();
             }
         }
         //Catch all exceptions
         try {
             //the app is ready
             if ($this->isReady()) {
                 $this->mvc();
             } else {
                 //the request is not an ajax request, redirect the user to the maintenance page
                 if (!$isAjax) {
                     require_once Template::getTemplate('error/maintenance.tpl', 'tao');
                     //else throw an exception, this exception will be send to the client properly
                 } else {
                     throw new \common_exception_SystemUnderMaintenance();
                 }
             }
         } catch (Exception $e) {
             $this->catchError($e);
         }
         // explicitly close session
         session_write_close();
         self::$isDispatched = true;
     }
     common_Profiler::stop('dispatch');
 }