Example #1
0
 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]);
 }
Example #2
0
 function __construct()
 {
     if ($user = siteModel::isuserLogged()) {
         $this->user = $user;
     } else {
         $this->user = new siteModel();
     }
     $this->view = new View($this->user->attributes(), $this->user->isGuest);
 }
Example #3
0
 function actionIndex()
 {
     $siteModel = new siteModel();
     $data = $siteModel->mainData();
     $this->view->render('index.php', $data);
 }
Example #4
0
 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;
     }
 }