/**
 * Check that the current user is trade moderator
 */
function buckys_is_trade_moderator()
{
    global $TNB_GLOBALS;
    if (!buckys_check_user_acl(USER_ACL_MODERATOR)) {
        return false;
    }
    if (!BuckysModerator::isModerator($TNB_GLOBALS['user']['userID'])) {
        return false;
    }
    return true;
}
                ?>
">Send Friend Request</a>
                <br/>
            <?php 
            }
        }
    }
    //Show Message
    ?>
        <a href="/messages_compose.php?to=<?php 
    echo $profileID;
    ?>
">Send Message</a> <br/>
        <?php 
    //For Community Moderator
    if (BuckysModerator::isModerator($userID) && !BuckysBanUser::isBannedUser($profileID)) {
        ?>
            <a href="/profile.php?action=ban-user&userID=<?php 
        echo $profileID;
        ?>
"
                onclick="return confirm('<?php 
        echo MSG_ARE_YOU_SURE_WANT_TO_BAN_THIS_USER;
        ?>
')">Ban User</a>
            <br/>
        <?php 
    }
    //For Administrator
    if (buckys_check_user_acl(USER_ACL_ADMINISTRATOR)) {
        ?>
<?php

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
if (!buckys_check_user_acl(USER_ACL_ADMINISTRATOR) && !BuckysModerator::isModerator($TNB_GLOBALS['user']['userID'])) {
    buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
//Process Post Actions
if (isset($_POST['action'])) {
    $action = $_POST['action'];
    //Approve Topics
    if ($action == 'approve-topic') {
        //Getting Ids
        $topicIds = isset($_POST['tid']) ? $_POST['tid'] : null;
        if (!$topicIds) {
            buckys_redirect('/forum/pending_topcis.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
        }
        $result = BuckysForumTopic::approvePendingTopics($topicIds);
        if ($result === true) {
            buckys_redirect('/forum/pending_topics.php', MSG_TOPIC_APPROVED_SUCCESSFULLY);
        } else {
            buckys_redirect('/forum/pending_topics.php', $result, MSG_TYPE_ERROR);
        }
    } else {
        if ($action == 'delete-topic') {
            // Delete Pending Topics
            //Getting Ids
            $topicIds = isset($_POST['tid']) ? $_POST['tid'] : null;
            if (!$topicIds) {
                buckys_redirect('/forum/pending_topcis.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
            }
            $result = BuckysForumTopic::deletePendingTopics($topicIds);
Example #4
0
            ?>
            <header id="main_header">
                <div id="rightAlignLinks">      
                    <a href="/trade/additem.php" class="headerLinks">Add Item</a> |
                    <a href="/trade/available.php" class="headerLinks">Control Panel</a>
                </div>
                <a href="index.php"><img src="/images/mainLogoTrade.png"></a>
            </header>
        <?php 
            break;
        case 'forum':
            ?>
            <header id="main_header">
                <div id="rightAlignLinks">                          
                <?php 
            if (buckys_check_user_acl(USER_ACL_ADMINISTRATOR) || BuckysModerator::isModerator($BUCKYS_GLOBALS['user']['userID'], MODERATOR_FOR_FORUM)) {
                ?>
                
                <?php 
                $pendingTopics = BuckysForumTopic::getTotalNumOfTopics('pending');
                $pendingReplies = BuckysForumReply::getTotalNumOfReplies(null, 'pending');
                ?>
                    <?php 
                if ($pendingTopics > 0) {
                    ?>
                    <a href="/forum/pending_topics.php" class="headerLinksBold">Pending Topics (<?php 
                    echo $pendingTopics;
                    ?>
)</a> |
                    <?php 
                }
Example #5
0
if ($remindTimeString == '') {
    $remindTimeString = ceil($timeOffset / 60);
    if ($remindTimeString > 1) {
        $remindTimeString .= ' minutes';
    } else {
        $remindTimeString .= ' minute';
    }
}
if ($remindTimeString == '') {
    $remindTimeString = $timeOffset;
    if ($remindTimeString > 1) {
        $remindTimeString .= ' seconds';
    } else {
        $remindTimeString .= ' second';
    }
}
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$totalCount = BuckysModerator::getCandidatesCount($moderatorType);
//Getting Current Moderator
$currentModerator = BuckysModerator::getModerator($moderatorType);
//Init Pagination Class
$pagination = new Pagination($totalCount, BuckysModerator::$CANDIDATES_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
$candidates = BuckysModerator::getCandidates($moderatorType, $page);
buckys_enqueue_stylesheet('account.css');
buckys_enqueue_stylesheet('moderator.css');
buckys_enqueue_javascript('moderator.js');
$BUCKYS_GLOBALS['content'] = 'moderator';
$BUCKYS_GLOBALS['title'] = "Moderator - BuckysRoom";
//if logged user can see all resources of the current user
require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
Example #6
0
$moderatorType = null;
foreach ($BUCKYS_GLOBALS['reportObjectTypes'] as $mtype => $row) {
    if (in_array($reportType, $row)) {
        $moderatorType = $mtype;
    }
}
if ($moderatorType == null) {
    buckys_redirect('/index.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
if ($moderatorType == MODERATOR_FOR_COMMUNITY && !BuckysModerator::isModerator($BUCKYS_GLOBALS['user']['userID'], MODERATOR_FOR_COMMUNITY)) {
    buckys_redirect('/index.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
if ($moderatorType == MODERATOR_FOR_FORUM && !BuckysModerator::isModerator($BUCKYS_GLOBALS['user']['userID'], MODERATOR_FOR_FORUM)) {
    buckys_redirect('/index.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
if ($moderatorType == MODERATOR_FOR_TRADE && !BuckysModerator::isModerator($BUCKYS_GLOBALS['user']['userID'], MODERATOR_FOR_TRADE)) {
    buckys_redirect('/index.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
if (isset($_REQUEST['action'])) {
    if ($_REQUEST['action'] == 'delete-objects') {
        BuckysReport::deleteObjects($_REQUEST['reportID'], $reportType, $moderatorType);
        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);
            }
                echo base64_encode("/profile.php?user="******">Send Friend Request</a> <br/>
                <?php 
            }
        }
    }
    //Show Message
    ?>
        <a href="/messages_compose.php?to=<?php 
    echo $profileID;
    ?>
">Send Message</a> <br/>
        <?php 
    //For Community Moderator
    if (BuckysModerator::isModerator($userID, MODERATOR_FOR_COMMUNITY) && !BuckysBanUser::isBannedUser($profileID)) {
        ?>
            <a href="/profile.php?action=ban-user&userID=<?php 
        echo $profileID;
        ?>
" onclick="return confirm('<?php 
        echo MSG_ARE_YOU_SURE_WANT_TO_BAN_THIS_USER;
        ?>
')">Banned User</a><br />
            <?php 
    }
    //For Administrator
    if (buckys_check_user_acl(USER_ACL_ADMINISTRATOR)) {
        ?>
            <a href="/banned_users.php?action=deletebyid&userID=<?php 
        echo $profileID;
    }
    if ($_POST['action'] == 'add-moderator') {
        //Confirm that the user is administrator
        if (!buckys_check_user_acl(USER_ACL_ADMINISTRATOR)) {
            buckys_redirect('/moderator.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
        }
        //Check the url parameters is correct
        if (!isset($_POST['new_moderator_id'])) {
            buckys_redirect('/moderator.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
        }
        BuckysModerator::addModerator($_POST['new_moderator_id']);
        buckys_redirect('/moderator.php');
    }
}
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$totalCount = BuckysModerator::getCandidatesCount();
//Getting Current Moderator
$currentModerators = BuckysModerator::getModerators();
//Init Pagination Class
$pagination = new Pagination($totalCount, BuckysModerator::$CANDIDATES_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
$candidates = BuckysModerator::getCandidates($page);
//Getting My Candidate
$myCandidate = BuckysModerator::getCandidate($userID);
buckys_enqueue_stylesheet('account.css');
buckys_enqueue_stylesheet('moderator.css');
buckys_enqueue_javascript('moderator.js');
$TNB_GLOBALS['content'] = 'moderator';
$TNB_GLOBALS['title'] = "Moderator - " . TNB_SITE_NAME;
//if logged user can see all resources of the current user
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
Example #9
0
">Reported Messages<?php 
        echo $reportedMessages > 0 ? ' (' . $reportedMessages . ')' : '';
        ?>
</a><br />
        <?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' : '';
<?php

require dirname(__FILE__) . '/includes/bootstrap.php';
//Getting Current User ID
$userID = buckys_is_logged_in();
//Process Some Actions
if (isset($_GET['action']) && $_GET['action'] == 'ban-user') {
    if (!BuckysModerator::isModerator($userID)) {
        die(MSG_PERMISSION_DENIED);
    }
    if (!isset($_GET['userID']) || !BuckysUser::checkUserID($userID)) {
        buckys_redirect('/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
    }
    //Ban User
    BuckysBanUser::banUser($_GET['userID']);
    buckys_redirect('/index.php', MSG_BAN_USER);
    exit;
}
//Getting User ID from Parameter
$profileID = buckys_escape_query_integer(isset($_GET['user']) ? $_GET['user'] : null);
//If the parameter is null, goto homepage
if (!$profileID) {
    buckys_redirect('/index.php');
}
//Getting UserData from Id
$userData = BuckysUser::getUserData($profileID);
//Goto Homepage if the userID is not correct
if (!buckys_not_null($userData) || !BuckysUser::checkUserID($profileID, true) && !buckys_check_user_acl(USER_ACL_ADMINISTRATOR)) {
    buckys_redirect('/index.php');
}
$postType = isset($_GET['type']) ? $_GET['type'] : 'all';
Example #11
0
<?php

require dirname(__FILE__) . '/includes/bootstrap.php';
//Getting Current User ID
$userID = buckys_is_logged_in();
//Process Some Actions
if (isset($_GET['action']) && $_GET['action'] == 'ban-user') {
    if (!BuckysModerator::isModerator($userID, MODERATOR_FOR_COMMUNITY)) {
        die(MSG_PERMISSION_DENIED);
    }
    if (!isset($_GET['userID']) || !BuckysUser::checkUserID($userID)) {
        buckys_redirect('/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
    }
    //Ban User
    BuckysBanUser::banUser($_GET['userID']);
    buckys_redirect('/index.php', MSG_BAN_USER);
    exit;
}
//Getting User ID from Parameter
$profileID = isset($_GET['user']) ? intval($_GET['user']) : 0;
//If the parameter is null, goto homepage
if (!$profileID) {
    buckys_redirect('/index.php');
}
//Getting UserData from Id
$userData = BuckysUser::getUserData($profileID);
//Goto Homepage if the userID is not correct
if (!buckys_not_null($userData) || !BuckysUser::checkUserID($profileID, true) && !buckys_check_user_acl(USER_ACL_ADMINISTRATOR)) {
    buckys_redirect('/index.php');
}
//if logged user can see all resources of the current user