Exemplo n.º 1
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;
     }
 }
Exemplo n.º 2
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');
             }
         }
     }
 }