query(" SELECT TopicID FROM forums_posts WHERE ID = $_GET[postid]"); list($ThreadID) = $DB->next_record(); if ($ThreadID) { header("Location: forums.php?action=viewthread&threadid=$ThreadID&postid=$_GET[postid]#post$_GET[postid]"); die(); } else { error(404); } } else { error(404); } } else { $ThreadID = $_GET['threadid']; } //---------- Get some data to start processing // Thread information, constant across all pages $ThreadInfo = Forums::get_thread_info($ThreadID, true, true); if ($ThreadInfo === null) { error(404); } $ForumID = $ThreadInfo['ForumID']; // Make sure they're allowed to look at the page if (!Forums::check_forumperm($ForumID)) { error(403); } //Escape strings for later display $ThreadTitle = display_str($ThreadInfo['Title']); $ForumName = display_str($Forums[$ForumID]['Name']); $IsDonorForum = $ForumID == DONOR_FORUM ? true : false; $PerPage = $LoggedUser['PostsPerPage'] ?? POSTS_PER_PAGE; //Post links utilize the catalogue & key params to prevent issues with custom posts per page if ($ThreadInfo['Posts'] > $PerPage) { if (isset($_GET['post']) && is_number($_GET['post'])) { $PostNum = $_GET['post']; } elseif (isset($_GET['postid']) && is_number($_GET['postid']) && $_GET['postid'] != $ThreadInfo['StickyPostID']) { $SQL = " SELECT COUNT(ID) FROM forums_posts WHERE TopicID = $ThreadID AND ID <= $_GET[postid]"; if ($ThreadInfo['StickyPostID'] < $_GET['postid']) { $SQL .= " AND ID != $ThreadInfo[StickyPostID]"; } $DB->query($SQL); list($PostNum) = $DB->next_record(); } else { $PostNum = 1; } } else { $PostNum = 1; } list($Page, $Limit) = Format::page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum)); if (($Page - 1) * $PerPage > $ThreadInfo['Posts']) { $Page = ceil($ThreadInfo['Posts'] / $PerPage); } list($CatalogueID, $CatalogueLimit) = Format::catalogue_limit($Page, $PerPage, THREAD_CATALOGUE); // Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page if (!$Catalogue = $Cache->get_value("thread_{$ThreadID}_catalogue_$CatalogueID")) { $DB->query(" SELECT p.ID, p.AuthorID, p.AddedTime, p.Body, p.EditedUserID, p.EditedTime, ed.Username FROM forums_posts AS p LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID WHERE p.TopicID = '$ThreadID' AND p.ID != '".$ThreadInfo['StickyPostID']."' LIMIT $CatalogueLimit"); $Catalogue = $DB->to_array(false, MYSQLI_ASSOC); if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) { $Cache->cache_value("thread_{$ThreadID}_catalogue_$CatalogueID", $Catalogue, 0); } } $Thread = array_slice($Catalogue, (($PerPage * $Page - $PerPage) % THREAD_CATALOGUE), $PerPage, true); $LastPost = end($Thread); $LastPost = $LastPost['ID']; $FirstPost = reset($Thread); $FirstPost = $FirstPost['ID']; if ($ThreadInfo['Posts'] <= $PerPage*$Page && $ThreadInfo['StickyPostID'] > $LastPost) { $LastPost = $ThreadInfo['StickyPostID']; } $transitions = Forums::get_thread_transitions($ForumID); //Handle last read if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) { $DB->prepared_query(" SELECT PostID FROM forums_last_read_topics WHERE UserID = ? AND TopicID = ?", $LoggedUser['ID'], $ThreadID); list($LastRead) = $DB->next_record(); if ($LastRead < $LastPost) { $DB->prepared_query(" INSERT INTO forums_last_read_topics (UserID, TopicID, PostID) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE PostID = ?", $LoggedUser['ID'], $ThreadID, $LastPost, $LastPost); } } $subscription = new \Gazelle\Manager\Subscription($LoggedUser['ID']); $isSubscribed = $subscription->isSubscribed($ThreadID); if ($isSubscribed) { $Cache->delete_value('subscriptions_user_new_'.$LoggedUser['ID']); } $QuoteNotificationsCount = $Cache->get_value('notify_quoted_' . $LoggedUser['ID']); if ($QuoteNotificationsCount === false || $QuoteNotificationsCount > 0) { $DB->query(" UPDATE users_notify_quoted SET UnRead = false WHERE UserID = '$LoggedUser[ID]' AND Page = 'forums' AND PageID = '$ThreadID' AND PostID >= '$FirstPost' AND PostID <= '$LastPost'"); $Cache->delete_value('notify_quoted_' . $LoggedUser['ID']); } // Start printing View::show_header($ThreadInfo['Title'] . ' ‹ '.$Forums[$ForumID]['Name'].' ‹ Forums','comments,subscriptions,bbcode', $IsDonorForum ? 'donor' : ''); ?>

Forums › ›

0) { ?>
Move thread
pollData($ThreadID); if (!empty($Votes)) { $TotalVotes = array_sum($Votes); $MaxVotes = max($Votes); } else { $TotalVotes = 0; $MaxVotes = 0; } $RevealVoters = in_array($ForumID, $ForumsRevealVoters); //Polls lose the you voted arrow thingy $UserResponse = $DB->scalar(" SELECT Vote FROM forums_polls_votes WHERE UserID = ? AND TopicID = ? ", $LoggedUser['ID'], $ThreadID ); if ($UserResponse > 0) { $Answers[$UserResponse] = '» '.$Answers[$UserResponse]; } else { if (!empty($UserResponse) && $RevealVoters) { $Answers[$UserResponse] = '» '.$Answers[$UserResponse]; } } ?>
Poll View

    $Answer) { if (!empty($Votes[$i]) && $TotalVotes > 0) { $Ratio = $Votes[$i] / $MaxVotes; $Percent = $Votes[$i] / $TotalVotes; } else { $Ratio = 0; $Percent = 0; } ?>
  • (%)
  • 0) { ?>
  • (Blank) (%)

Votes:

query(" SELECT fpv.Vote AS Vote, GROUP_CONCAT(um.Username SEPARATOR ', ') FROM users_main AS um LEFT JOIN forums_polls_votes AS fpv ON um.ID = fpv.UserID WHERE TopicID = $ThreadID GROUP BY fpv.Vote"); $StaffVotesTmp = $DB->to_array(); $StaffCount = count($StaffNames); $StaffVotes = []; foreach ($StaffVotesTmp as $StaffVote) { list($Vote, $Names) = $StaffVote; $StaffVotes[$Vote] = $Names; $Names = explode(', ', $Names); $StaffNames = array_diff($StaffNames, $Names); } ?>
    $Answer) { ?>
  • -  (%) X
  • Blank -  (%)

Votes: / current staff, total
Missing votes:

+
    $Answer) { ?>


+

$Post) { list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post); list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID)); ?>
# - Quote - Edit 1) { ?> - Delete - X - ⇕
Report = $AuthorInfo['Class']) { ?> - Warn   ↑
>


« Last edited by
'Post reply', 'InputName' => 'thread', 'InputID' => $ThreadID, 'ForumID' => $ForumID, 'TextareaCols' => 90 ]); } } if (count($transitions) > 0 && !check_perms('site_moderate_forums')) { ?>
Move thread
query(" SELECT ID, AuthorID, AddedTime, Body FROM forums_topic_notes WHERE TopicID = $ThreadID ORDER BY ID ASC"); $Notes = G::$DB->to_array(); ?>

Thread notes

Toggle

Edit thread

> 0) { ?>
tabindex="2" />
tabindex="2" />