Ejemplo n.º 1
0
 public function __construct()
 {
     $this->model = new application_frontend_home_model();
     $this->view = new application_frontend_home_view();
     $this->user = $this->view->user = $this->model->user = $GLOBALS['user'];
     $this->view->site['name'] = PROJECT . ' | ' . $this->user['info']['name'];
     parent::checkLogin($this->user['login']);
     application_frontend_event_controller::checkEventEmailInvitation($this->user['myuid']);
     self::updatePageView();
 }
Ejemplo n.º 2
0
 private function handleGET()
 {
     switch ($_GET['action']) {
         case 'activation':
             if (isset($_GET['h']) && !empty($_GET['h'])) {
                 $uid = $this->model->checkHashExist($_GET['h']);
                 if ($uid !== false) {
                     $this->model->deleteHash($_GET['h']);
                     $this->model->activateUser($uid);
                     self::createUsersFolder($uid);
                     self::setUserStatus($uid);
                     application_frontend_event_controller::checkEventEmailInvitation($uid);
                     application_frontend_friend_controller::checkFriendEmailInvitation($uid);
                     parent::redirect('home');
                 } else {
                     parent::redirect('index?action=status&id=noHashExist');
                 }
             } else {
                 parent::redirect('index?action=status&id=hashError');
             }
             break;
         case 'eventInvite':
             if (isset($_GET['h']) && !empty($_GET['h'])) {
                 $invitation = $this->model->getEventInvitationFromHash($_GET['h']);
                 if (!empty($invitation)) {
                     $_SESSION['eventInvite']['inviter'] = $invitation['inviter'];
                     $_SESSION['eventInvite']['ueid'] = $invitation['ueid'];
                     $_SESSION['eventInvite']['eid'] = $invitation['eid'];
                     $_SESSION['eventInvite']['receiver'] = $invitation['receiver'];
                     parent::redirect('index?action=status&id=eventInviteSuccess');
                 } else {
                     parent::redirect('index?action=status&id=eventInvitationEmpty');
                 }
             } else {
                 parent::redirect('index?action=status&id=eventInvitationHash');
             }
             break;
         case 'friendInvite':
             if (isset($_GET['h']) && !empty($_GET['h'])) {
                 $invitation = $this->model->getFriendInvitationFromHash($_GET['h']);
                 if (!empty($invitation)) {
                     $_SESSION['friendInvite']['uid'] = $invitation['uid'];
                     $_SESSION['friendInvite']['email'] = $invitation['email'];
                     parent::redirect('index?action=status&id=friendInviteSuccess');
                 } else {
                     parent::redirect('index?action=status&id=friendInvitationEmpty');
                 }
             } else {
                 parent::redirect('index?action=status&id=friendInvitationHash');
             }
             break;
     }
 }
Ejemplo n.º 3
0
 private function registerData()
 {
     if (self::checkForEmptyInput($this->input)) {
         $this->view->showRegisterMessage('empty');
     } elseif (self::validEmail($this->input) === false) {
         $this->view->showRegisterMessage('email');
     } elseif ($this->model->checkRegisterData($this->input)) {
         $this->view->showRegisterMessage('exist');
     } else {
         $this->model->createUser($this->input);
         $uid = $this->model->getUid();
         self::createUsersFolder($uid);
         $this->email->sendEmail($this->input['email'], 'activation', $this->model->getHash());
         application_frontend_event_controller::checkEventEmailInvitation($uid);
         $this->view->showRegisterMessage('success');
     }
 }
Ejemplo n.º 4
0
 private function login()
 {
     if (!empty($this->input['loginEmail']) && !empty($this->input['loginEmail'])) {
         if (self::validEmail($this->input) === false) {
             $this->view->showLoginMessage('email');
         } else {
             $this->uid = $this->model->getUsersId($this->input);
             if ($this->uid === NULL) {
                 $this->view->showLoginMessage('register');
             } elseif ($this->model->checkPasswordAccount($this->input) === false) {
                 $this->view->showLoginMessage('password');
             } elseif ($this->model->checkUserActivation($this->uid) === false) {
                 $this->view->showLoginMessage('activation');
             } else {
                 self::setUserStatus($this->uid);
                 $this->model->saveLoginAttempt($this->uid);
                 application_frontend_event_controller::checkEventEmailInvitation($this->uid);
                 application_frontend_friend_controller::checkFriendEmailInvitation($this->uid);
                 parent::redirect('home');
             }
         }
     }
 }