/**
  * @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';
                    <?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

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
if (!($userID = buckys_is_logged_in())) {
    echo "Permission Denied!";
    buckys_exit();
}
if (!buckys_is_admin()) {
    echo "Permission Denied!";
    buckys_exit();
}
//Read Rows From Main Activities
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$limit = 200;
$query = "SELECT a.*, p.poster FROM " . TABLE_MAIN_ACTIVITIES . " AS a \n          LEFT JOIN " . TABLE_POSTS . " AS p ON a.objectID=p.postID\n          WHERE `objectType` = 'post' AND p.poster is not null ORDER BY activityID LIMIT " . ($page - 1) * $limit . ", {$limit}";
$rows = $db->getResultsArray($query);
if (!$rows) {
    //Delete Forum Activities from Main Activities
    echo "Completed";
    die;
}
foreach ($rows as $row) {
    switch ($row['activityType']) {
        case 'comment':
            if ($row['poster'] != $row['userID']) {
                $db->insertFromArray(TABLE_MAIN_NOTIFICATIONS, array('userID' => $row['poster'], 'activityID' => $row['activityID'], 'notificationType' => BuckysActivity::NOTIFICATION_TYPE_COMMENT_TO_POST, 'isNew' => $row['isNew'], 'createdDate' => strtotime($row['createdDate'])));
            }
            break;
        case 'like':
            $db->insertFromArray(TABLE_MAIN_NOTIFICATIONS, array('userID' => $row['poster'], 'activityID' => $row['activityID'], 'notificationType' => BuckysActivity::NOTIFICATION_TYPE_LIKE_POST, 'isNew' => $row['isNew'], 'createdDate' => strtotime($row['createdDate'])));
            break;
예제 #5
0
<?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]);
?>
                    <?php 
}
?>
                </select><br/>
                <?php 
render_form_token();
?>
                <input type="hidden" name="id" value="<?php 
echo $category['categoryID'];
?>
"/> <input type="hidden"
                    name="action" value="unblock-users"/> <br/> <input type="submit" value="Unblock" class="redButton"/>
            </form>

            <?php 
if (buckys_is_admin() || buckys_is_forum_admin($category['categoryID'])) {
    ?>
                <div class="divider"></div>
                <h4>Delete <?php 
    echo $category['categoryName'];
    ?>
 Forum</h4>
                <form action="/forum/moderator.php" method="post" id="deleteForumForm">
                    <label>Password: </label> <input type="password" class="input" name="pwd" value=""
                        autocomplete="off" size="30"/>
                    <?php 
    render_form_token();
    ?>
                    <input type="hidden" name="id" value="<?php 
    echo $category['categoryID'];
    ?>
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'];
    ?>
    if ($view['isFollowed']) {
        echo sprintf('<a href="/page.php?pid=%d&action=unfollow' . buckys_get_token_param() . '">Unfollow Page</a> <br/>', $pageData['pageID']);
    } else {
        echo sprintf('<a href="/page.php?pid=%d&action=follow' . buckys_get_token_param() . '">Follow Page</a> <br/>', $pageData['pageID']);
    }
    ?>
    <?php 
}
?>

    <?php 
echo sprintf('<a href="/photos.php?pid=%d">View All Photos (%d)</a> <br/>', $pageData['pageID'], $numberOfPhotos);
?>

    <?php 
if ($view['isMyPage'] || buckys_is_admin()) {
    ?>
        <a href="javascript:void(0)" class="delete-this-page-btn">Delete this Page</a> <br/>
    <?php 
}
?>

    <div class="page-about-sidebox info-box">
        <!-- <h3>About <?php 
if ($view['isMyPage']) {
    ?>
<a href="javascript:void(0)" class="edit-info" id="edit_about_btn">(edit)</a><?php 
}
?>
</h3> -->
        <h4>About <?php 
 /**
  * Delete page by PageID
  *
  * @param integer $userID
  * @param integer $pageID
  * @return bool
  */
 public function deletePageByID($pageID, $userID = null)
 {
     global $db;
     $postIns = new BuckysPost();
     $pageFollowerIns = new BuckysPageFollower();
     //Get Page info & related posts belonged to this page.
     $pageData = $this->getPageByID($pageID);
     if (!$pageData) {
         return false;
     }
     if (!empty($userID) && $pageData['userID'] != $userID && !buckys_is_admin()) {
         return false;
         // You don't have permission to delete this page
     }
     $postList = $postIns->getPostsByPageID($pageData['pageID']);
     //Delete related posts
     if (is_array($postList) && count($postList) > 0) {
         foreach ($postList as $postData) {
             $postIns->deletePost($pageData['userID'], $postData['postID']);
         }
     }
     //Delete followers
     $pageFollowerIns->removeAllFollowersByPageID($pageID);
     //Delete page
     $query = sprintf("DELETE FROM %s WHERE pageID=%d", TABLE_PAGES, $pageID);
     $db->query($query);
     return true;
 }