}
//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";
        }
    } 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";
<?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";