} else { buckys_redirect($return, sprintf(MSG_DAILY_FRIEND_REQUESTS_LIMIT_EXCEED_ERROR, USER_DAILY_LIMIT_FRIEND_REQUESTS), MSG_TYPE_ERROR); } exit; } if (BuckysFriend::sendFriendRequest($userID, $friendID)) { if ($isAjax) { $resultXML = ['status' => 'success', 'message' => MSG_FRIEND_REQUEST_SENT, 'html' => 'Delete Friend Request', 'action' => 'send-friend-request', 'link' => '/myfriends.php?action=delete&friendID=' . $friendID . buckys_get_token_param()]; render_result_xml($resultXML); } else { buckys_redirect($return, MSG_FRIEND_REQUEST_SENT); } } else { if ($isAjax) { $resultXML = ['status' => 'error', 'message' => $db->getLastError()]; render_result_xml($resultXML); } else { buckys_redirect($return, $db->getLastError(), MSG_TYPE_ERROR); } } } } } } } exit; } //Getting UserData from Id $userData = BuckysUser::getUserData($userID); $page = isset($_GET['page']) ? $_GET['page'] : 1; if ($type == 'all') {
exit; } $userInfo = BuckysUser::getUserBasicInfo($userID); if ($userInfo['messenger_privacy'] == 'all') { $result = BuckysPrivateMessenger::blockUser($userID, $cUserID); if (is_array($result)) { render_result_xml(array('status' => 'success', 'type' => 'block', 'id' => $result['userID'], 'name' => $result['firstName'] . " " . $result['lastName'], 'icon' => BuckysUser::getProfileIcon($result))); } else { render_result_xml(array('status' => 'error', 'message' => $result)); } } else { if (($result = BuckysPrivateMessenger::removeUserFromBuddylist($userID, $cUserID)) === true) { //Getting New Messenger Lists render_result_xml(array('status' => 'success', 'type' => 'remove')); } else { render_result_xml(array('status' => 'error', 'message' => $result)); } } exit; } if ($_POST['action'] == 'update-messenger') { $status = isset($_POST['status']) ? $_POST['status'] : ''; if ($status == 'closed') { //Just Get Total Unread Messages $newMessages = BuckysPrivateMessenger::getNewMessageCount($userID); echo '<result>'; echo '<newmessages>' . $newMessages . '</newmessages>'; echo '</result>'; exit; } //Getting Chat Users
} if (isset($_GET['reply'])) { $replyTo = BuckysMessage::getMessage($_GET['reply']); } if (isset($_POST['action'])) { //Check the user id is same with the current logged user id if ($_POST['userID'] != $userID) { echo 'Invalid Request!'; exit; } //Save Address if ($_POST['action'] == 'compose_message') { //Show Results header('Content-type: application/xml'); if (!BuckysMessage::composeMessage($_POST)) { render_result_xml(['status' => 'error', 'message' => buckys_get_messages()]); } else { render_result_xml(['status' => 'success', 'message' => buckys_get_messages()]); } exit; } } buckys_enqueue_stylesheet('jquery-ui/jquery-ui.css'); buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('info.css'); buckys_enqueue_stylesheet('messages.css'); buckys_enqueue_javascript('jquery-ui.min.js'); buckys_enqueue_javascript('messages.js'); $TNB_GLOBALS['content'] = 'messages_compose'; $TNB_GLOBALS['title'] = "Compose Message - " . TNB_SITE_NAME; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
if (!$_POST['objectID'] || !$_POST['objectIDHash'] || !$_POST['objectType'] || !buckys_check_id_encrypted($_POST['objectID'], $_POST['objectIDHash'])) { $data = ['status' => 'error', 'message' => MSG_INVALID_REQUEST]; } else { if ($_POST['objectType'] == 'topic') { $result = BuckysForumTopic::voteTopic($TNB_GLOBALS['user']['userID'], $_POST['objectID'], $_POST['action'] == 'thumb-up' ? 1 : -1); } else { $result = BuckysForumReply::voteReply($TNB_GLOBALS['user']['userID'], $_POST['objectID'], $_POST['action'] == 'thumb-up' ? 1 : -1); } if (is_int($result)) { $data = ['status' => 'success', 'message' => MSG_THANKS_YOUR_VOTE, 'votes' => ($result > 0 ? "+" : "") . $result]; } else { $data = ['status' => 'error', 'message' => $result]; } } } render_result_xml($data); exit; } } else { if (isset($_GET['action']) && $_GET['action'] == 'delete') { //Delete this topic $userID = buckys_is_logged_in(); $topicID = isset($_GET['id']) ? get_secure_integer($_GET['id']) : null; if (isset($topicID)) { $forumTopicIns = new BuckysForumTopic(); $forumData = $forumTopicIns->getTopic($topicID); if (isset($forumData) && $forumData['creatorID'] == $userID) { //then you can delete this one. $forumTopicIns->deleteTopic($topicID); buckys_redirect('/forum', MSG_TOPIC_REMOVED_SUCCESSFULLY, MSG_TYPE_SUCCESS); } else {
if (isset($_POST['action']) && $_POST['action'] == 'submit-post') { //Save Post BuckysPost::savePost($userID, $_POST); if (isset($_POST['pageID']) && is_numeric($_POST['pageID'])) { buckys_redirect('/page.php?pid=' . $_POST['pageID']); } else { buckys_redirect('/account.php'); } } else { if (isset($_GET['action']) && $_GET['action'] == 'delete-post') { //Delete Post if ($userID != $_GET['userID'] || !BuckysPost::deletePost($userID, $_GET['postID'])) { echo 'Invalid Request'; } else { echo 'success'; } exit; } else { if (isset($_GET['action']) && ($_GET['action'] == 'unlikePost' || $_GET['action'] == 'likePost')) { $post = BuckysPost::getPostById($_GET['postID']); if ($post['post_status'] != 1) { render_result_xml(array('status' => 'error', 'message' => MSG_INVALID_REQUEST)); exit; } $r = BuckysPost::likePost($userID, $_GET['postID'], $_GET['action']); $likes = BuckysPost::getPostLikesCount($_GET['postID']); render_result_xml(array('status' => $r ? 'success' : 'error', 'message' => buckys_get_messages(), 'likes' => $likes . " like" . ($likes >= 2 ? "s" : ""), 'postID' => $_GET['postID'])); exit; } } }
exit; } $userInfo = BuckysUser::getUserBasicInfo($userID); if ($userInfo['messenger_privacy'] == 'all') { $result = BuckysPrivateMessenger::blockUser($userID, $cUserID); if (is_array($result)) { render_result_xml(['status' => 'success', 'type' => 'block', 'id' => $result['userID'], 'name' => $result['firstName'] . " " . $result['lastName'], 'icon' => BuckysUser::getProfileIcon($result)]); } else { render_result_xml(['status' => 'error', 'message' => $result]); } } else { if (($result = BuckysPrivateMessenger::removeUserFromBuddylist($userID, $cUserID)) === true) { //Getting New Messenger Lists render_result_xml(['status' => 'success', 'type' => 'remove']); } else { render_result_xml(['status' => 'error', 'message' => $result]); } } exit; } if ($_POST['action'] == 'update-messenger') { $status = isset($_POST['status']) ? $_POST['status'] : ''; if ($status == 'closed') { //Just Get Total Unread Messages $newMessages = BuckysPrivateMessenger::getNewMessageCount($userID); echo '<result>'; echo '<newmessages>' . $newMessages . '</newmessages>'; echo '</result>'; exit; } //Getting Chat Users
<?php require dirname(__FILE__) . '/includes/bootstrap.php'; if (!($userID = buckys_is_logged_in())) { exit; } if ($_POST['action'] == 'activity-notification') { $acount = isset($_POST['acount']) ? intval($_POST['acount']) : 15; $rows = BuckysActivity::getActivities($userID, $acount); $activities = ''; foreach ($rows as $row) { $activities .= BuckysActivity::getActivityHTML($row, $userID); } if (count($rows) == $acount) { $activities .= "<div class='clear'></div><a href='#' class='view-more'>view more</a>"; } $ncount = isset($_POST['ncount']) ? intval($_POST['ncount']) : 15; $rows = BuckysActivity::getNotifications($userID, $ncount); $notifications = ''; foreach ($rows as $row) { $notifications .= BuckysActivity::getActivityHTML($row, $userID); } if (count($rows) == $ncount) { $notifications .= "<div class='clear'></div><a href='#' class='view-more'>view more</a>"; } render_result_xml(['notifications' => $notifications, 'activities' => $activities]); exit; }
header('Content-type: application/xml'); $commentsHTML = ''; foreach ($comments as $comment) { $commentsHTML .= render_single_comment($comment, $userID, true); $lastDate = $comment['posted_date']; } $result = array('comment' => $commentsHTML); render_result_xml(array('comment' => $commentsHTML, 'lastdate' => $lastDate, 'hasmore' => $commentsHTML != '' && BuckysComment::hasMoreComments($postID, $lastDate) ? 'yes' : 'no')); } } else { if ($_GET['action']) { //Delete Post if ($_GET['action'] == 'delete-comment') { if (!$userID) { echo MSG_INVALID_REQUEST; exit; } $postID = $_GET['postID']; $commentID = $_GET['commentID']; $cUserID = $_GET['userID']; if (!BuckysComment::deleteComment($userID, $commentID)) { echo 'Invalid Request'; } else { header('content-type: application/xml'); $newCount = BuckysComment::getPostCommentsCount($postID); render_result_xml(array('commentcount' => $newCount > 1 ? $newCount . " comments" : $newCount . " comment")); } exit; } } }
} if (isset($_GET['reply'])) { $replyTo = BuckysMessage::getMessage($_GET['reply']); } if (isset($_POST['action'])) { //Check the user id is same with the current logged user id if ($_POST['userID'] != $userID) { echo 'Invalid Request!'; exit; } //Save Address if ($_POST['action'] == 'compose_message') { //Show Results header('Content-type: application/xml'); if (!BuckysMessage::composeMessage($_POST)) { render_result_xml(array('status' => 'error', 'message' => buckys_get_messages())); } else { render_result_xml(array('status' => 'success', 'message' => buckys_get_messages())); } exit; } } buckys_enqueue_stylesheet('jquery-ui/jquery-ui.css'); buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('info.css'); buckys_enqueue_stylesheet('messages.css'); buckys_enqueue_javascript('jquery-ui.min.js'); buckys_enqueue_javascript('messages.js'); $BUCKYS_GLOBALS['content'] = 'messages_compose'; $BUCKYS_GLOBALS['title'] = "Compose Message - BuckysRoom"; require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
<?php require dirname(__FILE__) . '/includes/bootstrap.php'; if (!($userID = buckys_is_logged_in())) { exit; } if ($_POST['action'] == 'activity-notification') { $acount = isset($_POST['acount']) ? intval($_POST['acount']) : 15; $rows = BuckysActivity::getActivities($userID, $acount); $activities = ''; foreach ($rows as $row) { $activities .= BuckysActivity::getActivityHTML($row, $userID); } if (count($rows) == $acount) { $activities .= "<div class='clear'></div><a href='#' class='view-more'>view more</a>"; } $ncount = isset($_POST['ncount']) ? intval($_POST['ncount']) : 15; $rows = BuckysActivity::getNotifications($userID, $ncount); $notifications = ''; foreach ($rows as $row) { $notifications .= BuckysActivity::getActivityHTML($row, $userID); } if (count($rows) == $ncount) { $notifications .= "<div class='clear'></div><a href='#' class='view-more'>view more</a>"; } render_result_xml(array('notifications' => $notifications, 'activities' => $activities)); exit; }
if (isset($_GET['action']) && $_GET['action'] == 'verify') { $token = trim($_GET['token']); $email = trim($_GET['email']); if (!$token || !$email) { buckys_redirect("/index.php", MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } BuckysUser::verifyAccount($email, $token); buckys_redirect("/index.php"); } if (isset($_POST['action']) && $_POST['action'] == 'create-account') { //Check Captcha $resp = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { //Create New Account $newID = BuckysUser::createNewAccount($_POST); render_result_xml(array('status' => !$newID ? 'error' : 'success', 'message' => !$newID ? buckys_get_messages() : MSG_NEW_ACCOUNT_CREATED)); } else { render_result_xml(array('status' => 'error', 'message' => '<p class="message error">' . ($resp->error == 'incorrect-captcha-sol' ? 'The captcha input is not correct!' : $resp->error) . '</p>')); } exit; } else { if (isset($_POST['action']) && $_POST['action'] == 'reset-password') { BuckysUser::resetPassword($_POST['email']); } } $showForgotPwdForm = isset($_GET['forgotpwd']) && $_GET['forgotpwd']; buckys_enqueue_stylesheet('register.css'); buckys_enqueue_javascript('register.js'); $BUCKYS_GLOBALS['content'] = 'register'; $BUCKYS_GLOBALS['title'] = 'Register - BuckysRoom'; require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
header('Content-type: application/xml'); $commentsHTML = ''; foreach ($comments as $comment) { $commentsHTML .= render_single_comment($comment, $userID, true); $lastDate = $comment['posted_date']; } $result = ['comment' => $commentsHTML]; render_result_xml(['comment' => $commentsHTML, 'lastdate' => $lastDate, 'hasmore' => $commentsHTML != '' && BuckysComment::hasMoreComments($postID, $lastDate) ? 'yes' : 'no']); } } else { if ($_GET['action']) { //Delete Post if ($_GET['action'] == 'delete-comment') { if (!$userID) { echo MSG_INVALID_REQUEST; exit; } $postID = $_GET['postID']; $commentID = $_GET['commentID']; $cUserID = $_GET['userID']; if (!buckys_check_form_token('request') || !BuckysComment::deleteComment($userID, $commentID)) { echo 'Invalid Request'; } else { header('content-type: application/xml'); $newCount = BuckysComment::getPostCommentsCount($postID); render_result_xml(['commentcount' => $newCount > 1 ? $newCount . " comments" : $newCount . " comment"]); } exit; } } }