header('Content-type: application/xml'); $cUserID = isset($_POST['userID']) ? $_POST['userID'] : null; $cUserIDHash = isset($_POST['idHash']) ? $_POST['idHash'] : null; if (!buckys_not_null($cUserID) || !buckys_not_null($cUserID) || !buckys_check_id_encrypted($cUserID, $cUserIDHash)) { render_result_xml(array('status' => 'error', 'message' => MSG_INVALID_REQUEST)); } else { $result = BuckysPrivateMessenger::closeConversationBox($cUserID); if ($result === true) { //Already exist render_result_xml(array('status' => 'success')); } } buckys_exit(); } if ($_POST['action'] == 'close-all-conversation') { $result = BuckysPrivateMessenger::closeConversationBox(); if ($result === true) { //Already exist render_result_xml(array('status' => 'success')); } buckys_exit(); } //Send Message if ($_POST['action'] == 'send-message') { header('Content-type: application/xml'); $receiverID = isset($_POST['userID']) ? $_POST['userID'] : null; $receiverIDEncrypted = isset($_POST['encrypted']) ? $_POST['encrypted'] : null; if (!$receiverID || !$receiverIDEncrypted || !buckys_check_id_encrypted($receiverID, $receiverIDEncrypted)) { render_result_xml(array('status' => 'error', 'message' => MSG_INVALID_REQUEST)); exit; }
/** * Remove the user from buddylist * * @param Int $userID = Blocker ID * @param Int $blockedID * @return String or Array */ public function removeUserFromBuddylist($userID, $buddyID) { global $db; $query = $db->prepare("SELECT messengerBuddylistID FROM " . TABLE_MESSENGER_BUDDYLIST . " WHERE userID=%d AND buddyID=%d", $userID, $buddyID); $mbID = $db->getVar($query); if (!buckys_not_null($mbID)) { return MSG_INVALID_REQUEST; } //Check buddyID if (!BuckysUser::checkUserID($buddyID)) { return MSG_INVALID_REQUEST; } //Remove User from the buddylist if (!$db->query($db->prepare("DELETE FROM " . TABLE_MESSENGER_BUDDYLIST . " WHERE userID=%d AND buddyID=%d", $userID, $buddyID))) { return $db->getLastError(); } else { //Update Buddylist status $db->query($db->prepare("UPDATE " . TABLE_MESSENGER_BUDDYLIST . " SET `status`=0 WHERE userID=%d AND buddyID=%d", $buddyID, $userID)); //Remove From the Conversation List BuckysPrivateMessenger::closeConversationBox($buddyID); return true; } }