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 _index() { // Deny access if not logged in new Protect('ajax'); $post = Input::post(); $token = Token::ajaxCheck($post['token']); $data['success'] = FALSE; $data['errors'] = NULL; if (!empty($post['username'] && $token === TRUE)) { $follow = User::follow($post['username']); if ($follow === TRUE) { $data['success'] = TRUE; } else { $data['errors'][] = $follow; } } else { if (!$token) { $data['errors'][] = 'Security Token Missing'; } else { $data['errors'][] = 'Username Required'; } } if (!empty($data)) { return $data; } else { return FALSE; } }
public function send() { new Protect('ajax'); if (Input::exists()) { if (Token::ajaxCheck(Input::post('token'))) { // TODO: Check for empty messages, Validate messages $username = Input::post('username'); $msg = Input::post('msg'); if (!empty($username)) { Message::sendMessage($username, $msg); Notif::raiseMsgNotif(User::getPublicUserId($username)); } else { return 'Username Required'; } } else { return 'Security Token Missing'; } } return FALSE; }