/** * @return array */ public static function getReportedItemsCount() { global $db; $userID = buckys_is_logged_in(); if (!$userID) { return []; } if (buckys_is_admin() || buckys_is_moderator()) { $categoryWhere = ''; } else { //Getting the categories that user can moderate $query = $db->prepare("SELECT categoryID FROM " . TABLE_FORUM_MODERATORS . " WHERE userID=%d", $userID); $categories = $db->getResultsArray($query); if (!$categories) { return []; } $categoryWhere = []; foreach ($categories as $c) { $categoryWhere[] = $c['categoryID']; } $categoryWhere = ' AND t.categoryID IN (' . implode(',', $categories) . ')'; } $query = "SELECT count(DISTINCT(r.reportID)) AS c, t.categoryID\n FROM " . TABLE_REPORTS . " AS r " . "LEFT JOIN " . TABLE_FORUM_TOPICS . " AS t ON t.topicID=r.objectID " . "WHERE r.objectType='topic' AND r.reportStatus=1 " . $categoryWhere . " GROUP BY categoryID "; $topics = $db->getResultsArray($query); $query = "SELECT count(DISTINCT(r.reportID)) AS c, t.categoryID\n FROM " . TABLE_REPORTS . " AS r " . "LEFT JOIN " . TABLE_FORUM_REPLIES . " AS fr ON fr.replyID=r.objectID " . "LEFT JOIN " . TABLE_FORUM_TOPICS . " AS t ON t.topicID=fr.topicID " . "WHERE r.objectType='reply' AND r.reportStatus=1 " . $categoryWhere . " GROUP BY categoryID "; $replies = $db->getResultsArray($query); $results = []; foreach ($topics as $row) { if (!isset($results[$row['categoryID']])) { $results[$row['categoryID']] = 0; } $results[$row['categoryID']] += $row['c']; } foreach ($replies as $row) { if (!isset($results[$row['categoryID']])) { $results[$row['categoryID']] = 0; } $results[$row['categoryID']] += $row['c']; } return $results; }
if (isset($_POST['link_title'])) { foreach ($_POST['link_title'] as $i => $link_title) { $link_url = $_POST['link_url'][$i]; if (!$link_url || !$link_title) { continue; } BuckysForumCategory::saveCategoryLink($categoryID, $link_title, $link_url); } } buckys_redirect("/forum/category.php?id=" . $categoryID, MSG_FORUM_SAVED, MSG_TYPE_SUCCESS); } $categoryID = isset($_GET['id']) ? $_GET['id'] : null; if ($categoryID != null) { $category = BuckysForumCategory::getCategory($categoryID); //Check Permission if (!$category || !buckys_is_admin() && !buckys_is_moderator() && !buckys_is_forum_admin($category['categoryID']) && !buckys_is_forum_moderator($category['categoryID'])) { buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } } buckys_enqueue_stylesheet('sceditor/themes/default.css'); buckys_enqueue_stylesheet('forum.css'); buckys_enqueue_stylesheet('posting.css'); buckys_enqueue_stylesheet('publisher.css'); buckys_enqueue_stylesheet('uploadify.css'); buckys_enqueue_stylesheet('jquery.Jcrop.css'); buckys_enqueue_javascript('sceditor/jquery.sceditor.bbcode.js'); buckys_enqueue_javascript('uploadify/jquery.uploadify.js'); buckys_enqueue_javascript('jquery.Jcrop.js'); buckys_enqueue_javascript('edit_forum.js'); $TNB_GLOBALS['headerType'] = 'forum'; $TNB_GLOBALS['content'] = 'forum/edit_category';
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); $hierarchical = BuckysForumCategory::getCategoryHierarchical($topic['categoryID']); //Mark Forum Notifications to read if (buckys_check_user_acl(USER_ACL_REGISTERED)) { BuckysForumNotification::makeNotificationsToRead($TNB_GLOBALS['user']['userID'], null, $topic['topicID']); } if (buckys_check_user_acl(USER_ACL_MODERATOR)) {
<?php } ?> </td> </tr> <?php } ?> </table> <!-- Moderator --> <?php if ($userID = buckys_is_logged_in()) { ?> <?php if (!(buckys_is_admin() || buckys_is_moderator() || buckys_is_forum_admin($category['categoryID']) || buckys_is_forum_moderator($category['categoryID']))) { ?> <?php if (BuckysForumModerator::isAppliedToModerate($category['categoryID'])) { ?> <!-- already applied to moderate --> <a href="javascript: void(0)" class="forum-action-button forum-action-button-inactive" title="Already applied to moderate">apply to moderate</a> <?php } else { ?> <a href="/forum/moderator.php?action=apply-moderate&<?php echo buckys_get_form_token(); ?> =1&id=<?php echo $category['categoryID'];
<?php if (!isset($TNB_GLOBALS)) { die("Invalid Request!"); } //Check Permissions if (buckys_is_admin() || buckys_is_moderator() || buckys_is_forum_admin($topic['categoryID']) || buckys_is_forum_moderator($topic['categoryID'])) { $can_block_user = true; $currentUserID = buckys_is_logged_in(); } else { $can_block_user = false; $currentUserID = null; } ?> <!-- Go to www.addthis.com/dashboard to customize your tools <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-53c94706485ac73e"></script> --> <section id="main_section" class="forum-main-section"> <ul id="forum-nav"> <li class="current"><a href="/forum">Home</a></li> <li><a href="/forum/search_topics.php">Search Topics</a></li> <li><a href="/forum/search_forums.php">Browse Forums</a></li> </ul> <!-- Forum Left Menu Bar --> <?php buckys_get_panel('forum_left_panel', ['category' => $category]); ?>
if (buckys_is_logged_in()) { ?> <dd> <a href="/forum/add_forum.php" style="font-family:OpenSans-Bold; color:#f2f2f2;" <?php echo $TNB_GLOBALS['content'] == 'forum/edit_category' && !isset($categoryID) ? 'class="current"' : ''; ?> >Create a New Category +</a> </dd> <div class="menu-item-divider"></div> <?php } ?> <?php if (buckys_is_admin() || buckys_is_moderator() || isset($category) && (buckys_is_forum_admin($category['categoryID']) || buckys_is_forum_moderator($category['categoryID']))) { $reportedItemsCount = BuckysForumModerator::getReportedItemsCount(); } ?> <?php foreach ($followingCategories as $crow) { ?> <?php if ($crow['parentID'] == 0) { continue; } ?> <dd> <a href="/forum/category.php?id=<?php echo $crow['categoryID']; ?>