示例#1
0
 public function getUser()
 {
     $user = array('login' => false, 'myuid' => NULL, 'uid' => NULL, 'md5' => 0, 'relation' => 0, 'page' => true, 'info' => NULL, 'myinfo' => NULL);
     $fingerPrint = md5($_SERVER['HTTP_USER_AGENT']);
     if (isset($_SESSION['uid']) && !empty($_SESSION['uid']) && $_SESSION['id'] == $fingerPrint) {
         $user['myuid'] = (int) parent::filter($_SESSION['uid']);
         $user['myinfo'] = application_frontend_user_model::getUser($user['myuid']);
         $user['login'] = true;
     }
     if (isset($_GET['uid']) && !empty($_GET['uid'])) {
         $user['uid'] = (int) parent::filter($_GET['uid']);
         if (application_frontend_user_model::checkUserExist($user['uid']) === false) {
             self::redirect('home');
         }
     }
     if ($user['uid'] !== NULL && $user['myuid'] !== NULL && $user['myuid'] !== $user['uid']) {
         $user['md5'] = md5($user['uid']);
         $user['page'] = false;
         $user['info'] = application_frontend_user_model::getUser($user['uid']);
         $user['relation'] = self::getUserRelation($user['myuid'], $user['uid']);
     } else {
         $user['md5'] = md5($user['myuid']);
         $user['uid'] = $user['myuid'];
         $user['info'] = $user['myinfo'];
     }
     return $user;
 }
示例#2
0
 public function actionController()
 {
     $_GET = parent::filter($_GET);
     self::loadApplications();
     self::loadNavi();
     self::getFriendshipStatus();
     return self::display();
 }
示例#3
0
 public function actionController()
 {
     if (!empty($_POST)) {
         $_POST = parent::filter($_POST);
         self::handlePOST();
     }
     return self::display();
 }
示例#4
0
 public function actionController()
 {
     $_GET = parent::filter($_GET);
     self::handleGET();
     if (!empty($_POST)) {
         $_POST = parent::filter($_POST);
         self::handlePOST();
     }
 }
示例#5
0
 public function actionController()
 {
     if (!empty($_POST)) {
         $_POST = parent::filter($_POST);
         self::handlePOST();
     }
     self::loadNavi();
     return self::displayResult();
 }
示例#6
0
 private function checkPassword($email)
 {
     if ($this->model->checkEmailExist($email)) {
         $this->email = new application_frontend_email_controller();
         $newPassword = self::createNewPassword();
         $this->email->sendEmail($email, 'password', $newPassword);
         $this->model->setNewPassword(md5($newPassword), $email);
     } else {
         parent::redirect('index?action=status&id=newPasswordError');
     }
 }
示例#7
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;
     }
 }
示例#8
0
 private function handleGET()
 {
     if (isset($_GET['eid']) && !empty($_GET['eid'])) {
         $this->eid = $this->view->eid = (int) base64_decode($_GET['eid']);
         if (is_int($this->eid)) {
             $this->view->event = $this->model->getEvent($this->eid);
         }
         return self::display('event');
     } else {
         parent::redirect('index');
     }
 }
示例#9
0
 private function handlePOST()
 {
     if (isset($_POST['save'])) {
         $this->model->privacy = array('privacyBirth' => $_POST['privacyBirth'], 'privacyRelationship' => $_POST['privacyRelationship'], 'privacyEmail' => $_POST['privacyEmail'], 'privacyAboutMe' => $_POST['privacyAboutMe'], 'privacyWebsite' => $_POST['privacyWebsite'], 'privacyPolitics' => $_POST['privacyPolitics'], 'privacyActivities' => $_POST['privacyActivities'], 'privacyInterests' => $_POST['privacyInterests'], 'privacyFilms' => $_POST['privacyFilms'], 'privacyQuotations' => $_POST['privacyQuotations'], 'privacySchool' => $_POST['privacySchool'], 'privacyUniversity' => $_POST['privacyUniversity'], 'privacyEmployer' => $_POST['privacyEmployer']);
         $this->model->basic = array('gender' => $_POST['gender'], 'birth' => $_POST['days'] . ' ' . $_POST['months'] . ' ' . $_POST['years'], 'relationship' => $_POST['relationship'], 'email' => $_POST['email'], 'aboutMe' => $_POST['aboutMe'], 'website' => $_POST['website'], 'location' => $_POST['location'], 'hometown' => $_POST['hometown'], 'politics' => $_POST['politics'], 'religious' => $_POST['religious']);
         $this->model->interests = array('activities' => $_POST['activities'], 'interests' => $_POST['interests'], 'films' => $_POST['films'], 'music' => $_POST['music'], 'books' => $_POST['books'], 'quotations' => $_POST['quotations']);
         $this->model->education = array('school' => $_POST['school'], 'leavingYearsSchool' => $_POST['leavingYearsSchool'], 'university' => $_POST['university'], 'leavingYearsUniversity' => $_POST['leavingYearsUniversity'], 'courses' => $_POST['courses'], 'employer' => $_POST['employer'], 'position' => $_POST['position'], 'description' => $_POST['description'], 'city' => $_POST['city'], 'since' => $_POST['fromMonths'] . ' ' . $_POST['fromYears']);
         $this->model->saveUserProfile();
         parent::redirect('home');
     } elseif (isset($_POST['accountChange']) && $_POST['accountChange'] == true) {
         $this->input = array('calendar' => $_POST['calendar'], 'status' => $_POST['status'], 'comment' => $_POST['comment'], 'friend' => $_POST['friend'], 'commentPage' => $_POST['commentPage'], 'commentSub' => $_POST['commentSub'], 'eventInvite' => $_POST['eventInvite'], 'eventComment' => $_POST['eventComment'], 'eventRequest' => $_POST['eventRequest'], 'eventUpdate' => $_POST['eventUpdate'], 'privateMessage' => $_POST['privateMessage'], 'friendRequest' => $_POST['friendRequest'], 'firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'email' => $_POST['email'], 'password' => $_POST['password']);
         if (isset($this->input['password']) && !empty($this->input['password'])) {
             $this->model->saveUserPassword(md5($this->input['password']));
         }
         $this->model->saveUserPrivacy($this->input);
         $this->model->saveUserAccount($this->input);
         $this->model->saveNotificationSetting($this->input);
     }
 }
示例#10
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');
             }
         }
     }
 }
示例#11
0
 private function handlePOST()
 {
     if (isset($_POST['request']) && $_POST['request'] == true) {
         $this->model->requestFriendship((int) $_POST['uid']);
         self::sendNotificationEmail('friendRequest', (int) $_POST['uid']);
     } elseif (isset($_POST['confirm'])) {
         $this->confirmUid = (int) $_POST['uid'];
         $this->model->deleteRequest($this->confirmUid);
         $this->model->addFriend($this->user['myuid'], $this->confirmUid);
         $this->model->addFriend($this->confirmUid, $this->user['myuid']);
         self::sendNotificationEmail('friendConfirm', (int) $_POST['uid']);
     } elseif (isset($_POST['deny'])) {
         $this->model->deleteRequest((int) $_POST['uid']);
     } elseif (isset($_POST['delete'])) {
         $this->deleteUid = (int) $_GET['uid'];
         $this->model->deleteFriend($this->user['myuid'], $this->deleteUid);
         $this->model->deleteFriend($this->deleteUid, $this->user['myuid']);
         parent::redirect('home?uid=' . $this->deleteUid);
     } elseif (isset($_POST['friendInvite'])) {
         $this->input = array('name' => $this->user['myinfo']['name'], 'email' => $_POST['email'], 'content' => $_POST['content']);
         self::friendInvite();
     }
 }
示例#12
0
 public function actionController()
 {
     $_GET = parent::filter($_GET);
     self::handleGET();
 }
示例#13
0
 private function prozess($name)
 {
     switch ($name) {
         case 'home':
             if (isset($_GET['sub'])) {
                 self::display('sub');
             } elseif (isset($_GET['delete'])) {
                 self::display('delete');
             } elseif (isset($_GET['deletesub'])) {
                 self::display('deletesub');
             } elseif (isset($_GET['app']) && $_GET['app'] === 'home') {
                 $this->view->comments = $this->model->getComment();
                 $this->view->lastComment = $this->model->getLastComment();
                 return self::display('home');
             }
             if (isset($_POST['saveComment'])) {
                 $this->input = array('comment' => $_POST['comment'], 'uid' => (int) $_GET['uid']);
                 self::checkError();
                 if (!$this->error) {
                     $this->model->saveComment($this->input);
                     if ($this->user['page'] === false) {
                         self::sendNotificationEmail('comment', $this->input);
                     }
                 }
                 parent::redirect('home?uid=' . $this->input['uid']);
             } elseif (isset($_POST['saveSubComment'])) {
                 $this->input = array('comment' => $_POST['comment'], 'uid' => (int) $_GET['uid'], 'cid' => (int) $_GET['cid']);
                 self::checkError();
                 if (!$this->error) {
                     $this->model->saveCommentSub($this->input);
                     self::sendNotificationEmail('commentSub', $this->input);
                 }
                 parent::redirect('home?uid=' . $this->input['uid']);
             } elseif (isset($_POST['deleteComment']) && $_POST['deleteComment'] == true) {
                 $this->input = array('cid' => (int) $_POST['cid']);
                 $this->model->deleteComment($this->input);
             } elseif (isset($_POST['deleteSubComment']) && $_POST['deleteSubComment'] == true) {
                 $this->input = array('csid' => (int) $_POST['csid']);
                 $this->model->deleteCommentSub($this->input);
             } elseif (isset($_POST['showCommentMore']) && $_POST['showCommentMore'] == true) {
                 $this->view->comments = $this->model->getCommentMore((int) $_POST['lastComment']);
                 $this->view->lastComment = $this->model->getLastComment();
                 self::display('commentMore');
             } elseif (isset($_POST['commentStatus'])) {
                 echo self::getStatus(3);
             }
             break;
         case 'event':
             if (isset($_GET['delete'])) {
                 self::display('deleteEvent');
             } elseif (isset($_GET['app']) && $_GET['app'] === 'event') {
                 $this->view->commentEvent = $this->model->getCommentEvent((int) $_GET['eid']);
                 return self::display('event');
             }
             if (isset($_POST['saveEventComment']) && $_POST['saveEventComment'] == true) {
                 $this->input = array('comment' => $_POST['comment'], 'eid' => (int) $_POST['eid'], 'uid' => (int) $_POST['uid']);
                 self::checkError();
                 if (!$this->error) {
                     $this->model->saveCommentEvent($this->input);
                     self::sendNotificationEmail('eventComment', $this->input);
                 }
             } elseif (isset($_POST['deleteEventComment']) && $_POST['deleteEventComment'] == true) {
                 $this->input = array('ecid' => (int) $_POST['ecid']);
                 $this->model->deleteCommentEvent($this->input);
             } elseif (isset($_POST['readedEventComment']) && $_POST['readedEventComment'] == true) {
                 $this->model->readedEventComment($this->user['myuid'], (int) $_POST['eid']);
             } elseif (isset($_POST['showEventComment'])) {
                 $this->view->commentEvent = $this->model->getCommentEventNew((int) $_GET['eid']);
                 echo self::display('commentEventNew');
             }
             break;
     }
 }
示例#14
0
 private function checkLoginIndex()
 {
     if ($this->user['login'] === true) {
         parent::redirect('home');
     }
 }
示例#15
0
 public function actionController()
 {
     session_unset();
     parent::redirect('index');
 }
示例#16
0
 private function handlePOST()
 {
     if (isset($_POST['deleteEvent']) && $_POST['deleteEvent'] == true) {
         $this->model->deleteEvent((int) $_POST['ueid']);
     } elseif (isset($_POST['move']) && $_POST['move'] == true) {
         $this->input = array('ueid' => $_POST['ueid'], 'top' => $_POST['top'], 'height' => $_POST['height'], 'left' => $_POST['left']);
         self::prepareEventMoveData();
         $this->model->saveEventMovesData($this->input);
         echo '<small>' . $this->input['top'] . ' - ' . $this->input['bottom'] . '</small>';
     } elseif (isset($_POST['create'])) {
         $this->input = array('attend' => $_POST['attend'], 'name' => $_POST['name'], 'repeating' => $_POST['repeating'], 'days' => $_POST['days'], 'weeks' => $_POST['weeks'], 'timeFrom' => $_POST['timeFrom'], 'timeTo' => $_POST['timeTo'], 'address' => $_POST['address'], 'location' => $_POST['location'], 'website' => $_POST['website'], 'description' => $_POST['description'], 'joinable' => $_POST['joinable'], 'privacy' => $_POST['privacy'], 'searchable' => $_POST['searchable']);
         self::prepareInput();
         self::checkError();
         if (!$this->error) {
             $this->eid = $this->model->saveEvent($this->input);
             self::createEventFolder($this->eid);
             self::uploadEventImage($this->eid);
         }
         parent::redirect('home');
     } elseif (isset($_POST['edit'])) {
         $this->input = array('name' => $_POST['name'], 'timeFrom' => $_POST['timeFrom'], 'timeTo' => $_POST['timeTo'], 'address' => $_POST['address'], 'location' => $_POST['location'], 'website' => $_POST['website'], 'description' => $_POST['description'], 'joinable' => $_POST['joinable'], 'searchable' => $_POST['searchable']);
         self::prepareInput();
         self::checkError();
         if (!$this->error) {
             $this->eid = (int) $_GET['eid'];
             self::checkEventUpdate($this->input, $this->eid);
             $this->model->updateEvent($this->input, $this->eid);
             self::uploadEventImage($this->eid);
         }
         parent::redirect('home?uid=' . (int) $_GET['uid']);
     } elseif (isset($_POST['updateEvent'])) {
         $this->input = array('attend' => $_POST['attend'], 'timeFrom' => $_POST['timeFrom'], 'timeTo' => $_POST['timeTo'], 'privacy' => $_POST['privacy']);
         self::prepareInput();
         if (!empty($this->input['dateFrom'])) {
             $this->model->changeEvent($this->input, (int) $_GET['ueid']);
         }
     } elseif (isset($_POST['duplicate'])) {
         $this->input = array('attend' => $_POST['attend'], 'timeFrom' => $_POST['timeFrom'], 'timeTo' => $_POST['timeTo'], 'privacy' => $_POST['privacy']);
         self::prepareInput();
         $this->model->duplicateEvent($this->input, (int) $_GET['ueid'], (int) $_GET['eid']);
     } elseif (isset($_POST['inviteUser'])) {
         if (isset($_POST['ueid']) && !empty($_POST['ueid'])) {
             $this->input = array('eid' => $_POST['eid'], 'ueid' => $_POST['ueid'], 'inviter' => $this->user['myuid'], 'receiver' => $_POST['receiver']);
             if ($this->model->checkInvited($this->input) === false) {
                 $this->model->inviteEvent($this->input);
                 self::sendNotificationEmail('eventInvitation', $this->input);
             }
         }
     } elseif (isset($_POST['join'])) {
         $this->input = array('attend' => $_POST['attend'], 'timeFrom' => $_POST['timeFrom'], 'timeTo' => $_POST['timeTo'], 'privacy' => $_POST['privacy']);
         self::prepareInput();
         if (!empty($this->input['dateFrom'])) {
             $this->model->deleteEventInvitation((int) $_GET['eid']);
             $this->model->joinEvent($this->input, (int) $_GET['eid']);
         }
     } elseif (isset($_POST['reject']) && $_POST['reject'] == true) {
         $this->model->rejectInvitation((int) $_POST['iid']);
     } elseif (isset($_POST['sendInvite']) && $_POST['sendInvite'] == true) {
         if (!empty($_POST['friends'])) {
             $friendInvitedArray = $_POST['friends'];
         } else {
             $friendInvitedArray = NULL;
         }
         $this->input = array('eid' => (int) $_POST['eid'], 'ueid' => (int) $_POST['ueid'], 'email' => $_POST['email'], 'friends' => $friendInvitedArray);
         self::sendEmailInvitation();
         self::inviteFriend();
     } elseif (isset($_POST['showEventMap'])) {
         $this->view->event = array('name' => $_POST['name'], 'date' => $_POST['date']);
         $this->view->geoData = library_default_classes_googleMaps::getCoordinates($_POST['address']);
         return self::display('eventMap');
     } elseif (isset($_POST['requestEventInvitation'])) {
         $this->model->saveRequestEventInvitation($_POST['eid'], $_POST['ueid']);
     } elseif (isset($_POST['acceptEventInvitationRequest'])) {
         $input = array('eid' => $_POST['eid'], 'ueid' => $_POST['ueid'], 'inviter' => $this->user['myuid'], 'receiver' => $_POST['request']);
         $this->model->inviteEvent($input);
         self::sendNotificationEmail('eventInvitation', $input);
         $this->model->deleteEventInvitationRequest((int) $_POST['id']);
     } elseif (isset($_POST['denyEventInvitationRequest'])) {
         $this->model->deleteEventInvitationRequest((int) $_POST['id']);
     }
 }