Beispiel #1
0
    $userID = 0;
    $isOwnProfile = false;
}
$errorCode;
$displayName;
$location;
$gender;
$email;
$postsPerPage;
$timeZone;
$permisLevel;
if ($userID != 0) {
    $db = connectToDatabase();
    if ($db) {
        if ($isOwnProfile) {
            $results = getPrivateUserDetails($db, $userID, $_SESSION['token']);
            $errorCode = $results[SP::ERROR];
            switch ($errorCode) {
                case ERR::OK:
                    $displayName = $results[USER::DISP_NAME];
                    $location = $results[USER::LOC];
                    $gender = $results[USER::SEX];
                    $email = $results[USER::EMAIL];
                    $postsPerPage = $results[USER::POSTS_PAGE];
                    $permisLevel = $results[PERMISSION::LEVEL];
                    $timeZone = $results[USER::TIME_ZONE];
                    break;
                case ERR::TOKEN_FAIL:
                case ERR::TOKEN_EXPIRED:
                case ERR::USER_NO_TOKEN:
                    header("Location: logout.php?error=" . $errorCode);
Beispiel #2
0
    $threadInfo = getThreadInfo($db, $_SESSION['id'], $threadID);
    echo "<title>" . $threadInfo[THREAD::TITLE] . "</title>";
} else {
    echo "No thread.";
    exit;
}
// If we navigate around the pages, it doesn't count as a view. If we come to a thread without the page set, it does count.
if (isset($_GET['page'])) {
    $page = $_GET['page'];
} else {
    viewThread($db, $threadID);
}
echo "</head><body>";
require "php/topbar.php";
if (isset($_SESSION['id']) && isset($_SESSION['token'])) {
    $loggedUserDetails = getPrivateUserDetails($db, $_SESSION['id'], $_SESSION['token']);
    //$_SESSION['token'] = $loggedUserDetails[SP::TOKEN];
    // Right now, we don't mind if the user's been logged out. This page doesn't require you to be logged in or anything.
    if ($loggedUserDetails[SP::ERROR] == ERR::OK) {
        $postsPerPage = $loggedUserDetails[USER::POSTS_PAGE];
    }
}
$postIDs = getThreadPosts($db, $_GET['threadid']);
$errorCode = $postIDs[SP::ERROR];
unset($postIDs[SP::ERROR]);
$numPosts = count($postIDs);
$parentForumInfo = getForumInfo($db, $_SESSION['id'], $threadInfo[THREAD::FORUM_ID]);
$crumbs = array();
$crumbs[] = "<a href='index.php'>Home</a>";
$crumbs[] = "<a href='forumview.php'>Forums</a>";
$crumbs[] = "<a href='forumview.php?forumid=" . $parentForumInfo[FORUM::ID] . "'>" . $parentForumInfo[FORUM::NAME] . "</a>";