/**
  * Edit topic
  * 
  * @param mixed $data
  */
 public function editTopic($data)
 {
     global $db, $BUCKYS_GLOBALS;
     $title = get_secure_string($data['title']);
     $category = get_secure_string($data['category']);
     $content = trim($data['content']);
     if (!$title || !$category || !$content || !isset($data['id'])) {
         return MSG_ALL_FIELDS_REQUIRED;
     }
     //Check Category ID is valid or not
     $query = $db->prepare("SELECT categoryID FROM " . TABLE_FORUM_CATEGORIES . " WHERE categoryID=%d", $category);
     $categoryID = $db->getVar($query);
     if (!$categoryID) {
         return MSG_INVALID_REQUEST;
     }
     $content = BuckysForumTopic::_convertHTMLToBBCode($content);
     $updateData = array('topicTitle' => $title, 'topicContent' => $content, 'categoryID' => $categoryID);
     $db->updateFromArray(TABLE_FORUM_TOPICS, $updateData, array('topicID' => $data['id']));
     return true;
 }
 /**
  * @param $categoryID
  */
 public static function deleteCategory($categoryID)
 {
     global $db;
     //Delete Category Links
     $query = $db->prepare("DELETE FROM " . TABLE_FORUM_CATEGORIES_LINKS . " WHERE categoryID=%d", $categoryID);
     $db->query($query);
     //Remove Followers
     $query = $db->prepare("DELETE FROM " . TABLE_FORUM_FOLLOWERS . " WHERE categoryID=%d", $categoryID);
     $db->query($query);
     //Remove Moderators
     $query = $db->prepare("DELETE FROM " . TABLE_FORUM_MODERATORS . " WHERE categoryID=%d", $categoryID);
     $db->query($query);
     //Remove Blocked Users
     $query = $db->prepare("DELETE FROM " . TABLE_FORUM_BLOCKED_USRES . " WHERE categoryID=%d", $categoryID);
     $db->query($query);
     //Remove Topics
     $query = $db->prepare("SELECT topicID FROM " . TABLE_FORUM_TOPICS . " WHERE categoryID=%d", $categoryID);
     $topics = $db->getResultsArray($query);
     foreach ($topics as $tRow) {
         BuckysForumTopic::deleteTopic($tRow['topicID']);
     }
     //Remove Forum
     $query = $db->prepare("DELETE FROM " . TABLE_FORUM_CATEGORIES . " WHERE categoryID=%d", $categoryID);
     $db->query($query);
     return;
 }
 /**
  * Delete Reply
  *
  * @param Int $replyID
  * @return bool
  */
 public static function deleteReply($replyID)
 {
     global $db;
     $query = $db->prepare("SELECT * FROM " . TABLE_FORUM_REPLIES . " WHERE replyID=%d", $replyID);
     $reply = $db->getRow($query);
     if ($reply) {
         if ($reply['status'] == 'publish') {
             //Getting Topic
             $query = $db->prepare("SELECT * FROM " . TABLE_FORUM_TOPICS . " WHERE topicID=%d", $reply['topicID']);
             $topic = $db->getRow($query);
             //Update Replies Count For Topic
             $query = "UPDATE " . TABLE_FORUM_TOPICS . " SET `replies`=`replies` - 1 WHERE topicID=" . $reply['topicID'];
             $db->query($query);
             //Update Replies Count For Category
             $query = "UPDATE " . TABLE_FORUM_CATEGORIES . " SET `replies`=`replies` - 1 WHERE categoryID=" . $topic['categoryID'];
             $db->query($query);
             $db->query("UPDATE " . TABLE_USERS . " SET `posts_count`=`posts_count` - 1 WHERE userID=" . $reply['creatorID']);
             $db->query("UPDATE " . TABLE_USERS . " SET `posts_rating`=`posts_rating`" . ($reply['votes'] > 0 ? '-' : '+') . abs($reply['votes']) . " WHERE userID=" . $reply['creatorID']);
             //Update Stats
             BuckysUser::updateStats($topic['creatorID'], 'replies', -1);
             BuckysUser::updateStats($reply['creatorID'], 'voteUps', -1 * $reply['votes']);
         }
         //Remove Reply Votes
         $query = "DELETE FROM " . TABLE_FORUM_VOTES . " WHERE objectID=" . $reply['replyID'];
         $db->query($query);
         //Delete Frome Reports Table
         $query = "DELETE FROM " . TABLE_REPORTS . " WHERE objectType='reply' AND objectID=" . $reply['replyID'];
         $db->query($query);
         //Remove Reply
         $query = "DELETE FROM " . TABLE_FORUM_REPLIES . " WHERE replyID=" . $reply['replyID'];
         $db->query($query);
         BuckysForumTopic::updateTopicLastReplyID($reply['topicID']);
         BuckysForumCategory::updateCategoryLastTopicID($topic['categoryID']);
         return true;
     }
     return false;
 }
Exemplo n.º 4
0
?>
            
            <table cellpadding="0" cellspacing="0" class="forumentry">
                <tr>
                    <td class="label">Topic: </td>
                    <td><?php 
echo $topic['topicTitle'];
?>
</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>
                        <textarea cols="20" id="reply-content" name="content" rows="12" class="textarea"><?php 
if (isset($view['replyData'])) {
    echo BuckysForumTopic::_convertBBCodeToHTML($view['replyData']['replyContent']);
}
?>
</textarea>
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>
                        <input type="submit" value="Post" class="redButton" />
                    </td>
                </tr>                
            </table>            
        </form>
    </section>
</section>
            $userID = buckys_is_logged_in();
            $replyID = isset($_GET['replyID']) ? get_secure_integer($_GET['replyID']) : null;
            $replyData = $forumReplyIns->getReplyByID($replyID);
            if ($replyData && $replyData['creatorID'] == $userID && $replyData['topicID'] == $topicID) {
                //then you can edit this one
                $view['replyData'] = $replyData;
                $view['action_type'] = 'edit';
                $view['replyID'] = $replyID;
            } else {
                //permission error
                buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
            }
        }
    }
}
if (!isset($replyData) || !$replyData) {
    buckys_redirect("/forum", MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
$topicData = BuckysForumTopic::getTopic($replyData['replyID']);
$category = BuckysForumCategory::getCategory($topicData['categoryID']);
$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');
$TNB_GLOBALS['headerType'] = 'forum';
$TNB_GLOBALS['content'] = 'forum/post_reply';
$TNB_GLOBALS['title'] = 'Post Reply - thenewboston Forum';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
Exemplo n.º 6
0
<?php

require_once dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
if (!($userID = buckys_is_logged_in())) {
    buckys_redirect("/forum/home.php", MSG_INVALID_REQUEST);
}
//Getting Topics by category id
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$total = BuckysForumTopic::getTotalNumOfUserTopics($userID);
$pagination = new Pagination($total, BuckysForumTopic::$COUNT_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
$topics = BuckysForumTopic::getUserTopics($userID, $page, 'lastReplyDate DESC, t.createdDate DESC', BuckysForumTopic::$COUNT_PER_PAGE);
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/home';
$TNB_GLOBALS['title'] = 'My Forum Feed - thenewboston Forum';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
Exemplo n.º 7
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";
 /**
  * Unban Users
  *
  * @param mixed $ids
  */
 public static function unbanUsers($ids)
 {
     global $db, $TNB_GLOBALS;
     if (!is_array($ids)) {
         $ids = [$ids];
     }
     //Check the user has lready been banned or not
     $rows = $db->getResultsArray("SELECT * FROM " . TABLE_BANNED_USERS . " WHERE bannedID IN (" . implode(', ', $ids) . ")");
     if ($rows) {
         foreach ($rows as $brow) {
             $userID = $brow['bannedUserID'];
             //Change User Table
             $db->query("UPDATE " . TABLE_USERS . " SET status=1 WHERE userID=" . $userID);
             //Change Posts table
             $db->query("UPDATE " . TABLE_POSTS . " SET post_status=1 WHERE poster=" . $userID);
             //Change Activities
             $db->query("UPDATE " . TABLE_MAIN_ACTIVITIES . " SET activityStatus=1 WHERE userID=" . $userID);
             //Change Messages
             $db->query("UPDATE " . TABLE_MESSAGES . " SET messageStatus=1 WHERE sender=" . $userID);
             //Fix Comments Count
             $query = $db->prepare("SELECT count(commentID) AS c, postID FROM " . TABLE_POSTS_COMMENTS . " WHERE commenter=%d AND commentStatus=0 GROUP BY postID", $userID);
             $pcRows = $db->getResultsArray($query);
             foreach ($pcRows as $row) {
                 $db->query("UPDATE " . TABLE_POSTS . " SET `comments` = `comments` + " . $row['c'] . " WHERE postID=" . $row['postID']);
             }
             //Unblock Comments
             $db->query("UPDATE " . TABLE_POSTS_COMMENTS . " SET commentStatus=1 WHERE commenter=" . $userID);
             //Fix Likes Count
             $query = $db->prepare("SELECT count(likeID) AS c, postID FROM " . TABLE_POSTS_LIKES . " WHERE userID=%d AND likeStatus=0 GROUP BY postID", $userID);
             $plRows = $db->getResultsArray($query);
             foreach ($plRows as $row) {
                 $db->query("UPDATE " . TABLE_POSTS . " SET `likes` = `likes` + " . $row['c'] . " WHERE postID=" . $row['postID']);
             }
             //Unblock Likes
             $db->query("UPDATE " . TABLE_POSTS_LIKES . " SET likeStatus=1 WHERE userID=" . $userID);
             //Unblock Votes for Moderator
             $query = $db->prepare("SELECT count(voteID) AS c, candidateID FROM " . TABLE_MODERATOR_VOTES . " WHERE voterID=%d AND voteStatus=0 GROUP BY candidateID", $userID);
             $vRows = $db->getResultsArray($query);
             foreach ($vRows as $row) {
                 $db->query("UPDATE " . TABLE_MODERATOR_CANDIDATES . " SET `votes` = `votes` + " . $row['c'] . " WHERE candidateID=" . $row['candidateID']);
             }
             $db->query("UPDATE " . TABLE_MODERATOR_VOTES . " SET voteStatus=1 WHERE voterID=" . $userID);
             //Unblock Replies
             $query = $db->prepare("SELECT count(r.replyID), r.topicID, t.categoryID FROM " . TABLE_FORUM_REPLIES . " AS r LEFT JOIN " . TABLE_FORUM_TOPICS . " AS t ON t.topicID=r.topicID WHERE r.status='suspended' AND r.creatorID=%d GROUP BY r.topicID", $userID);
             $rRows = $db->getResultsArray($query);
             $db->query("UPDATE " . TABLE_FORUM_REPLIES . " SET `status`='publish' WHERE creatorID=" . $userID . " AND `status`='suspended'");
             foreach ($rRows as $row) {
                 $db->query("UPDATE " . TABLE_FORUM_TOPICS . " SET `replies` = `replies` + " . $row['c'] . " WHERE topicID=" . $row['topicID']);
                 $db->query("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `replies` = `replies` + " . $row['c'] . " WHERE categoryID=" . $row['categoryID']);
                 BuckysForumTopic::updateTopicLastReplyID($row['topicID']);
                 BuckysForumCategory::updateCategoryLastTopicID($row['categoryID']);
             }
             //unblock Topics
             $query = $db->prepare("SELECT count(topicID) AS tc, SUM(replies) AS rc, categoryID FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=%d AND `status`='suspended' GROUP BY categoryID", $userID);
             $tRows = $db->getResultsArray($query);
             $db->query("UPDATE " . TABLE_FORUM_TOPICS . " SET `status`='publish' WHERE creatorID=" . $userID . " AND `status`='suspended'");
             foreach ($tRows as $row) {
                 $db->query("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `replies` = `replies` + " . $row['rc'] . ", `topics` = `topics` + " . $row['tc'] . " WHERE categoryID=" . $row['categoryID']);
                 BuckysForumCategory::updateCategoryLastTopicID($row['categoryID']);
             }
             //Unblock Reply Votes
             $query = $db->prepare("SELECT count(voteID) AS c, objectID FROM " . TABLE_FORUM_VOTES . " WHERE voterID=%d AND voteStatus=0 GROUP BY objectID", $userID);
             $vRows = $db->getResultsArray($query);
             foreach ($vRows as $row) {
                 $db->query("UPDATE " . TABLE_FORUM_REPLIES . " SET `votes` = `votes` + " . $row['c'] . " WHERE replyID=" . $row['objectID']);
             }
             $db->query("UPDATE " . TABLE_FORUM_VOTES . " SET voteStatus=1 WHERE voterID=" . $userID);
             //Unblock page section & Trade section
             $tradeItemIns = new BuckysTradeItem();
             $tradeOfferIns = new BuckysTradeOffer();
             $pageIns = new BuckysPage();
             $tradeItemIns->massStatusChange($userID, BuckysTradeItem::STATUS_ITEM_ACTIVE);
             $tradeOfferIns->massStatusChange($userID, BuckysTradeOffer::STATUS_OFFER_ACTIVE);
             $pageIns->massStatusChange($userID, BuckysPage::STATUS_ACTIVE);
             //enable Shop Products
             $shopProdIns = new BuckysShopProduct();
             $shopProdIns->massStatusChange($userID, BuckysShopProduct::STATUS_ACTIVE);
             //Remove From banned users table
             $db->query("DELETE FROM " . TABLE_BANNED_USERS . "  WHERE bannedID=" . $brow['bannedID']);
         }
     }
 }
 /**
  * @param $userID
  * @param $categoryID
  */
 public static function blockUser($userID, $categoryID)
 {
     global $db;
     //Getting Users Topics and Replies
     $query = $db->prepare("SELECT * FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=%d AND categoryID=%d", $userID, $categoryID);
     $topics = $db->getResultsArray($query);
     foreach ($topics as $row) {
         BuckysForumTopic::deleteTopic($row['topicID']);
     }
     $query = $db->prepare("SELECT r.replyID FROM " . TABLE_FORUM_REPLIES . " AS r LEFT JOIN " . TABLE_FORUM_TOPICS . " AS t ON t.topicID=r.topicID WHERE r.creatorID=%d AND t.categoryID=%d", $userID, $categoryID);
     $replies = $db->getResultsArray($query);
     foreach ($replies as $row) {
         BuckysForumReply::deleteReply($row['replyID']);
     }
     //Block User
     $query = $db->prepare("INSERT INTO " . TABLE_FORUM_BLOCKED_USRES . "(userID, categoryID, blockedDate)VALUES(%d, %d, %s)", $userID, $categoryID, date("Y-m-d H:i:s"));
     $db->query($query);
 }
 /**
  * Remove Account
  */
 public static function deleteUserAccount($userID)
 {
     global $db;
     $userID = intval($userID);
     //Fix Comments Count
     $query = $db->prepare("SELECT count(commentID) AS c, postID FROM " . TABLE_POSTS_COMMENTS . " WHERE commenter=%d AND commentStatus=1 GROUP BY postID", $userID);
     $pcRows = $db->getResultsArray($query);
     foreach ($pcRows as $row) {
         $db->query("UPDATE " . TABLE_POSTS . " SET `comments` = `comments` - " . $row['c'] . " WHERE postID=" . $row['postID']);
     }
     //Fix Likes Count
     $query = $db->prepare("SELECT count(likeID) AS c, postID FROM " . TABLE_POSTS_LIKES . " WHERE userID=%d AND likeStatus=1 GROUP BY postID", $userID);
     $plRows = $db->getResultsArray($query);
     foreach ($plRows as $row) {
         $db->query("UPDATE " . TABLE_POSTS . " SET `likes` = `likes` - " . $row['c'] . " WHERE postID=" . $row['postID']);
     }
     //Block Votes for Moderator
     $query = $db->prepare("SELECT count(voteID) AS c, candidateID FROM " . TABLE_MODERATOR_VOTES . " WHERE voterID=%d AND voteStatus=1 GROUP BY candidateID", $userID);
     $vRows = $db->getResultsArray($query);
     foreach ($vRows as $row) {
         $db->query("UPDATE " . TABLE_MODERATOR_CANDIDATES . " SET `votes` = `votes` - " . $row['c'] . " WHERE candidateID=" . $row['candidateID']);
     }
     //Block Replies
     $query = $db->prepare("SELECT count(r.replyID), r.topicID, t.categoryID FROM " . TABLE_FORUM_REPLIES . " AS r LEFT JOIN " . TABLE_FORUM_TOPICS . " AS t ON t.topicID=r.topicID WHERE r.status='publish' AND r.creatorID=%d GROUP BY r.topicID", $userID);
     $rRows = $db->getResultsArray($query);
     $db->query("UPDATE " . TABLE_FORUM_REPLIES . " SET `status`='suspended' WHERE creatorID=" . $userID . " AND `status`='publish'");
     foreach ($rRows as $row) {
         $db->query("UPDATE " . TABLE_FORUM_TOPICS . " SET `replies` = `replies` - " . $row['c'] . " WHERE topicID=" . $row['topicID']);
         $db->query("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `replies` = `replies` - " . $row['c'] . " WHERE categoryID=" . $row['categoryID']);
         BuckysForumTopic::updateTopicLastReplyID($row['topicID']);
     }
     //Block Topics
     $query = $db->prepare("SELECT count(topicID) AS tc, SUM(replies) AS rc, categoryID FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=%d AND `status`='publish' GROUP BY categoryID", $userID);
     $tRows = $db->getResultsArray($query);
     $db->query("UPDATE " . TABLE_FORUM_TOPICS . " SET `status`='suspended' WHERE creatorID=" . $userID . " AND `status`='publish'");
     foreach ($tRows as $row) {
         $db->query("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `replies` = `replies` - " . $row['rc'] . ", `topics` = `topics` - " . $row['tc'] . " WHERE categoryID=" . $row['categoryID']);
         BuckysForumCategory::updateCategoryLastTopicID($row['categoryID']);
     }
     //Block Reply Votes
     $query = $db->prepare("SELECT count(voteID) AS c, objectID FROM " . TABLE_FORUM_VOTES . " WHERE voterID=%d AND voteStatus=1 GROUP BY objectID", $userID);
     $vRows = $db->getResultsArray($query);
     foreach ($vRows as $row) {
         $db->query("UPDATE " . TABLE_FORUM_REPLIES . " SET `votes` = `votes` - " . $row['c'] . " WHERE replyID=" . $row['objectID']);
     }
     //Delete Reported Objects
     $db->query("DELETE FROM " . TABLE_REPORTS . " WHERE objectID IN (SELECT postID FROM " . TABLE_POSTS . " WHERE poster=" . $userID . ")");
     $db->query("DELETE FROM " . TABLE_REPORTS . " WHERE objectID IN (SELECT topicID FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=" . $userID . ")");
     $db->query("DELETE FROM " . TABLE_REPORTS . " WHERE objectID IN (SELECT replyID FROM " . TABLE_FORUM_REPLIES . " WHERE creatorID=" . $userID . ")");
     //Delete From banned Users
     $db->query("DELETE FROM " . TABLE_BANNED_USERS . "  WHERE bannedUserID=" . $userID);
     //Delete Activities
     $db->query("DELETE FROM " . TABLE_MAIN_ACTIVITIES . " WHERE userID=" . $userID);
     //Delete Album Photos
     $db->query("DELETE FROM " . TABLE_ALBUMS_PHOTOS . " WHERE album_id IN (SELECT albumID FROM " . TABLE_ALBUMS . " WHERE OWNER=" . $userID . ")");
     //Delete ALbums
     $db->query("DELETE FROM " . TABLE_ALBUMS . " WHERE OWNER=" . $userID);
     //Delete Friends
     $db->query("DELETE FROM " . TABLE_FRIENDS . " WHERE userID=" . $userID . " OR userFriendID=" . $userID);
     //Delete Messages
     $db->query("DELETE FROM " . TABLE_MESSAGES . " WHERE userID=" . $userID . " OR sender=" . $userID);
     //Delete Private Messengers
     $db->query("DELETE FROM " . TABLE_MESSENGER_BLOCKLIST . " WHERE userID=" . $userID . " OR blockedID=" . $userID);
     $db->query("DELETE FROM " . TABLE_MESSENGER_BUDDYLIST . " WHERE userID=" . $userID . " OR buddyID=" . $userID);
     $db->query("DELETE FROM " . TABLE_MESSENGER_MESSAGES . " WHERE userID=" . $userID . " OR buddyID=" . $userID);
     //Delete Posts
     $posts = $db->getResultsArray("SELECT * FROM " . TABLE_POSTS . " WHERE poster=" . $userID);
     foreach ($posts as $post) {
         //Delete Comments
         $db->query("DELETE FROM " . TABLE_POSTS_COMMENTS . " WHERE postID=" . $post['postID']);
         //Delete Likes
         $db->query("DELETE FROM " . TABLE_POSTS_LIKES . " WHERE postID=" . $post['postID']);
         //Delete hits
         $db->query("DELETE FROM " . TABLE_POSTS_HITS . " WHERE postID=" . $post['postID']);
     }
     $db->query("DELETE FROM " . TABLE_POSTS . " WHERE poster=" . $userID);
     //Delete Pages
     $pageIns = new BuckysPage();
     $pageIns->deletePageByUserID($userID);
     //Delete Trade Section which are related to this user.
     $tradeIns = new BuckysTradeItem();
     $tradeIns->deleteItemsByUserID($userID);
     //Delete Shop Section which are related to this user
     $shopIns = new BuckysShopProduct();
     $shopIns->deleteProductsByUserID($userID);
     //Delete Comments
     $db->query("DELETE FROM " . TABLE_POSTS_COMMENTS . " WHERE commenter=" . $userID);
     //Delete Likes
     $db->query("DELETE FROM " . TABLE_POSTS_LIKES . " WHERE userID=" . $userID);
     //Delete Page Followers
     $db->query("DELETE FROM " . TABLE_PAGE_FOLLOWERS . " WHERE userID=" . $userID);
     //Getting Removed Topics
     $topicIDs = $db->getResultsArray("SELECT topicID FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=" . $userID);
     if (!$topicIDs) {
         $topicIDs = [0];
     }
     //Delete Reply Votes
     $db->query("DELETE FROM " . TABLE_FORUM_VOTES . " WHERE voterID=" . $userID);
     $db->query("DELETE FROM " . TABLE_FORUM_VOTES . " WHERE objectID IN ( SELECT replyID FROM " . TABLE_FORUM_REPLIES . " WHERE creatorID=" . $userID . " OR topicID IN (" . implode(", ", $topicIDs) . ") )");
     //Delete Replies
     $db->query("DELETE FROM " . TABLE_FORUM_REPLIES . " WHERE creatorID=" . $userID . " OR topicID IN (" . implode(", ", $topicIDs) . ")");
     //Delete Topics
     $db->query("DELETE FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=" . $userID);
     //Delete Users
     /*$db->query("DELETE FROM " . TABLE_USERS . " WHERE userID=" . $userID);
     		$db->query("DELETE FROM " . TABLE_USERS_CONTACT . " WHERE userID=" . $userID);
     		$db->query("DELETE FROM " . TABLE_USERS_EDUCATIONS . " WHERE userID=" . $userID);
     		$db->query("DELETE FROM " . TABLE_USERS_EMPLOYMENTS . " WHERE userID=" . $userID);
     		$db->query("DELETE FROM " . TABLE_USERS_LINKS . " WHERE userID=" . $userID);
     		$db->query("DELETE FROM " . TABLE_USERS_TOKEN . " WHERE userID=" . $userID);*/
     //Don't delete user from the database, just update the user's status
     $db->query("UPDATE " . TABLE_USERS . " SET `status`=" . BuckysUser::STATUS_USER_DELETED . " WHERE userID=" . $userID);
     //Send
     $bitCoinInfo = BuckysUser::getUserBitcoinInfo($userID);
     if ($bitCoinInfo) {
         $userInfo = BuckysUser::getUserBasicInfo($userID);
         $content = "Your " . TNB_SITE_NAME . " account has been deleted. However, you may still access your Bitcoin wallet at:\n" . "https://blockchain.info/wallet/login\n" . "Identifier: " . $bitCoinInfo['bitcoin_guid'] . "\n" . "Password: "******"\n";
         //Send Email to User
         buckys_sendmail($userInfo['email'], $userInfo['firstName'] . ' ' . $userInfo['lastName'], TNB_SITE_NAME . ' Account has been Deleted', $content);
     }
 }
Exemplo n.º 11
0
}
//Getting Topics by category id
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'recent';
switch ($orderby) {
    case 'recent':
        $orderbyString = 'lastReplyDate DESC';
        break;
    case 'rating':
        $orderbyString = 't.votes DESC';
        break;
    case 'replies':
        $orderbyString = 't.replies DESC';
        break;
}
$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'], $orderbyString, BuckysForumTopic::$COUNT_PER_PAGE);
$hierarchical = BuckysForumCategory::getCategoryHierarchical($category['categoryID']);
//Mark Forum Notifications to read
if (buckys_check_user_acl(USER_ACL_REGISTERED)) {
    BuckysForumNotification::makeNotificationsToRead($TNB_GLOBALS['user']['userID'], $category['categoryID']);
}
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/category';
$TNB_GLOBALS['title'] = $category['categoryName'] . ' - thenewboston Forum';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
Exemplo n.º 12
0
 if ($reportType == 'post') {
     echo buckys_process_post_content($row);
 } else {
     if ($reportType == 'message') {
         echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;To: <a href='/profile.php?user="******"'>" . $row['receiverName'] . "</a><br />";
         echo "&nbsp;&nbsp;&nbsp;&nbsp;From: <a href='/profile.php?u=" . $row['senderID'] . "'>" . $row['senderName'] . "</a><br />";
         echo "Subject: <b>" . $row['subject'] . "</b><br />";
         echo '<p class="message-body">' . $row['content'] . '</p>';
     } else {
         if ($reportType == 'topic') {
             echo '<h3>' . $row['title'] . '</h3>';
             echo BuckysForumTopic::_convertBBCodeToHTML($row['content']);
         } else {
             if ($reportType == 'reply') {
                 echo '<h3>Topic: ' . $row['title'] . '</h3>';
                 echo BuckysForumTopic::_convertBBCodeToHTML($row['content']);
             } else {
                 echo $row['content'];
             }
         }
     }
 }
 ?>
                     &nbsp;
                 </div>
                 <div class="td td-action">
                     <?php 
 /*switch($reportType)
   {
       case 'post':
           $viewLink = '/posts.php?user= '******'ownerID'] . '&post=' . $row['objectID'];
<?php

require_once dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
//Getting Topics by category id
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$total = BuckysForumTopic::getTotalNumOfTopics('publish');
$pagination = new Pagination($total, BuckysForumTopic::$COUNT_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
$topics = BuckysForumTopic::getTopics($page, 'publish', null, 'lastReplyDate DESC, t.createdDate DESC', BuckysForumTopic::$COUNT_PER_PAGE);
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/recent_activity';
$TNB_GLOBALS['title'] = 'Recent Activity - thenewboston Forum';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
 /**
  * Delete Objects
  *
  * @param Array $ids
  */
 public static function deleteObjects($ids)
 {
     global $db;
     if (!is_array($ids)) {
         $ids = [$ids];
     }
     $ids = $db->escapeInput($ids);
     $query = $db->prepare("SELECT * FROM " . TABLE_REPORTS . " WHERE reportID IN (" . implode(", ", $ids) . ")");
     $rows = $db->getResultsArray($query);
     foreach ($rows as $row) {
         if ($row['objectType'] == 'post') {
             $post = $db->getRow("SELECT * FROM " . TABLE_POSTS . " WHERE postID=" . $row['objectID']);
             BuckysPost::deletePost($post['poster'], $post['postID']);
         } else {
             if ($row['objectType'] == 'comment') {
                 //Getting Data
                 $comment = $db->getRow("SELECT * FROM " . TABLE_POSTS_COMMENTS . " WHERE commentID=" . $row['objectID']);
                 BuckysComment::deleteComment($comment['commenter'], $comment['commentID']);
             } else {
                 if ($row['objectType'] == 'video_comment') {
                     //Getting Data
                     $comment = $db->getRow("SELECT * FROM " . TABLE_VIDEO_COMMENTS . " WHERE commentID=" . $row['objectID']);
                     BuckysVideo::deleteVideoComment($comment['commentID']);
                 } else {
                     if ($row['objectType'] == 'message') {
                         //Delete Message
                         $db->query("DELETE FROM " . TABLE_MESSAGES . " WHERE messageID=" . $row['objectID']);
                     } else {
                         if ($row['objectType'] == 'topic') {
                             //Delete Topic
                             BuckysForumTopic::deleteTopic($row['objectID']);
                         } else {
                             if ($row['objectType'] == 'reply') {
                                 //Delete Topic
                                 BuckysForumReply::deleteReply($row['objectID']);
                             } else {
                                 if ($row['objectType'] == 'shop_item') {
                                     //Delete Shop Product
                                     $shopProdIns = new BuckysShopProduct();
                                     $shopProdIns->removeProductByUserID($row['objectID'], $row['reportedID']);
                                 } else {
                                     if ($row['objectType'] == 'trade_item') {
                                         //Delete Trade Item
                                         $tradeItemIns = new BuckysTradeItem();
                                         $tradeItemIns->removeItemByUserID($row['objectID'], $row['reportedID']);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //Delete the row on the report table
         $db->query("DELETE FROM " . TABLE_REPORTS . " WHERE reportID=" . $row['reportID']);
     }
     return;
 }
Exemplo n.º 15
0
if ($videoID) {
    $video = $videoClass->getVideo($videoID);
    if (!$video) {
        buckys_redirect("/videos.php", MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
        exit;
    }
    $categoryID = $video['categoryID'];
}
if ($categoryID) {
    $category = $videoClass->getCategory($categoryID);
    $categoryVideos = $videoClass->getVideos($categoryID);
    if (!$videoID) {
        $video = $categoryVideos[0];
    }
    //Getting Forum Recent Posts
    $topics = BuckysForumTopic::getTopics(1, 'publish', $category['forumCategoryID'], 'lastReplyDate DESC', 10);
    $forumCategory = BuckysForumCategory::getCategory($category['forumCategoryID']);
    //Get Prev, Next Video
    $prevVideoId = null;
    $nextVideoId = null;
    foreach ($categoryVideos as $idx => $v) {
        if ($v['videoID'] == $video['videoID']) {
            $nextVideoId = isset($categoryVideos[$idx + 1]) ? $categoryVideos[$idx + 1]['videoID'] : null;
            break;
        }
        $prevVideoId = $v['videoID'];
    }
    $subjectID = $category['subjectID'];
}
$videoSubject = $videoClass->getSubject($subjectID);
$videoCategories = $videoClass->getVideoCategories($subjectID);
Exemplo n.º 16
0
 /**
  * Delete Objects
  * 
  * @param Array $ids
  * @param String $objectType
  * @param String $modeartorType
  */
 public function deleteObjects($ids, $objectType, $moderatorType)
 {
     global $db;
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $ids = $db->escapeInput($ids);
     $query = $db->prepare("SELECT * FROM " . TABLE_REPORTS . " WHERE objectType=%s AND reportID in (" . implode(", ", $ids) . ")", $objectType);
     $rows = $db->getResultsArray($query);
     foreach ($rows as $row) {
         if ($row['objectType'] == 'post') {
             $post = $db->getRow("SELECT * FROM " . TABLE_POSTS . " WHERE postID=" . $row['objectID']);
             BuckysPost::deletePost($post['poster'], $post['postID']);
         } else {
             if ($row['objectType'] == 'comment') {
                 //Getting Data
                 $comment = $db->getRow("SELECT * FROM " . TABLE_POSTS_COMMENTS . " WHERE commentID=" . $row['objectID']);
                 BuckysComment::deleteComment($comment['commenter'], $comment['commentID']);
             } else {
                 if ($row['objectType'] == 'message') {
                     //Delete Message
                     $db->query("DELETE FROM " . TABLE_MESSAGES . " WHERE messageID=" . $row['objectID']);
                 } else {
                     if ($row['objectType'] == 'topic') {
                         //Delete Topic
                         BuckysForumTopic::deleteTopic($row['objectID']);
                     } else {
                         if ($row['objectType'] == 'reply') {
                             //Delete Topic
                             BuckysForumReply::deleteReply($row['objectID']);
                         }
                     }
                 }
             }
         }
         //Delete the row on the report table
         $db->query("DELETE FROM " . TABLE_REPORTS . " WHERE reportID=" . $row['reportID']);
     }
     return;
 }
Exemplo n.º 17
0
 /**
  * Remove Account
  * 
  */
 public function deleteUserAccount($userID)
 {
     global $db;
     $userID = intval($userID);
     //Fix Comments Count
     $query = $db->prepare("SELECT count(commentID) as c, postID FROM " . TABLE_POSTS_COMMENTS . " WHERE commenter=%d AND commentStatus=1 GROUP BY postID", $userID);
     $pcRows = $db->getResultsArray($query);
     foreach ($pcRows as $row) {
         $db->query("UPDATE " . TABLE_POSTS . " SET `comments` = `comments` - " . $row['c'] . " WHERE postID=" . $row['postID']);
     }
     //Fix Likes Count
     $query = $db->prepare("SELECT count(likeID) as c, postID FROM " . TABLE_POSTS_LIKES . " WHERE userID=%d AND likeStatus=1 GROUP BY postID", $userID);
     $plRows = $db->getResultsArray($query);
     foreach ($plRows as $row) {
         $db->query("UPDATE " . TABLE_POSTS . " SET `likes` = `likes` - " . $row['c'] . " WHERE postID=" . $row['postID']);
     }
     //Block Votes for Moderator
     $query = $db->prepare("SELECT count(voteID) as c, candidateID FROM " . TABLE_MODERATOR_VOTES . " WHERE voterID=%d AND voteStatus=1 GROUP BY candidateID", $userID);
     $vRows = $db->getResultsArray($query);
     foreach ($vRows as $row) {
         $db->query("UPDATE " . TABLE_MODERATOR_CANDIDATES . " SET `votes` = `votes` - " . $row['c'] . " WHERE candidateID=" . $row['candidateID']);
     }
     //Block Replies
     $query = $db->prepare("SELECT count(r.replyID), r.topicID, t.categoryID FROM " . TABLE_FORUM_REPLIES . " AS r LEFT JOIN " . TABLE_FORUM_TOPICS . " AS t ON t.topicID=r.topicID WHERE r.status='publish' AND r.creatorID=%d GROUP BY r.topicID", $userID);
     $rRows = $db->getResultsArray($query);
     $db->query("UPDATE " . TABLE_FORUM_REPLIES . " SET `status`='suspended' WHERE creatorID=" . $userID . " AND `status`='publish'");
     foreach ($rRows as $row) {
         $db->query("UPDATE " . TABLE_FORUM_TOPICS . " SET `replies` = `replies` - " . $row['c'] . " WHERE topicID=" . $row['topicID']);
         $db->query("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `replies` = `replies` - " . $row['c'] . " WHERE categoryID=" . $row['categoryID']);
         BuckysForumTopic::updateTopicLastReplyID($row['topicID']);
     }
     //Block Topics
     $query = $db->prepare("SELECT count(topicID) as tc, SUM(replies) as rc, categoryID FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=%d AND `status`='publish' GROUP BY categoryID", $userID);
     $tRows = $db->getResultsArray($query);
     $db->query("UPDATE " . TABLE_FORUM_TOPICS . " SET `status`='suspended' WHERE creatorID=" . $userID . " AND `status`='publish'");
     foreach ($tRows as $row) {
         $db->query("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `replies` = `replies` - " . $row['rc'] . ", `topics` = `topics` - " . $row['tc'] . " WHERE categoryID=" . $row['categoryID']);
         BuckysForumCategory::updateCategoryLastTopicID($row['categoryID']);
     }
     //Block Reply Votes
     $query = $db->prepare("SELECT count(voteID) as c, objectID FROM " . TABLE_FORUM_VOTES . " WHERE voterID=%d AND voteStatus=1 GROUP BY objectID", $userID);
     $vRows = $db->getResultsArray($query);
     foreach ($vRows as $row) {
         $db->query("UPDATE " . TABLE_FORUM_REPLIES . " SET `votes` = `votes` - " . $row['c'] . " WHERE replyID=" . $row['objectID']);
     }
     //Delete Reported Objects
     $db->query("DELETE FROM " . TABLE_REPORTS . " WHERE objectID IN (SELECT postID FROM " . TABLE_POSTS . " WHERE poster=" . $userID . ")");
     $db->query("DELETE FROM " . TABLE_REPORTS . " WHERE objectID IN (SELECT topicID FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=" . $userID . ")");
     $db->query("DELETE FROM " . TABLE_REPORTS . " WHERE objectID IN (SELECT replyID FROM " . TABLE_FORUM_REPLIES . " WHERE creatorID=" . $userID . ")");
     //Delete From banned Users
     $db->query("DELETE FROM " . TABLE_BANNED_USERS . "  WHERE bannedUserID=" . $userID);
     //Delete Activities
     $db->query("DELETE FROM " . TABLE_ACTIVITES . " WHERE userID=" . $userID);
     //Delete Album Photos
     $db->query("DELETE FROM " . TABLE_ALBUMS_PHOTOS . " WHERE album_id IN (SELECT albumID FROM " . TABLE_ALBUMS . " WHERE owner=" . $userID . ")");
     //Delete ALbums
     $db->query("DELETE FROM " . TABLE_ALBUMS . " WHERE owner=" . $userID);
     //Delete Friends
     $db->query("DELETE FROM " . TABLE_FRIENDS . " WHERE userID=" . $userID . " OR userFriendID=" . $userID);
     //Delete Messages
     $db->query("DELETE FROM " . TABLE_MESSAGES . " WHERE userID=" . $userID . " OR sender=" . $userID);
     //Delete Private Messengers
     $db->query("DELETE FROM " . TABLE_MESSENGER_BLOCKLIST . " WHERE userID=" . $userID . " OR blockedID=" . $userID);
     $db->query("DELETE FROM " . TABLE_MESSENGER_BUDDYLIST . " WHERE userID=" . $userID . " OR buddyID=" . $userID);
     $db->query("DELETE FROM " . TABLE_MESSENGER_MESSAGES . " WHERE userID=" . $userID . " OR buddyID=" . $userID);
     //Delete Posts
     $posts = $db->getResultsArray("SELECT * FROM " . TABLE_POSTS . " WHERE poster=" . $userID);
     foreach ($posts as $post) {
         //Delete Comments
         $db->query("DELETE FROM " . TABLE_POSTS_COMMENTS . " WHERE postID=" . $post['postID']);
         //Delete Likes
         $db->query("DELETE FROM " . TABLE_POSTS_LIKES . " WHERE postID=" . $post['postID']);
         //Delete hits
         $db->query("DELETE FROM " . TABLE_POSTS_HITS . " WHERE postID=" . $post['postID']);
     }
     $db->query("DELETE FROM " . TABLE_POSTS . " WHERE poster=" . $userID);
     //Delete Pages
     $pageIns = new BuckysPage();
     $pageIns->deletePageByUserID($userID);
     //Delete Trade Section which are related to this user.
     $tradeIns = new BuckysTradeItem();
     $tradeIns->deleteItemsByUserID($userID);
     //Delete Comments
     $db->query("DELETE FROM " . TABLE_POSTS_COMMENTS . " WHERE commenter=" . $userID);
     //Delete Likes
     $db->query("DELETE FROM " . TABLE_POSTS_LIKES . " WHERE userID=" . $userID);
     //Getting Removed Topics
     $topicIDs = $db->getResultsArray("SELECT topicID FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=" . $userID);
     if (!$topicIDs) {
         $topicIDs = array(0);
     }
     //Delete Reply Votes
     $db->query("DELETE FROM " . TABLE_FORUM_VOTES . " WHERE voterID=" . $userID);
     $db->query("DELETE FROM " . TABLE_FORUM_VOTES . " WHERE objectID IN ( SELECT replyID FROM " . TABLE_FORUM_REPLIES . " WHERE creatorID=" . $userID . " OR topicID IN (" . implode(", ", $topicIDs) . ") )");
     //Delete Replies
     $db->query("DELETE FROM " . TABLE_FORUM_REPLIES . " WHERE creatorID=" . $userID . " OR topicID IN (" . implode(", ", $topicIDs) . ")");
     //Delete Topics
     $db->query("DELETE FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=" . $userID);
     //Delete Users
     /*$db->query("DELETE FROM " . TABLE_USERS . " WHERE userID=" . $userID);
       $db->query("DELETE FROM " . TABLE_USERS_CONTACT . " WHERE userID=" . $userID);
       $db->query("DELETE FROM " . TABLE_USERS_EDUCATIONS . " WHERE userID=" . $userID);
       $db->query("DELETE FROM " . TABLE_USERS_EMPLOYMENTS . " WHERE userID=" . $userID);
       $db->query("DELETE FROM " . TABLE_USERS_LINKS . " WHERE userID=" . $userID);
       $db->query("DELETE FROM " . TABLE_USERS_TOKEN . " WHERE userID=" . $userID);*/
     //Don't delete user from the database, just update the user's status
     $db->query("UPDATE " . TABLE_USERS . " SET `status`=" . BuckysUser::STATUS_USER_DELETED . " WHERE userID=" . $userID);
 }
Exemplo n.º 18
0
<?php

require dirname(__FILE__) . '/includes/bootstrap.php';
$userID = buckys_is_logged_in();
$popularImages = BuckysPost::getPostsFromStats('image');
$popularPosts = BuckysPost::getPostsFromStats('text');
$popularVideos = BuckysPost::getPostsFromStats('video');
$popularPages = BuckysPage::getPopularPagesForHomepage();
$recentTopics = BuckysForumTopic::getTopics(1, 'publish', null, 'lastReplyDate DESC, t.createdDate DESC', 5);
$recentTradeItems = BuckysTradeItem::getRecentItems(3);
buckys_enqueue_stylesheet('index.css');
$BUCKYS_GLOBALS['content'] = "home";
$BUCKYS_GLOBALS['title'] = "BuckysRoom - The Worlds Most Popular Open Source Social Network";
require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
Exemplo n.º 19
0
                    $data = array('status' => 'success', 'message' => MSG_THANKS_YOUR_VOTE, 'votes' => ($result > 0 ? "+" : "") . $result);
                } else {
                    $data = array('status' => 'error', 'message' => $result);
                }
            }
        }
        render_result_xml($data);
        exit;
    }
} else {
    if (isset($_GET['action']) && $_GET['action'] == 'delete') {
        //Delete this topic
        $userID = buckys_is_logged_in();
        $topicID = isset($_GET['id']) ? get_secure_integer($_GET['id']) : null;
        if (isset($topicID)) {
            $forumTopicIns = new BuckysForumTopic();
            $forumData = $forumTopicIns->getTopic($topicID);
            if (isset($forumData) && $forumData['creatorID'] == $userID) {
                //then you can delete this one.
                $forumTopicIns->deleteTopic($topicID);
                buckys_redirect('/forum', MSG_TOPIC_REMOVED_SUCCESSFULLY, MSG_TYPE_SUCCESS);
            } else {
                //You don't have permission
                buckys_redirect('/forum/topic.php?id=' . $topicID, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
            }
        }
    }
}
$topicID = isset($_GET['id']) ? $_GET['id'] : 0;
$topic = BuckysForumTopic::getTopic($topicID);
if (!$topic) {
<?php

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
if (!buckys_check_user_acl(USER_ACL_REGISTERED)) {
    buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
//======= Check if permission allowed ===========//
$permissionAllowed = false;
$forumTopicIns = new BuckysForumTopic();
$userID = buckys_is_logged_in();
$topicID = isset($_REQUEST['id']) ? get_secure_integer($_REQUEST['id']) : null;
if (isset($topicID)) {
    $forumData = $forumTopicIns->getTopic($topicID);
    if (isset($forumData) && $forumData['creatorID'] == $userID) {
        $permissionAllowed = true;
    }
}
if ($permissionAllowed == false) {
    buckys_redirect("/forum/topic.php?id=" . $topicID, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
if (isset($_POST['action'])) {
    if ($_POST['action'] == 'edit-topic') {
        $result = $forumTopicIns->editTopic($_POST);
        if ($result === true) {
            buckys_redirect("/forum/topic.php?id=" . $topicID, MSG_TOPIC_POSTED_SUCCESSFULLY, MSG_TYPE_SUCCESS);
        } else {
            buckys_redirect("/forum/edit_topic.php?id=" . $topicID, $result, MSG_TYPE_ERROR);
        }
    }
}
$categoryID = $forumData['categoryID'];
Exemplo n.º 21
0
                    <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 
                }
                ?>
                    <?php 
                if ($pendingReplies > 0) {
                    ?>
Exemplo n.º 22
0
                            <?php 
    }
    ?>
                                            
                        <?php 
}
?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>
                        <textarea cols="20" id="topic-content" name="content" rows="12" class="textarea"><?php 
if ($forumTopicData) {
    echo BuckysForumTopic::_convertBBCodeToHTML($forumTopicData['topicContent']);
}
?>
</textarea>
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>
                        <input type="submit" value="Post" class="redButton" />
                    </td>
                </tr>                
            </table>            
        </form>
    </section>
</section>
Exemplo n.º 23
0
    } else {
        if (isset($_GET['action']) && $_GET['action'] == 'move-topic') {
            //Delete this topic
            if (!buckys_check_user_acl(USER_ACL_MODERATOR)) {
                buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
            }
            $userID = buckys_is_logged_in();
            $topicID = isset($_GET['id']) ? buckys_escape_query_integer($_GET['id']) : null;
            $catID = isset($_GET['category']) ? buckys_escape_query_integer($_GET['category']) : null;
            if (!$topicID) {
                buckys_redirect('/forum', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
            }
            if (!$catID || !($category = BuckysForumCategory::getCategory($catID))) {
                buckys_redirect('/forum/topic.php?id=' . $topicID, MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
            }
            $forumTopicIns = new BuckysForumTopic();
            $forumTopicIns->moveTopic($topicID, $catID);
            buckys_redirect('/forum/topic.php?id=' . $topicID, MSG_TOPIC_MOVED_SUCCESSFULLY);
        }
    }
}
$topicID = isset($_GET['id']) ? buckys_escape_query_integer($_GET['id']) : 0;
$topic = BuckysForumTopic::getTopic($topicID);
if (!$topic) {
    buckys_redirect('/forum');
}
$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');
}
Exemplo n.º 24
0
<?php

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
if (!buckys_check_user_acl(USER_ACL_REGISTERED)) {
    buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
$topicID = isset($_GET['id']) ? $_GET['id'] : 0;
$topic = BuckysForumTopic::getTopic($topicID);
$forumReplyIns = new BuckysForumReply();
$view = array();
$view['action_type'] = 'create';
if (!$topic) {
    buckys_redirect('/forum');
}
if (isset($_POST['action'])) {
    if ($_POST['action'] == 'post-reply') {
        $result = BuckysForumReply::createReply($_POST);
        if ($result == 'pending' || $result == 'publish') {
            buckys_redirect("/forum/topic.php?id=" . $topicID, MSG_REPLY_POSTED_SUCCESSFULLY . ($result == 'pending' ? ' ' . MSG_POST_IS_UNDER_PREVIEW : ''), MSG_TYPE_SUCCESS);
        } else {
            buckys_redirect("/forum/post_reply.php?id=" . $topicID, $result, MSG_TYPE_ERROR);
        }
    } else {
        if ($_POST['action'] == 'edit-post-reply') {
            $userID = buckys_is_logged_in();
            $replyID = isset($_REQUEST['replyID']) ? get_secure_integer($_REQUEST['replyID']) : null;
            $replyData = $forumReplyIns->getReplyByID($replyID);
            if ($replyData && $replyData['creatorID'] == $userID && $replyData['topicID'] == $topicID) {
                $result = $forumReplyIns->editReply($_POST);
                if ($result == 'pending' || $result == 'publish') {
                    buckys_redirect("/forum/topic.php?id=" . $topicID, MSG_REPLY_POSTED_SUCCESSFULLY, MSG_TYPE_SUCCESS);
        }
    } 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);
            if ($result === true) {
                buckys_redirect('/forum/pending_topics.php', MSG_TOPIC_REMOVED_SUCCESSFULLY);
            } else {
                buckys_redirect('/forum/pending_topics.php', $result, MSG_TYPE_ERROR);
            }
        }
    }
}
//Getting Pending Topics
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$total = BuckysForumTopic::getTotalNumOfTopics('pending');
$pagination = new Pagination($total, BuckysForumTopic::$COUNT_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
$topics = BuckysForumTopic::getTopics($page, 'pending', null, null, BuckysForumTopic::$COUNT_PER_PAGE);
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/pending_topics';
$TNB_GLOBALS['title'] = 'Pending Topics - thenewboston Forum';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
    echo $pagination->renderPaginate('/forum/pending_replies.php?', count($replies));
    ?>
</td>
                        </tr>
                        <tr>
                            <td colspan="6">
                                <input type="button" id="approve-btn" value="Approve" class="redButton"
                                    style="margin-right:5px;"/> <input type="button" id="delete-btn" value="Delete"
                                    class="redButton"/>
                            </td>
                        </tr>
                        </tfoot>
                        <tbody>
                        <?php 
    foreach ($replies as $row) {
        $trow = BuckysForumTopic::getTopic($row['topicID']);
        ?>
                            <tr>
                                <td class="td-chk">
                                    <input type="checkbox" name="rid[]" value="<?php 
        echo $row['replyID'];
        ?>
"/></td>
                                <td>
                                    <a href="/forum/topic.php?id=<?php 
        echo $trow['topicID'];
        ?>
"><?php 
        echo $trow['topicTitle'];
        ?>
</a>
Exemplo n.º 27
0
<?php

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
if (!buckys_check_user_acl(USER_ACL_REGISTERED)) {
    buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
if (isset($_POST['action'])) {
    if ($_POST['action'] == 'create-topic') {
        $result = BuckysForumTopic::createTopic($_POST);
        if ($result == 'publish' || $result == 'pending') {
            buckys_redirect("/forum", MSG_TOPIC_POSTED_SUCCESSFULLY . ($result == 'pending' ? ' ' . MSG_POST_IS_UNDER_PREVIEW : ''), MSG_TYPE_SUCCESS);
        } else {
            buckys_redirect("/forum/create_topic.php", $result, MSG_TYPE_ERROR);
        }
    }
}
$curCatID = isset($_GET['category']) ? $_GET['category'] : 0;
$categories = BuckysForumCategory::getAllCategories();
buckys_enqueue_stylesheet('editor/jquery.cleditor.css');
buckys_enqueue_stylesheet('uploadify.css');
buckys_enqueue_stylesheet('forum.css');
buckys_enqueue_javascript('jquery-migrate-1.2.0.js');
buckys_enqueue_javascript('uploadify/jquery.uploadify.js');
buckys_enqueue_javascript('editor/jquery.cleditor.js');
//buckys_enqueue_javascript('editor/jquery.cleditor.bbcode.js');
$view['action_type'] = 'create';
$BUCKYS_GLOBALS['headerType'] = 'forum';
$BUCKYS_GLOBALS['content'] = 'forum/create_topic';
$BUCKYS_GLOBALS['title'] = 'Create a New Topic - BuckysRoomForum';
require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
$orderBy = isset($_GET['orderby']) ? buckys_escape_query_string($_GET['orderby']) : 'recent';
switch ($orderBy) {
    case 'recent':
        $orderByStr = ' lastReplyDate DESC ';
        break;
    case 'rating':
        $orderByStr = ' t.votes DESC ';
        break;
    case 'replies':
        $orderByStr = ' t.replies DESC ';
        break;
    case 'best-match':
    default:
        $orderByStr = ' relevance DESC ';
        break;
}
$page = isset($_GET['page']) ? buckys_escape_query_integer($_GET['page']) : 1;
$results = BuckysForumTopic::searchTopic($keyword, $categoryID, $page, $orderByStr, BuckysForumTopic::$COUNT_PER_PAGE);
$pagination = new Pagination($results['total'], BuckysForumTopic::$COUNT_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
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/search_topics';
$TNB_GLOBALS['title'] = 'Search Topics - thenewboston Forum';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
                <table cellpadding="0" cellspacing="0" class="forumlist">
                    <tfoot>
                    <tr>
                        <td colspan="3"><?php 
    echo $pagination->renderPaginate('/forum/search_topics.php?s=' . $keyword . '&orderby=' . $orderBy . '&', $results['total']);
    ?>
</td>
                    </tr>
                    </tfoot>
                    <tbody>
                    <?php 
    foreach ($results['topics'] as $row) {
        ?>
                    <tr>
                        <td <?php 
        echo !BuckysForumTopic::isVoted($row['topicID']) ? 'class="post-votes"' : 'class="post-votes voted votedStatus1" title="' . MSG_ALREADY_CASTED_A_VOTE . '"';
        ?>
>
                            <a href="#" class="thumb-up" data-type='topic' data-id="<?php 
        echo $row['topicID'];
        ?>
"
                                data-hashed="<?php 
        echo buckys_encrypt_id($row['topicID']);
        ?>
">
                                <?php 
        if ($row['votes'] > 0) {
            echo '+';
        }
        echo $row['votes'];
Exemplo n.º 30
0
 /**
  * Edit Post Reply
  * 
  * @param mixed $data
  */
 public function editReply($data)
 {
     global $db, $BUCKYS_GLOBALS;
     $content = trim($data['content']);
     if (!$content) {
         return MSG_ALL_FIELDS_REQUIRED;
     }
     //Check Category ID is valid or not
     $query = $db->prepare("SELECT topicID, categoryID, creatorID FROM " . TABLE_FORUM_TOPICS . " WHERE topicID=%d AND status='publish'", $data['topicID']);
     $topic = $db->getRow($query);
     if (!$topic) {
         return MSG_INVALID_REQUEST;
     }
     $content = BuckysForumTopic::_convertHTMLToBBCode($content);
     $updateData = array('replyContent' => $content);
     $db->updateFromArray(TABLE_FORUM_REPLIES, $updateData, array('replyID' => $data['replyID']));
     return true;
 }