/**
  * Approve Pending Replies
  *
  * @param Array $ids
  * @return bool|string
  */
 public static function approvePendingReplies($ids)
 {
     global $db;
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $ids = $db->escapeInput($ids);
     //Getting Topics for confirmation
     $query = "SELECT r.topicID, r.replyID, t.categoryID, r.creatorID, r.createdDate, t.creatorID AS topicCreatorID FROM " . TABLE_FORUM_REPLIES . " AS r LEFT JOIN " . TABLE_FORUM_TOPICS . " AS t ON t.topicID=r.topicID WHERE r.status='pending' AND r.replyID IN (" . implode(', ', $ids) . ")";
     $rows = $db->getResultsArray($query);
     if (!$rows) {
         return MSG_INVALID_REQUEST;
     }
     $forumNotification = new BuckysForumNotification();
     foreach ($rows as $row) {
         //Update Topic Status
         $db->updateFromArray(TABLE_FORUM_REPLIES, array('status' => 'publish', 'createdDate' => date('Y-m-d H:i:s')), array('replyID' => $row['replyID']));
         //Update Category Table
         $db->query("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `replies`=`replies` + 1, lastTopicID='" . $row['topicID'] . "' WHERE categoryID=" . $row['categoryID']);
         $db->query("UPDATE " . TABLE_FORUM_TOPICS . " SET `replies`=`replies` + 1 WHERE topicID=" . $row['topicID']);
         $db->query("UPDATE " . TABLE_FORUM_TOPICS . " SET lastReplyID=" . $row['replyID'] . ", lastReplyDate='" . date('Y-m-d H:i:s') . "', lastReplierID=" . $row['creatorID'] . " WHERE topicID=" . $row['topicID'] . " AND lastReplyID < " . $row['replyID']);
         //Increase user posts count
         $db->query("UPDATE " . TABLE_USERS . " SET `posts_count`=`posts_count` + 1 WHERE userID=" . $row['creatorID']);
         //Add Notifications
         $forumNotification->addNotificationsForPendingPost($row['creatorID'], $row['topicID'], $row['replyID']);
         $forumNotification->addNotificationsForReplies($row['creatorID'], $row['topicID'], $row['replyID']);
         if ($row['topicCreatorID'] != $row['creatorID']) {
             $forumNotification->addNotificationsForTopic($row['topicCreatorID'], $row['topicID'], $row['replyID']);
         }
         //Update User Stats
         BuckysUser::updateStats($row['topicCreatorID'], 'replies', 1);
     }
     return true;
 }
Ejemplo n.º 2
0
<?php

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
if (!buckys_check_user_acl(USER_ACL_REGISTERED)) {
    buckys_redirect('/forum');
}
$page = isset($_GET['page']) ? $_GET['page'] : 1;
//Getting Type
$listType = isset($_GET['type']) ? $_GET['type'] : 'all';
if (!in_array($listType, ['all', 'responded', 'started'])) {
    $listType = 'all';
}
$total = BuckysForumTopic::getTotalNumberOfMyPosts($TNB_GLOBALS['user']['userID'], $listType);
$pagination = new Pagination($total, BuckysForumTopic::$COUNT_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
$topics = BuckysForumTopic::getMyPosts($TNB_GLOBALS['user']['userID'], $listType, $page, BuckysForumTopic::$COUNT_PER_PAGE);
//Mark Forum Notifications to read
BuckysForumNotification::makeNotificationsToRead($TNB_GLOBALS['user']['userID']);
buckys_enqueue_javascript('jquery-migrate-1.2.0.js');
buckys_enqueue_stylesheet('forum.css');
buckys_enqueue_stylesheet('publisher.css');
$TNB_GLOBALS['headerType'] = 'forum';
$TNB_GLOBALS['content'] = 'forum/myposts';
$TNB_GLOBALS['title'] = 'Recent Activity - thenewboston Forum';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
Ejemplo n.º 3
0
$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)) {
    $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';
 /**
  * Approve Pending Topics
  *
  * @param mixed $ids
  * @return bool|string
  */
 public static function approvePendingTopics($ids)
 {
     global $db;
     if (!is_array($ids)) {
         $ids = [$ids];
     }
     $ids = $db->escapeInput($ids);
     //Getting Topics for confirmation
     $query = "SELECT topicID, categoryID, creatorID FROM " . TABLE_FORUM_TOPICS . " WHERE STATUS='pending' AND topicID IN (" . implode(', ', $ids) . ")";
     $rows = $db->getResultsArray($query);
     if (!$rows) {
         return MSG_INVALID_REQUEST;
     }
     $forumNotification = new BuckysForumNotification();
     foreach ($rows as $row) {
         //Update Topic Status
         $db->updateFromArray(TABLE_FORUM_TOPICS, ['status' => 'publish', 'createdDate' => date('Y-m-d H:i:s')], ['topicID' => $row['topicID']]);
         //Update Category Table
         $db->query("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `topics`=`topics` + 1 WHERE categoryID=" . $row['categoryID']);
         $db->query("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `lastTopicID`=" . $row['topicID'] . " WHERE categoryID=" . $row['categoryID'] . " AND lastTopicID < " . $row['topicID']);
         //Increase user posts count
         $db->query("UPDATE " . TABLE_USERS . " SET `posts_count`=`posts_count` + 1 WHERE userID=" . $row['creatorID']);
         $forumNotification->addNotificationsForPendingPost($row['creatorID'], $row['topicID']);
     }
     return true;
 }
                        <span class="dropDownNotificationList">                    
                            <?php 
        render_footer_link_content('friend', $friendRequests);
        ?>
                        </span>
                    </span>
                <?php 
    } else {
        echo '<span class="notificationLinks inactive-notify no-data" id="friend-notifications-icon"><span class="dropDownNotificationList"><a href="/myfriends.php?type=requested" class="nodata">No one wants to be your friend</a></span></span>';
    }
    ?>
                <!-- End Friend Request Notification -->

                <!-- Start Forum Notifications -->
                <?php 
    $objForumNotify = new BuckysForumNotification();
    $newMsgFlag = 1;
    $newNoticeCount = $objForumNotify->getNumOfNewNotifications($userID, $newMsgFlag);
    if ($newNoticeCount == 0) {
        $newMsgFlag = 0;
        $newNoticeCount = $objForumNotify->getNumOfNewNotifications($userID, $newMsgFlag);
    }
    if ($newNoticeCount > 0) {
        $newNotices = $objForumNotify->getNewNotifications($userID, $newMsgFlag, $notificationLimit);
        ?>
                    <span class="notificationLinks <?php 
        if ($newMsgFlag == 0) {
            echo 'inactive-notify';
        }
        ?>
" id="forum-notifications-icon">
Ejemplo n.º 6
0
                 <?php 
     }
     ?>
                 <a class="view-detail-links" href="/myfriends.php?type=requested">                        
                     View All Requests
                 </a>       
             </span>
         </span>
         <?php 
 }
 ?>
         <!-- End Friend Request Notification -->
         
         <!-- Start Forum Notifications -->
         <?php 
 $objForumNotify = new BuckysForumNotification();
 $newNoticeCount = $objForumNotify->getNumOfNewNotifications($userID);
 if ($newNoticeCount > 0) {
     $newNotices = $objForumNotify->getNewNotifications($userID);
     ?>
         <span class="notificationLinks" id="forum-notifications-icon">
             <span class="dropDownNotificationList">                    
                 <?php 
     foreach ($newNotices as $idx => $row) {
         ?>
                 
                   <?php 
         if ($row['activityType'] == 'topic_approved' || $row['activityType'] == 'reply_approved') {
             ?>
                     <a class="singleNotificationListItem" href="/forum/topic.php?id=<?php 
             echo $row['activityType'] == 'topic_approved' ? $row['objectID'] : $row['actionID'];
    exit;
}
$notificationLimit = 5;
//This module will make the notifications as read.
$result = ['success' => 1, 'content' => ''];
$type = isset($_REQUEST['type']) ? strtolower($_REQUEST['type']) : null;
if (isset($_POST['action']) && $_POST['action'] == 'read') {
    switch ($type) {
        case 'my':
            BuckysActivity::markReadNotifications($userID);
            $notiData = BuckysActivity::getNotifications($userID, $notificationLimit, 0);
            $result['content'] = render_footer_link_content($type, $notiData, false);
            break;
        case 'forum':
            BuckysForumNotification::makeNotificationsToRead($userID);
            $notiData = BuckysForumNotification::getNewNotifications($userID, 0, $notificationLimit);
            $result['content'] = render_footer_link_content($type, $notiData, false);
            break;
        case 'trade':
            $tradeNotiIns = new BuckysTradeNotification();
            $tradeNotiIns->markAsRead($userID);
            $notiData = $tradeNotiIns->getReceivedMessages($userID, null, 0, $notificationLimit);
            $result['content'] = render_footer_link_content($type, $notiData, false);
            break;
        case 'shop':
            $shopNotiIns = new BuckysShopNotification();
            $shopNotiIns->markAsRead($userID);
            $notiData = $shopNotiIns->getReceivedMessages($userID, null, 0, $notificationLimit);
            $result['content'] = render_footer_link_content($type, $notiData, false);
            break;
    }
Ejemplo n.º 8
0
<?php

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
$categoryID = isset($_GET['id']) ? $_GET['id'] : 0;
$category = BuckysForumCategory::getCategory($categoryID);
if (!$category) {
    buckys_redirect('/forum');
}
//Getting Topics by category id
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$total = BuckysForumTopic::getTotalNumOfTopics('publish', $category['categoryID']);
$pagination = new Pagination($total, BuckysForumTopic::$COUNT_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
$topics = BuckysForumTopic::getTopics($page, 'publish', $category['categoryID'], null, BuckysForumTopic::$COUNT_PER_PAGE);
$hierarchical = BuckysForumCategory::getCategoryHierarchical($category['categoryID']);
//Mark Forum Notifications to read
if (buckys_check_user_acl(USER_ACL_REGISTERED)) {
    BuckysForumNotification::makeNotificationsToRead($BUCKYS_GLOBALS['user']['userID'], $category['categoryID']);
}
buckys_enqueue_javascript('jquery-migrate-1.2.0.js');
buckys_enqueue_stylesheet('forum.css');
$BUCKYS_GLOBALS['headerType'] = 'forum';
$BUCKYS_GLOBALS['content'] = 'forum/category';
$BUCKYS_GLOBALS['title'] = $category['categoryName'] . ' - BuckysRoomForum';
require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";