findByPostId($postId); if (is_null($forum)) { error(404); } if (!isset($_GET['threadid'])) { header("Location: forums.php?action=viewthread&threadid=" . $forum->findThreadIdByPostId($postId) . "&postid=$postId#post$postId" ); exit; } $threadId = $forum->findThreadIdByPostId($postId); } elseif (isset($_GET['threadid'])) { $postId = false; $threadId = (int)$_GET['threadid']; $forum = $forumMan->findByThreadId($threadId); if (is_null($forum)) { error(404); } } else { error(404); } $forumId = $forum->id(); $threadInfo = $forum->threadInfo($threadId); if (empty($threadInfo)) { error(404); } if (!$Viewer->readAccess($forum)) { error(403); } //Escape strings for later display $ForumName = display_str($forum->name()); $IsDonorForum = ($forumId == DONOR_FORUM); $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) { $PostNum = 1; } else { if (isset($_GET['post'])) { $PostNum = (int)($_GET['post'] ?? 1); } elseif ($postId && $postId != $threadInfo['StickyPostID']) { $PostNum = $forum->threadNumPosts($threadId, $postId, $threadInfo['StickyPostID'] < $postId); } else { $PostNum = 1; } } $Page = max(1, isset($_GET['page']) ? (int)$_GET['page'] : (int)ceil(min($threadInfo['Posts'], $PostNum) / $PerPage) ); if (($Page - 1) * $PerPage > $threadInfo['Posts']) { $Page = (int)ceil($threadInfo['Posts'] / $PerPage); } $thread = $forum->threadPage($threadId, $PerPage, $Page); $paginator = new Gazelle\Util\Paginator($PerPage, $Page); $paginator->setTotal($threadInfo['Posts']); $firstOnPage = current($thread)['ID']; $lastOnPage = end($thread)['ID']; if ($lastOnPage <= $threadInfo['StickyPostID'] && $threadInfo['Posts'] <= $PerPage * $Page) { $lastOnPage = $threadInfo['StickyPostID']; } $quoteCount = $Cache->get_value('notify_quoted_' . $Viewer->id()); if ($quoteCount === false || $quoteCount > 0) { (new Gazelle\User\Quote($Viewer))->clearThread($threadId, $firstOnPage, $lastOnPage); } $lastRead = $forum->userLastReadPost($Viewer->id(), $threadId); if ($lastRead < $lastOnPage) { $forum->userCatchupThread($Viewer->id(), $threadId, $lastOnPage); } $isSubscribed = (new Gazelle\Manager\Subscription($Viewer->id()))->isSubscribed($threadId); if ($isSubscribed) { $Cache->delete_value('subscriptions_user_new_'.$Viewer->id()); } $userMan = new Gazelle\Manager\User; $transitions = $forumMan->threadTransitionList($Viewer, $forumId); $department = $forum->departmentList($Viewer); $auth = $Viewer->auth(); View::show_header("Forums › $ForumName › " . display_str($threadInfo['Title']), 'comments,subscriptions,bbcode', $IsDonorForum ? ',donor' : '' ); echo $Twig->render('forum/header-thread.twig', [ 'auth' => $auth, 'forum' => $forum, 'dept_list' => $forum->departmentList($Viewer), 'is_subbed' => $isSubscribed, 'paginator' => $paginator, 'thread_id' => $threadId, 'thread_title' => $threadInfo['Title'], 'transition' => $transitions, ]); if ($threadInfo['NoPoll'] == 0) { [$Question, $Answers, $Votes, $Featured, $Closed] = $forum->pollData($threadId); if (!empty($Votes)) { $TotalVotes = array_sum($Votes); $MaxVotes = max($Votes); } else { $TotalVotes = 0; $MaxVotes = 0; } $RevealVoters = $forum->hasRevealVotes(); $UserResponse = $forum->pollVote($Viewer->id(), $threadId); if ($UserResponse > 0) { $Answers[$UserResponse] = '» '.$Answers[$UserResponse]; } else { if (!is_null($UserResponse) && $RevealVoters) { $Answers[$UserResponse] = '» '.$Answers[$UserResponse]; } } ?>
Poll View


Votes:

username(); }, $userMan->staffList()); $staffCount = count($names); $votes = $forum->staffVote($threadId); $StaffVotes = []; foreach ($votes as list($who, $Vote)) { $StaffVotes[$Vote] = $who; $names = array_diff($names, explode(', ', $who)); } ?>
Votes: / current staff, total
Missing votes:

+
    $Answer) { ?>


+

permitted('forums_polls_moderate') && !$RevealVoters) { if (!$Featured) { ?>
$Post) { [$PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime] = array_values($Post); $author = new Gazelle\User($AuthorID); $tableClass = ['forum_post', 'wrap_overflow', 'box vertical_margin']; if (((!$threadInfo['isLocked'] || $threadInfo['isSticky']) && $PostID > $lastRead && strtotime($AddedTime) > $Viewer->forumCatchupEpoch() ) || (isset($RequestKey) && $Key == $RequestKey) ) { $tableClass[] = 'forum_unread'; } if (!$Viewer->showAvatars()) { $tableClass[] = 'noavatar'; } if ($threadInfo['AuthorID'] == $AuthorID) { $tableClass[] = 'important_user'; } if ($PostID == $threadInfo['StickyPostID']) { $tableClass[] = 'sticky_post'; } ?> showAvatars()) { ?> showAvatars()) { ?>
# disablePosting()) { ?> - Quote writeAccess($forum) && $AuthorID == $Viewer->id()) && !$Viewer->disablePosting() || $Viewer->permitted('site_moderate_forums')) { ?> - Edit permitted('site_forum_post_delete') && $threadInfo['Posts'] > 1) { ?> - Delete permitted('site_moderate_forums')) { ?> - X permitted('site_moderate_forums')) { ?> - 📌 Report permitted('users_warn') && $Viewer->id() != $AuthorID && $Viewer->classLevel() >= $author->classLevel()) { ?> - Warn   ↑
avatarMarkup($Viewer, $author) ?> showAvatars()) { echo ' colspan="2"'; } ?>>


permitted('site_admin_forums')) { ?> « Last edited by
linkbox(); $lastPost = end($thread); $textarea = new Gazelle\Util\Textarea('quickpost', '', 90, 8); $textarea->setAutoResize()->setPreviewManual(true); if ($Viewer->permitted('site_moderate_forums') || ($Viewer->writeAccess($forum) && !$threadInfo['isLocked'])) { echo $Twig->render('reply.twig', [ 'auth' => $auth, 'action' => 'reply', 'forum' => $forumId, 'id' => $threadId, 'merge' => strtotime($lastPost['AddedTime']) > time() - 3600 && $lastPost['AuthorID'] == $Viewer->id(), 'name' => 'thread', 'subbed' => $isSubscribed, 'textarea' => $textarea, 'user' => $Viewer, ]); } if (count($transitions)) { ?>
Move thread
permitted('site_moderate_forums')) { $Notes = $forum->threadNotes($threadId); ?>

Thread notes

Toggle

Edit thread

> permitted('site_admin_forums')) { ?>
tabindex="4" />
tabindex="6" />
permitted('site_moderate_forums') ?>