public function run()
 {
     if (array_key_exists('db', $this->config)) {
         $dbConf = $this->config['db'];
         $this->db = new \PDO($dbConf['connectionString'], $dbConf['username'], $dbConf['password']);
     }
     if (session_status() == PHP_SESSION_NONE) {
         session_start();
     }
     $this->user = User::model()->authenticate();
     $this->getControllerAction($controllerName, $actionName, $args);
     $className = '\\controllers\\' . ucfirst($controllerName);
     $controller = new $className();
     if (method_exists($controller, $actionName)) {
         $this->controllerName = $controllerName;
         $this->actionName = $actionName;
         $controller->{$actionName}($args);
     } else {
         $this->error(404, 'Not Found');
     }
 }
Exemple #2
0
 public function logout()
 {
     \models\User::model()->logout();
     $this->redirect('/user/login');
 }