Beispiel #1
0
 protected function postDispatch()
 {
     if ($this->_http->getParam('parse') == 'json' || $this->_http->isXHR() || $this->_view->isViewDisable()) {
         $this->_view->returnJson();
     } else {
         $this->_view->render();
     }
 }
Beispiel #2
0
 public static function getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Beispiel #3
0
 public static function redirect(array $params, $absolute = false)
 {
     $params['ctrl'] = isset($params['ctrl']) ? $params['ctrl'] : "index";
     $params['act'] = isset($params['act']) ? $params['act'] : "index";
     $module = App_Http::getInstance()->getModuleName();
     $dir = BASE_DIRECTORY;
     $url = '';
     if (!empty($dir)) {
         $url = $dir;
     }
     //		$url .= strtolower($module);
     if ($params['ctrl'] == 'index' && $params['act'] == 'index') {
     } else {
         $url .= $params['ctrl'];
         $url .= '/' . $params['act'];
     }
     header('Location: ' . BASE_URL . $url);
 }
Beispiel #4
0
 private function __construct()
 {
     $this->_session = App_Session::getInstance();
     $this->_http = App_Http::getInstance();
 }
Beispiel #5
0
 private function __construct()
 {
     $this->_http = App_Http::getInstance();
     $this->response = new stdClass();
     //        $this->csrf_token = App_CSRFUtil::getInstance()->getToken(true);
 }
Beispiel #6
-2
 public static function run()
 {
     self::initAutoLoad();
     App_Config::getInstance();
     try {
         $http = App_Http::getInstance();
         //           if($http->isXHR()){
         //             if(!App_CSRFUtil::getInstance()->isValid()){
         //                   throw new Exception('Invalid token');
         //             }
         //           }
         $className = 'App_Controller_' . $http->getModuleName() . '_' . $http->getControllerName();
         if ($http->isAdminModule()) {
             $auth = App_Auth::getInstance()->getInstance();
             if (!$auth->isAuthAction()) {
                 $http->setModuleName("Admin")->setControllerName("Auth")->setActionName("login");
                 $className = 'App_Controller_' . $http->getModuleName() . '_' . $http->getControllerName();
             }
         }
         $ctrl = new $className();
         $ctrl->dispatch($http->getActionName() . 'Action');
     } catch (App_Request_Params_Exceptions $e) {
         die($e->getMessage());
     } catch (App_Mysql_Exceptions $e) {
         die($e->getMessage());
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }