public function actionLogout() { $model = new siteModel(); if (!$this->user->isGuest && $model->userLogout()) { return $this->redirect('/'); } else { $this->errors; } // display the reg form // $this->view->render('logout.php', ['errors' => $this->errors]); }
function __construct() { if ($user = siteModel::isuserLogged()) { $this->user = $user; } else { $this->user = new siteModel(); } $this->view = new View($this->user->attributes(), $this->user->isGuest); }
function actionIndex() { $siteModel = new siteModel(); $data = $siteModel->mainData(); $this->view->render('index.php', $data); }
public static function isuserLogged() { if (isset($_SESSION['id']) || isset($_COOKIE['login']) && isset($_COOKIE['password'])) { if ($user = siteModel::find('all', array('conditions' => array('user_login=?', $_COOKIE['login'])))) { $user = $user[0]; $user->isGuest = false; } return $user; } else { return false; } }