$userID = buckys_is_logged_in(); $replyID = isset($_GET['replyID']) ? get_secure_integer($_GET['replyID']) : null; $replyData = $forumReplyIns->getReplyByID($replyID); if ($replyData && $replyData['creatorID'] == $userID && $replyData['topicID'] == $topicID) { //then you can edit this one $view['replyData'] = $replyData; $view['action_type'] = 'edit'; $view['replyID'] = $replyID; } else { //permission error buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } } } } if (!isset($replyData) || !$replyData) { buckys_redirect("/forum", MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } $topicData = BuckysForumTopic::getTopic($replyData['replyID']); $category = BuckysForumCategory::getCategory($topicData['categoryID']); $categories = BuckysForumCategory::getAllCategories(); buckys_enqueue_stylesheet('sceditor/themes/default.css'); buckys_enqueue_stylesheet('forum.css'); buckys_enqueue_stylesheet('publisher.css'); buckys_enqueue_stylesheet('uploadify.css'); buckys_enqueue_javascript('sceditor/jquery.sceditor.bbcode.js'); buckys_enqueue_javascript('uploadify/jquery.uploadify.js'); $TNB_GLOBALS['headerType'] = 'forum'; $TNB_GLOBALS['content'] = 'forum/post_reply'; $TNB_GLOBALS['title'] = 'Post Reply - thenewboston Forum'; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
} else { $data = array('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 { //You don't have permission buckys_redirect('/forum/topic.php?id=' . $topicID, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } } } } $topicID = isset($_GET['id']) ? $_GET['id'] : 0; $topic = BuckysForumTopic::getTopic($topicID); if (!$topic) { buckys_redirect('/forum');
$topicID = isset($_GET['id']) ? buckys_escape_query_integer($_GET['id']) : null; $catID = isset($_GET['category']) ? buckys_escape_query_integer($_GET['category']) : null; if (!$topicID) { buckys_redirect('/forum', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } if (!$catID || !($category = BuckysForumCategory::getCategory($catID))) { buckys_redirect('/forum/topic.php?id=' . $topicID, MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } $forumTopicIns = new BuckysForumTopic(); $forumTopicIns->moveTopic($topicID, $catID); buckys_redirect('/forum/topic.php?id=' . $topicID, MSG_TOPIC_MOVED_SUCCESSFULLY); } } } $topicID = isset($_GET['id']) ? buckys_escape_query_integer($_GET['id']) : 0; $topic = BuckysForumTopic::getTopic($topicID); if (!$topic) { buckys_redirect('/forum'); } $category = BuckysForumCategory::getCategory($topic['categoryID']); //If the topic is not published(pending or suspended), only forum moderator and administrator can see this if ($topic['status'] != 'publish' && !buckys_is_moderator() && $TNB_GLOBALS['user']['userID'] != $topic['creatorID']) { buckys_redirect('/forum'); } $orderBy = isset($_GET['orderby']) ? buckys_escape_query_string($_GET['orderby']) : 'oldest'; //Getting Replies $page = isset($_GET['page']) ? buckys_escape_query_integer($_GET['page']) : 1; $total = BuckysForumReply::getTotalNumOfReplies($topic['topicID'], 'publish'); $pagination = new Pagination($total, BuckysForumReply::$COUNT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); $replies = BuckysForumReply::getReplies($topic['topicID'], 'publish', $page, $orderBy);
echo $pagination->renderPaginate('/forum/pending_replies.php?', count($replies)); ?> </td> </tr> <tr> <td colspan="6"> <input type="button" id="approve-btn" value="Approve" class="redButton" style="margin-right:5px;"/> <input type="button" id="delete-btn" value="Delete" class="redButton"/> </td> </tr> </tfoot> <tbody> <?php foreach ($replies as $row) { $trow = BuckysForumTopic::getTopic($row['topicID']); ?> <tr> <td class="td-chk"> <input type="checkbox" name="rid[]" value="<?php echo $row['replyID']; ?> "/></td> <td> <a href="/forum/topic.php?id=<?php echo $trow['topicID']; ?> "><?php echo $trow['topicTitle']; ?> </a>