Exemplo n.º 1
0
 public function run()
 {
     if ($this->_appID) {
         return;
     }
     session_start();
     $this->_appID = md5(time());
     App_Db::connect(include __DIR__ . '/../config/db.php');
     App_Auth::init();
     $strUrl = preg_replace('/\\?.*$/', '', $_SERVER['REQUEST_URI']);
     $arrUrlPart = explode('/', $strUrl);
     $strCtrl = !empty($arrUrlPart[1]) ? $arrUrlPart[1] : 'index';
     $strAction = !empty($arrUrlPart[2]) ? $arrUrlPart[2] : 'index';
     $strCtrlCls = 'Ctrl_' . ucfirst(self::transUrlPart($strCtrl));
     $arrParam = $_REQUEST;
     $arrParam['action'] = $strAction;
     if (!class_exists($strCtrlCls)) {
         $arrParam['action'] = '404';
         $this->_objCtrl = new Ctrl_Index('index', $arrParam);
     } else {
         $this->_objCtrl = new $strCtrlCls($strCtrl, $arrParam);
     }
     $this->_objCtrl->{self::transUrlPart($strAction) . 'Action'}();
     echo $this->_objCtrl->getView()->render();
 }