public function getInboxAction() { $data = $_POST; $token = isset($data['TOKEN']) ? trim($data['TOKEN']) : null; if (!$token) { return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => buckys_api_get_error_result('Api token should not be blank')]; } if (!($userID = BuckysUsersToken::checkTokenValidity($token, "api"))) { return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('Api token is not valid.')]; } $messages = BuckysMessage::getReceivedMessages($userID, $data['page']); $results = []; foreach ($messages as $row) { $item = []; $item['messageID'] = $row['messageID']; $item['body'] = $row['body']; $item['subject'] = $row['subject']; $item['status'] = $row['status']; $item['sender'] = $row['sender']; $item['senderName'] = $row['senderName']; $item['thumbnail'] = THENEWBOSTON_SITE_URL . BuckysUser::getProfileIcon($row['sender']); $item['created_date'] = buckys_api_format_date($userID, $row['created_date']); $item['type'] = "inbox"; $results[] = $item; } return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => ["STATUS" => "SUCCESS", "RESULT" => $results]]; }
$receiver = BuckysUser::getUserData($_GET['to']); } 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'] == 'delete_messages') { if (!BuckysMessage::deleteMessages($_POST['messageID'])) { buckys_redirect('/messages_inbox.php', "Error: " . $db->getLastError(), MSG_TYPE_ERROR); } else { buckys_redirect('/messages_inbox.php', MSG_MESSAGE_REMOVED, MSG_TYPE_SUCCESS); } exit; } } $page = isset($_GET['page']) ? $_GET['page'] : 1; $totalCount = BuckysMessage::getTotalNumOfMessages($userID, 'inbox'); //Init Pagination Class $pagination = new Pagination($totalCount, BuckysMessage::$COUNT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); $messages = BuckysMessage::getReceivedMessages($userID, $page); buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('info.css'); buckys_enqueue_stylesheet('messages.css'); buckys_enqueue_javascript('messages.js'); $TNB_GLOBALS['content'] = 'messages_inbox'; $TNB_GLOBALS['title'] = "Inbox - " . TNB_SITE_NAME; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
<?php render_footer_link_content('forum', $newNotices); ?> </span> </span> <?php } else { echo '<span class="notificationLinks inactive-notify no-data" id="forum-notifications-icon"><span class="dropDownNotificationList"><span class="nodata">Nothing to see here</span></span></span>'; } ?> <!-- End Forum Notifications --> <?php $newMsgNum = BuckysMessage::getNumOfNewMessages($userID); if ($newMsgNum && $newMsgNum > 0) { $newMails = BuckysMessage::getReceivedMessages($userID, 1, 'unread'); ?> <span class="notificationLinks <?php echo $newMsgNum > 0 ? "new-mails" : "no-mails"; ?> " id="emails-notifications-icon"> <span class="dropDownNotificationList"> <?php render_footer_link_content('mail', $newMails); ?> </span> </span> <?php } else { echo '<span class="notificationLinks no-mails inactive-notify no-data" id="emails-notifications-icon"><span class="dropDownNotificationList"><a href="/messages_inbox.php" class="nodata">No new messages</a></span></span>';