$userData = BuckysUser::getUserData($userID);
                                        if (!buckys_validate_password($_REQUEST['pwd'], $userData['password'])) {
                                            buckys_redirect($return, MSG_CURRENT_PASSWORD_NOT_CORRECT, MSG_TYPE_ERROR);
                                        }
                                        BuckysForumCategory::deleteCategory($category['categoryID']);
                                        buckys_redirect("/forum", MSG_REMOVE_FORUM_SUCCESS);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
//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);
}
//Getting Reported Posts
$reported_posts = BuckysForumModerator::getReportedArticles($categoryID);
//Getting Applicants
$applicants = BuckysForumModerator::getApplicants($categoryID);
$blockedUsers = BuckysForumModerator::getBlockedUsers($categoryID);
buckys_enqueue_stylesheet('sceditor/themes/default.css');
buckys_enqueue_stylesheet('forum.css');
$TNB_GLOBALS['headerType'] = 'forum';
$TNB_GLOBALS['content'] = 'forum/moderator';
$TNB_GLOBALS['title'] = $category['categoryName'] . ' Moderator Panel - thenewboston Forum';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".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'];
            ?>
"
                    class="forum-action-button">apply to moderate</a>
}
if (isset($_POST['action'])) {
    if ($_POST['action'] == 'create-topic') {
        $result = BuckysForumTopic::createTopic($_POST);
        if (!$result) {
            buckys_redirect("/forum/create_topic.php", $result, MSG_TYPE_ERROR);
        } else {
            $return = isset($_POST['return']) ? base64_decode($_POST['return']) : "/forum/topic.php?id=" . $result;
            buckys_redirect($return);
        }
    }
}
$curCatID = isset($_GET['category']) ? $_GET['category'] : 0;
if (!$curCatID || !($category = BuckysForumCategory::getCategory($curCatID))) {
    buckys_redirect("/forum", MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
if (BuckysForumModerator::isBlocked($userID, $category['categoryID'])) {
    buckys_redirect("/forum/category.php?id=" . $category['categoryID'], MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
$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');
$view['action_type'] = 'create';
$TNB_GLOBALS['headerType'] = 'forum';
$TNB_GLOBALS['content'] = 'forum/create_topic';
$TNB_GLOBALS['title'] = 'Start a New Topic - thenewboston Forum';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
                        <?php 
if (buckys_check_user_acl(USER_ACL_REGISTERED) && !BuckysForumModerator::isBlocked($TNB_GLOBALS['user']['userID'], $topic['categoryID'])) {
    ?>
                            <h2 class="titles left" style="margin-top:6px;">Reply</h2>
                        <?php 
}
?>
                        <?php 
if (count($replies) > 0) {
    echo $pagination->renderPaginate('/forum/topic.php?id=' . $topic['topicID'] . '&orderby=' . $orderBy . '&');
}
?>
                    </td>
                </tr>
                <?php 
if (buckys_check_user_acl(USER_ACL_REGISTERED) && !BuckysForumModerator::isBlocked($TNB_GLOBALS['user']['userID'], $topic['categoryID'])) {
    ?>
                    <tr>
                        <td style="background:#fff;">&nbsp;</td>
                        <td class="icon-column" style="background:#fff;">
                            <a href='/profile.php?user=<?php 
    echo $TNB_GLOBALS['user']['userID'];
    ?>
'> <img
                                    class="profileIcon topic-icon"
                                    src="<?php 
    echo BuckysUser::getProfileIcon(['thumbnail' => $TNB_GLOBALS['user']['thumbnail'], 'userID' => $TNB_GLOBALS['user']['userID']]);
    ?>
"
                                    class="poster-icon"/> </a>
                        </td>
        ?>
                        <a href="/videos.php?video=<?php 
        echo $nextVideoId;
        ?>
" class="prev-next-button"
                            style="line-height:28px;">Next</a>
                    <?php 
    }
    ?>
                </div>
                <div class="clear"></div>
            </div>

            <!-- Create Topic Directly -->
            <?php 
    if (($userID = buckys_is_logged_in()) && isset($category) && !BuckysForumModerator::isBlocked($userID, $category['forumCategoryID'])) {
        ?>
                <div id="forum-above-editor">
                    <span class="video-section-subtitle">Have a question or comment? Start a new discussion here:</span>
                </div>
                <form name="newtopicform" id="newtopicform" action="/forum/create_topic.php" method="post"
                    style="padding-top:5px;">
                    <input type="hidden" name="action" value="create-topic"/> <input type="hidden" name="category"
                        id="category" value="<?php 
        echo $category['forumCategoryID'];
        ?>
"/> <input type="hidden"
                        name="return" id="return" value="<?php 
        echo base64_encode($_SERVER['REQUEST_URI']);
        ?>
"/>
    ?>
            <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'];
    ?>
"
示例#7
0
/**
 * Check the current user is the moderator of the forum
 *
 * @param int $categoryID
 * @return Boolean
 */
function buckys_is_forum_moderator($categoryID)
{
    global $db;
    if (!($userID = buckys_is_logged_in())) {
        return false;
    }
    if (BuckysForumModerator::isModerator($categoryID, $userID)) {
        return true;
    } else {
        return false;
    }
}