public function _index() { // Deny access if not logged in new Protect('ajax'); $post = Input::post(); $token = Token::ajaxCheck($post['token']); // TODO: Add Token Support $token = TRUE; $data['errors'] = NULL; if (!empty($post['username'] && $token === TRUE)) { $t = Search::publicUsername($post['username']); foreach ($t as $key => $value) { $t[$key]['profile_pic'] = User::getProfilePic($value['profile_pic']); } return $t; } else { if (!$token) { $data['errors'][] = 'Security Token Missing'; } else { $data['errors'][] = 'Username Required'; } } if (!empty($data)) { return $data; } else { return FALSE; } }
public function __construct($url) { $user_data = User::getUserData(['username', 'first_name', 'last_name', 'user_id', 'email', 'profile_pic'])[0]; $this->data['title'] = 'Question - NCube School'; $this->data['first_name'] = ucwords($user_data['first_name']); $this->data['last_name'] = ucwords($user_data['last_name']); $this->data['token'] = Token::generate(); $this->data['username'] = $user_data['username']; $this->data['side_active']['questions'] = ' active'; $this->data['profile_pic'] = User::getProfilePic($user_data['profile_pic']); $this->data['question'] = Question::getPublicQuestion($url[0])[0]; $this->data['q_user'] = User::getPublicUserData($this->data['question']['user_id'])[0]; $this->data['q_user']['profile_pic'] = User::getProfilePic($this->data['q_user']['profile_pic']); $this->data['question']['up_count'] = Question::getVoteUpCount($this->data['question']['q_id']); $this->data['question']['down_count'] = Question::getVoteDownCount($this->data['question']['q_id']); $this->data['question']['level'] = Question::getDifficultyLevel($this->data['question']['q_id']); $this->data['question']['answers_count'] = Question::getAnswersCount($this->data['question']['q_id']); $answers = Question::getAnswers($this->data['question']['q_id']); foreach ($answers as $key => $value) { $answers[$key]['user'] = User::getPublicUserData($value['user_id'])[0]; $answers[$key]['user']['profile_pic'] = User::getProfilePic($answers[$key]['user']['profile_pic']); } $this->data['answers'] = $answers; require_once 'include/header.php'; }
public function __construct() { $user_data = User::getUserData(['username', 'first_name', 'last_name', 'user_id', 'email', 'profile_pic'])[0]; $this->data['title'] = 'Questions - NCube School'; $this->data['first_name'] = ucwords($user_data['first_name']); $this->data['last_name'] = ucwords($user_data['last_name']); $this->data['token'] = Token::generate(); $this->data['username'] = $user_data['username']; $this->data['side_active']['questions'] = ' active'; $this->data['profile_pic'] = User::getProfilePic($user_data['profile_pic']); require_once 'include/header.php'; $questions = Question::getPublicQuestions(); foreach ($questions as $key => $value) { $questions[$key]['up_count'] = Question::getVoteUpCount($value['q_id']); $questions[$key]['down_count'] = Question::getVoteDownCount($value['q_id']); $questions[$key]['level'] = Question::getDifficultyLevel($value['q_id']); $questions[$key]['user_data'] = User::getPublicUserData($value['user_id'], ['profile_pic', 'first_name', 'last_name'])[0]; $questions[$key]['answers'] = Question::getAnswersCount($value['q_id']); $questions[$key]['pic'] = User::getProfilePic($questions[$key]['user_data']['profile_pic']); $vote = Question::getVote($value['q_id']); if ($vote == 1) { $questions[$key]['my_data']['vote_up_class'] = 'vote-up-active'; } else { if ($vote == 0) { $questions[$key]['my_data']['vote_down_class'] = 'vote-down-active'; } } } $this->data['questions'] = $questions; }
public function __construct() { $user_data = User::getUserData(['username', 'first_name', 'last_name', 'user_id', 'email', 'profile_pic'])[0]; $this->data['title'] = 'Home - NCube School'; $this->data['first_name'] = ucwords($user_data['first_name']); $this->data['last_name'] = ucwords($user_data['last_name']); $this->data['token'] = Token::generate(); $this->data['username'] = $user_data['username']; $this->data['side_active']['home'] = ' active'; $this->data['profile_pic'] = User::getProfilePic($user_data['profile_pic']); require_once 'include/header.php'; }
public function _index() { new Protect('ajax'); $notif = Notif::getUnread(); usort($notif, function ($b, $a) { return $a['time'] - $b['time']; }); foreach ($notif as $key => $value) { $notif[$key]['profile_pic'] = User::getProfilePic($value['profile_pic']); $notif[$key]['time'] = date("d M h:i A", $value['time']); $notif[$key]['first_name'] = ucwords($value['first_name']); $notif[$key]['last_name'] = ucwords($value['last_name']); switch ($value['type']) { case 'F': $msg = 'is following you'; $link = '/profile/' . $value['username']; break; case 'RC': $msg = 'wants to add you as Classmate'; $link = '/requests/'; break; case 'RT': $msg = 'wants to add you as Teacher'; $link = '/requests/'; break; case 'RS': $msg = 'wants to add you as Student'; $link = '/requests/'; break; case 'RF': $msg = 'wants to add you as Friend'; $link = '/requests/'; break; case 'RP': $msg = 'wants to add you as Parent or Guardian'; $link = '/requests/'; break; default: $msg = ''; $link = '#'; break; } $notif[$key]['msg'] = $msg; $notif[$key]['link'] = $link; } $data['data'] = $notif; $data['count'] = Notif::getUnreadCount(); return $data; }
public function _index() { new Protect('ajax'); $notifMsg = Notif::getUnreadMsg(); foreach ($notifMsg as $key => $value) { $notifMsg[$key]['profile_pic'] = User::getProfilePic($value['profile_pic']); $notifMsg[$key]['first_name'] = ucwords($value['first_name']); $notifMsg[$key]['last_name'] = ucwords($value['last_name']); $notifMsg[$key]['time'] = date("d M h:i A", $value['time']); } $data['data'] = $notifMsg; $data['count'] = Notif::getUnreadMsgCount(); usort($notifMsg, function ($b, $a) { return $a['time'] - $b['time']; }); return $data; }
public function __construct($url) { $user_data = User::getUserData(['username', 'first_name', 'last_name', 'user_id', 'email', 'profile_pic'])[0]; $this->data['title'] = 'Requests - NCube School'; $this->data['first_name'] = ucwords($user_data['first_name']); $this->data['last_name'] = ucwords($user_data['last_name']); $this->data['email'] = $user_data['email']; $this->data['token'] = Token::generate(); $this->data['username'] = $user_data['username']; $this->data['url'] = $url; require_once 'include/header.php'; $this->data['side_active']['requests'] = ' active'; $this->data['profile_pic'] = User::getProfilePic($user_data['profile_pic']); $user_id = Session::get('user_id'); $requests = User::getRequests(); foreach ($requests as $key => $value) { $requests[$key]['user_data'] = User::getPublicUserData($value['user_id'])[0]; if (empty($value['user_data']['profile_pic'])) { $requests[$key]['user_data']['profile_pic'] = '/public/images/profile-pic.png'; } else { $requests[$key]['user_data']['profile_pic'] = '/data/images/profile/' . $value['user_data']['profile_pic'] . '.jpg'; } switch ($value['type']) { case 'C': $requests[$key]['type'] = 'Classmate'; break; case 'T': $requests[$key]['type'] = 'Teacher'; break; case 'S': $requests[$key]['type'] = 'Student'; break; case 'F': $requests[$key]['type'] = 'Friend'; break; case 'P': $requests[$key]['type'] = 'Parent or Guardian'; break; default: $requests[$key]['type'] = ''; break; } } $this->data['requests'] = $requests; }
public function __construct($url) { $user_data = User::getUserData(['username', 'first_name', 'last_name', 'user_id', 'email', 'profile_pic'])[0]; $this->data['title'] = 'Settings - NCube School'; $this->data['first_name'] = ucwords($user_data['first_name']); $this->data['last_name'] = ucwords($user_data['last_name']); $this->data['email'] = $user_data['email']; $this->data['token'] = Token::generate(); $this->data['username'] = $user_data['username']; $this->data['url'] = $url; require_once 'include/header.php'; $this->data['side_active']['settings'] = ' active'; $this->data['active'] = NULL; if (!empty($url[0])) { $this->data['active'][$url[0]] = ' stngs-menu-item-active'; } $this->data['profile_pic'] = User::getProfilePic($user_data['profile_pic']); }
public function __construct($username) { $user_id = Session::get('user_id'); $user_data = User::getPublicUserData($user_id)[0]; $this->data['title'] = ucwords($username); $this->data['username'] = $user_data['username']; $this->data['token'] = Token::generate(); $this->data['side_active']['profile'] = ' active'; require_once 'include/header.php'; $this->data['first_name'] = ucwords($user_data['first_name']); $this->data['last_name'] = ucwords($user_data['last_name']); $this->data['email'] = $user_data['email']; $this->data['profile_pic'] = User::getProfilePic($user_data['profile_pic']); $profile_id = User::getPublicUserId($username); $profile_data = User::getPublicUserData($profile_id)[0]; $this->data['profile_data']['username'] = $username; $this->data['profile_data']['first_name'] = ucwords($profile_data['first_name']); $this->data['profile_data']['last_name'] = ucwords($profile_data['last_name']); $this->data['profile_data']['email'] = $profile_data['email']; $this->data['profile_data']['profile_pic'] = User::getProfilePic($profile_data['profile_pic']); $this->data['profile_data']['follow'] = User::checkFollow($username); $this->data['profile_data']['dob'] = $profile_data['dob']; //date in mm/dd/yyyy format; or it can be in other formats as well $birthDate = $profile_data['dob']; //explode the date to get month, day and year $birthDate = explode("-", $birthDate); //get age from date or birthdate $this->data['profile_data']['age'] = date("md", date("U", mktime(0, 0, 0, $birthDate[2], $birthDate[1], $birthDate[0]))) > date("md") ? date("Y") - $birthDate[0] - 1 : date("Y") - $birthDate[0]; $this->data['profile_data']['country'] = $profile_data['country']; switch ($profile_data['gender']) { case 'M': $this->data['profile_data']['gender'] = 'Male'; break; case 'F': $this->data['profile_data']['gender'] = 'Female'; break; case 'O': $this->data['profile_data']['gender'] = 'Others'; break; default: break; } }
public function __construct($url) { $user_data = User::getUserData(['username', 'first_name', 'last_name', 'user_id', 'email', 'profile_pic'])[0]; $this->data['first_name'] = ucwords($user_data['first_name']); $this->data['last_name'] = ucwords($user_data['last_name']); $this->data['side_active']['messages'] = ' active'; $this->data['profile_pic'] = User::getProfilePic($user_data['profile_pic']); require_once 'include/header.php'; $this->data['title'] = 'Messages - Ncube'; $this->data['token'] = Token::generate(); $this->data['active_username'] = $url[0]; $this->data['list_data'] = User::getAcceptedUsersData(); if (!empty($url[0])) { $data = Message::getMessages($url[0]); foreach ($data as $key => $value) { $data[$key]['time'] = date("h:i A", $value['time']); } $this->data['msgs'] = $data; } $this->data['recipient'] = $url[0]; }
$link = '/requests/'; break; case 'RS': $msg = 'wants to add you as Student'; $link = '/requests/'; break; case 'RF': $msg = 'wants to add you as Friend'; $link = '/requests/'; break; case 'RP': $msg = 'wants to add you as Parent or Guardian'; $link = '/requests/'; break; default: $msg = ''; $link = '#'; break; } $notif[$key]['msg'] = $msg; $notif[$key]['link'] = $link; } $this->data['notif'] = $notif; $this->data['notif_count'] = Notif::getUnreadCount(); $notifMsg = Notif::getUnreadMsg(); foreach ($notifMsg as $key => $value) { $notifMsg[$key]['profile_pic'] = User::getProfilePic($value['profile_pic']); $notifMsg[$key]['time'] = date("d M h:i A", $value['time']); } $this->data['notif_msg'] = $notifMsg; $this->data['notif_msg_count'] = Notif::getUnreadMsgCount();
<?php // need to replace welcome base on openID or FB connect (can have a pic) prevent_cache_headers(); // checks that fb key, secret, callback url as they should be if (is_fbconnect_enabled()) { ensure_loaded_on_correct_url(); } $fb_uid = facebook_client()->get_loggedin_user(); if ($fb_uid && !$_SESSION[fbname]) { $user_params = array(); $user_params['fb_uid'] = $fb_uid; //$user_params['name'] = $; $fbname = new User($user_params); $_SESSION[fbname] = $fbname->getName(); $_SESSION[fbpic] = $fbname->getProfilePic(true); } //print_r($_SESSION); if ($fb_uid && $_SESSION[fbname]) { echo 'Welcome <b> '; echo $_SESSION[fbname]; echo '</b>'; echo $_SESSION[fbpic]; } else { echo "Welcome <b>{$_SESSION['username']}</b> to lifestyle linking."; } ?> <a href="/lifestylelinking/me/index.php" id="current">home</a> · <a href="/lifestylelinking/me/memprofile.php">profile</a> · <a href="/lifestylelinking/me/memprivacy.php">privacy</a> ·
public function _index() { new Protect(); // Add Token Check $notif = Notif::getUnread(); usort($notif, function ($b, $a) { return $a['time'] - $b['time']; }); foreach ($notif as $key => $value) { $notif[$key]['profile_pic'] = User::getProfilePic($value['profile_pic']); $notif[$key]['time'] = date("d M h:i A", $value['time']); $notif[$key]['first_name'] = ucwords($value['first_name']); $notif[$key]['last_name'] = ucwords($value['last_name']); switch ($value['type']) { case 'F': $msg = 'is following you'; $link = '/profile/' . $value['username']; break; case 'RC': $msg = 'wants to add you as Classmate'; $link = '/requests/'; break; case 'RT': $msg = 'wants to add you as Teacher'; $link = '/requests/'; break; case 'RS': $msg = 'wants to add you as Student'; $link = '/requests/'; break; case 'RF': $msg = 'wants to add you as Friend'; $link = '/requests/'; break; case 'RP': $msg = 'wants to add you as Parent or Guardian'; $link = '/requests/'; break; default: $msg = ''; $link = '#'; break; } $notif[$key]['msg'] = $msg; $notif[$key]['link'] = $link; } $data['notif'] = $notif; $data['notif_count'] = Notif::getUnreadCount(); // Messages $notifMsg = Notif::getUnreadMsg(); foreach ($notifMsg as $key => $value) { $notifMsg[$key]['profile_pic'] = User::getProfilePic($value['profile_pic']); $notifMsg[$key]['first_name'] = ucwords($value['first_name']); $notifMsg[$key]['last_name'] = ucwords($value['last_name']); $notifMsg[$key]['time'] = date("d M h:i A", $value['time']); } usort($notifMsg, function ($b, $a) { return $a['time'] - $b['time']; }); $data['notif_msg'] = $notifMsg; $data['notif_msg_count'] = Notif::getUnreadMsgCount(); // User Data $data['user'] = User::getUserData(['first_name', 'last_name', 'profile_pic'])[0]; $data['user']['profile_pic'] = User::getProfilePic($data['user']['profile_pic']); // Questions $questions = Question::getPublicQuestions(); foreach ($questions as $key => $value) { $questions[$key]['up_count'] = Question::getVoteUpCount($value['q_id']); $questions[$key]['down_count'] = Question::getVoteDownCount($value['q_id']); $questions[$key]['level'] = Question::getDifficultyLevel($value['q_id']); $questions[$key]['user_data'] = User::getPublicUserData($value['user_id'], ['profile_pic', 'first_name', 'last_name'])[0]; $questions[$key]['answers'] = Question::getAnswersCount($value['q_id']); $questions[$key]['pic'] = User::getProfilePic($questions[$key]['user_data']['profile_pic']); $vote = Question::getVote($value['q_id']); if ($vote == 1) { $questions[$key]['my_data']['vote_up_class'] = 'vote-up-active'; } else { if ($vote == 0) { $questions[$key]['my_data']['vote_down_class'] = 'vote-down-active'; } } } $data['questions'] = $questions; return $data; }