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)) {
    $reportID = BuckysReport::isReported($topicID, 'topic');
    $categories = BuckysForumCategory::getAllCategories();
}
buckys_enqueue_javascript('sceditor/jquery.sceditor.bbcode.js');
buckys_enqueue_javascript('uploadify/jquery.uploadify.js');
buckys_enqueue_javascript('highlight.pack.js');
buckys_enqueue_javascript('forum.js');
buckys_enqueue_stylesheet('sceditor/themes/default.css');
buckys_enqueue_stylesheet('obsidian.css');
buckys_enqueue_stylesheet('forum.css');
buckys_enqueue_stylesheet('publisher.css');
buckys_enqueue_stylesheet('uploadify.css');
$TNB_GLOBALS['headerType'] = 'forum';
$TNB_GLOBALS['content'] = 'forum/topic';
$TNB_GLOBALS['title'] = $topic['topicTitle'] . ' - thenewboston Forum';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
     if (!(buckys_is_admin() || buckys_is_moderator() || buckys_is_forum_admin($category['categoryID']) || buckys_is_forum_moderator($category['categoryID']))) {
         buckys_redirect('/forum/category.php?id=' . $categoryID, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
     }
     BuckysReport::deleteObjects($_REQUEST['reportID']);
     buckys_redirect("/forum/moderator.php?id=" . $categoryID, MSG_REPORTED_OBJECT_REMOVED);
 } else {
     if ($_REQUEST['action'] == 'Approve') {
         //Check forum token
         if (!buckys_check_form_token('request')) {
             buckys_redirect('/forum/category.php?id=' . $categoryID, MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
         }
         //Admin, Site Moderator, Category Admin and Category Moderator can't apply
         if (!(buckys_is_admin() || buckys_is_moderator() || buckys_is_forum_admin($category['categoryID']) || buckys_is_forum_moderator($category['categoryID']))) {
             buckys_redirect('/forum/category.php?id=' . $categoryID, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
         }
         BuckysReport::approveObjects($_REQUEST['reportID']);
         buckys_redirect("/forum/moderator.php?id=" . $categoryID, MSG_REPORTED_OBJECT_APPROVED);
     } else {
         if ($_REQUEST['action'] == 'block-user') {
             $return = isset($_REQUEST['return']) ? base64_decode($_REQUEST['return']) : '/forum/category.php?id=' . $categoryID;
             //Check forum token
             if (!buckys_check_form_token('request')) {
                 buckys_redirect($return, MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
             }
             //Admin, Site Moderator, Category Admin and Category Moderator can't be blocked
             if (!(buckys_is_admin() || buckys_is_moderator() || buckys_is_forum_admin($category['categoryID']) || buckys_is_forum_moderator($category['categoryID']))) {
                 buckys_redirect($return, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
             }
             $blockedUserID = buckys_escape_query_integer($_REQUEST['userID']);
             if ($blockedUserID == $userID) {
                 buckys_redirect($return, MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
    //Get my created pages link
    $pageIns = new BuckysPage();
    $pageList = $pageIns->getPagesByUserId($userID);
    if (count($pageList) > 0) {
        foreach ($pageList as $pageD) {
            echo sprintf('<a href="/page.php?pid=%d" class="accountSubLinks">%s</a><br/>', $pageD['pageID'], $pageD['title']);
        }
    }
    ?>

        <!-- Control Panel-->
        <?php 
    if (buckys_check_user_acl(USER_ACL_MODERATOR)) {
        ?>
            <?php 
        $reportedItems = BuckysReport::getReportedObjectCount();
        $pendingAds = BuckysAds::getPendingAdsCount();
        ?>
            <h6>Moderator Panel</h6>
            <a href="/reported.php"
                class="accountSubLinks<?php 
        echo $reportedItems > 0 ? 'Bold' : '';
        ?>
">Reported Items<?php 
        echo $reportedItems > 0 ? ' (' . $reportedItems . ')' : '';
        ?>
</a>
            <br/>
            <a href="/manage_ads.php"
                class="accountSubLinks<?php 
        echo $pendingAds > 0 ? 'Bold' : '';
Exemple #4
0
        buckys_redirect('/reported.php?type=' . $reportType, MSG_REPORTED_OBJECT_REMOVED);
    } else {
        if ($_REQUEST['action'] == 'approve-objects') {
            BuckysReport::approveObjects($_REQUEST['reportID'], $reportType, $moderatorType);
            buckys_redirect('/reported.php?type=' . $reportType, MSG_REPORTED_OBJECT_APPROVED);
        } else {
            if ($_REQUEST['action'] == 'ban-users') {
                BuckysReport::banUsers($_REQUEST['reportID'], $reportType, $moderatorType);
                buckys_redirect('/reported.php?type=' . $reportType, MSG_BAN_USERS);
            }
        }
    }
    exit;
}
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$totalCount = BuckysReport::getReportedObjectCount($reportType);
//Init Pagination Class
$pagination = new Pagination($totalCount, BuckysReport::$COUNT_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
$objects = BuckysReport::getReportedObject($reportType, $page, BuckysReport::$COUNT_PER_PAGE);
buckys_enqueue_stylesheet('account.css');
buckys_enqueue_stylesheet('moderator.css');
buckys_enqueue_stylesheet('moderator.css');
buckys_enqueue_stylesheet('prettify.css');
buckys_enqueue_javascript('prettyprint/run_prettify.js?skin=default&amp;');
buckys_enqueue_javascript('reported.js');
$BUCKYS_GLOBALS['content'] = 'reported';
//Reported Object Type Label
$reportLabel = array('post' => array('Post', 'Posts'), 'comment' => array('Comment', 'Comments'), 'message' => array('Message', 'Messages'), 'topic' => array('Topic', 'Topics'), 'reply' => array('Reply', 'Replies'));
$BUCKYS_GLOBALS['title'] = "Manage Reported " . $reportLabel[$reportType][1] . " - BuckysRoom";
require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
function render_single_comment($comment, $userID = null, $isReturn = false)
{
    global $TNB_GLOBALS;
    $timeOffset = 0;
    if (buckys_not_null($userID)) {
        $userInfo = BuckysUser::getUserBasicInfo($userID);
        $timeOffset = $TNB_GLOBALS['timezone'][$userInfo['timezone']];
    }
    ob_start();
    ?>
    <div class="comment-item">
        <a href="/profile.php?user=<?php 
    echo $comment['commenter'];
    ?>
" class="thumb"><img
                src="<?php 
    echo BuckysUser::getProfileIcon($comment['commenter']);
    ?>
" class="replyToPostIcons"/></a>

        <div class="comment-content">
            <a href="/profile.php?user=<?php 
    echo $comment['commenter'];
    ?>
"
                style="font-weight:bold"><?php 
    echo $comment['fullName'];
    ?>
</a><br/>

            <?php 
    if ($comment['content']) {
        ?>
                <?php 
        echo $comment['content'];
        ?>
<br/>
            <?php 
    }
    ?>

            <?php 
    if ($comment['image']) {
        ?>
                <a href="/photos/users/<?php 
        echo $comment['commenter'];
        ?>
/original/<?php 
        echo $comment['image'];
        ?>
"
                    target="_blank"><img
                        src="/photos/users/<?php 
        echo $comment['commenter'];
        ?>
/resized/<?php 
        echo $comment['image'];
        ?>
"/></a>
                <br/>
            <?php 
    }
    ?>

            <span class="comment-date"><?php 
    echo buckys_format_date($comment['posted_date']);
    ?>
</span>

            <?php 
    if ($comment['commenter'] == $userID || $comment['poster'] == $userID) {
        ?>
                &middot;
                <a href="/comments.php?action=delete-comment&userID=<?php 
        echo $userID;
        ?>
&commentID=<?php 
        echo $comment['commentID'];
        ?>
&postID=<?php 
        echo $comment['postID'];
        echo buckys_get_token_param();
        ?>
"
                    class="remove-comment-link">Delete</a>
            <?php 
    }
    if (buckys_not_null($userID) && !$comment['reportID'] && ($comment['commenter'] != $userID && $comment['poster'] != $userID)) {
        ?>
                &middot;
                <a href="/report_object.php" data-type="comment" data-id="<?php 
        echo $comment['commentID'];
        ?>
"
                    data-idHash="<?php 
        echo buckys_encrypt_id($comment['commentID']);
        ?>
" class="report-link"
                    style="color:#999999;">Report</a>
            <?php 
    }
    ?>
            <?php 
    if (buckys_check_user_acl(USER_ACL_MODERATOR)) {
        ?>
                <?php 
        if ($reportID = BuckysReport::isReported($comment['commentID'], 'comment')) {
            ?>
                    &middot;
                    <span class="moderator-action-links">
                    <a href="/reported.php?action=delete-objects&reportID=<?php 
            echo $reportID;
            ?>
">Delete Comment</a>
                        &middot;
                        <a href="/reported.php?action=approve-objects&reportID=<?php 
            echo $reportID;
            ?>
">Approve Comment</a>
                        &middot;
                        <a href="/reported.php?action=ban-users&reportID=<?php 
            echo $reportID;
            ?>
">Ban User</a>
                </span>
                <?php 
        }
        ?>
            <?php 
    }
    ?>
        </div>
    </div>
    <?php 
    $html = ob_get_contents();
    ob_end_clean();
    if (!$isReturn) {
        echo $html;
    } else {
        return $html;
    }
}
require dirname(__FILE__) . '/includes/bootstrap.php';
$reportTypes = array();
foreach ($BUCKYS_GLOBALS['reportObjectTypes'] as $arr) {
    $reportTypes = array_merge($arr, $reportTypes);
}
if (!($userID = buckys_is_logged_in())) {
    echo MSG_INVALID_REQUEST;
    exit;
}
$type = isset($_REQUEST['type']) ? strtolower($_REQUEST['type']) : null;
if (!in_array($type, $reportTypes)) {
    echo MSG_INVALID_REQUEST;
    exit;
}
if (isset($_POST['action'])) {
    if ($_POST['action'] == 'report') {
        if (!isset($_POST['id']) || !isset($_POST['idHash']) || !buckys_check_id_encrypted($_POST['id'], $_POST['idHash'])) {
            $data = array('status' => 'error', 'message' => MSG_INVALID_REQUEST);
        } else {
            $result = BuckysReport::reportObject($userID, $_POST['id'], $type);
            if ($result === true) {
                $data = array('status' => 'success', 'message' => MSG_THANKS_YOUR_REPORT);
            } else {
                $data = array('status' => 'error', 'message' => $result);
            }
        }
        render_result_xml($data);
        exit;
    }
}
        <?php 
    }
    ?>
        <?php 
    if (BuckysModerator::isModerator($userID, MODERATOR_FOR_TRADE)) {
        ?>
            <!-- Trade Moderator Links -->                
        <?php 
    }
    ?>
        <?php 
    if (BuckysModerator::isModerator($userID, MODERATOR_FOR_FORUM)) {
        ?>
            <?php 
        $reportedTopics = BuckysReport::getReportedObjectCount('topic');
        $reportedReplies = BuckysReport::getReportedObjectCount('reply');
        ?>
            <a href="/reported.php?type=topic" class="accountLinks">Moderator Panel</a>
            <a href="/reported.php?type=topic" class="accountSubLinks<?php 
        echo $reportedTopics > 0 ? 'Bold' : '';
        ?>
">Reported Topics<?php 
        echo $reportedTopics > 0 ? ' (' . $reportedTopics . ')' : '';
        ?>
</a><br />
            <a href="/reported.php?type=reply" class="accountSubLinks<?php 
        echo $reportedReplies > 0 ? 'Bold' : '';
        ?>
">Reported Replies<?php 
        echo $reportedReplies > 0 ? ' (' . $reportedReplies . ')' : '';
        ?>
    if ($_POST['action'] == 'delete_forever') {
        if (!BuckysMessage::deleteMessagesForever($_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;
    }
}
$messageID = buckys_escape_query_integer(isset($_GET['message']) ? $_GET['message'] : null);
if (!$messageID) {
    buckys_redirect('/messages_inbox.php');
}
$message = BuckysMessage::getMessage($messageID);
//If the current user is morderator and this message has been reported
if (!$message && buckys_check_user_acl(USER_ACL_MODERATOR) && BuckysReport::isReported($messageID, 'message')) {
    //Getting Message
    $message = BuckysMessage::getMessageById($messageID);
    $msgType = 'reported';
}
if (!$message) {
    buckys_redirect('/messages_inbox.php');
}
if (!isset($msgType)) {
    //Make Message as read
    BuckysMessage::changeMessageStatus($message['messageID'], 'read');
    //Getting Next Message ID and Prev Message ID
    if ($message['is_trash'] == 1) {
        $msgType = 'trash';
    } else {
        if ($message['receiver'] == $userID) {