scalar(" SELECT TopicID FROM forums_posts WHERE ID = ? ", $postId ); if (!$threadId) { error(404); } header("Location: forums.php?action=viewthread&threadid=$threadId&postid=$postId#post$postId"); exit; } } //---------- Get some data to start processing $user = new Gazelle\User($LoggedUser['ID']); // TODO: write Gazelle\Manager\Forum that implements $forum = $manager->findByThread($threadId); $forum = new Gazelle\Forum(0); $threadInfo = $forum->threadInfo($threadId); if (empty($threadInfo)) { error(404); } if (!$user->readAccess($forum)) { error(403); } $forumId = $threadInfo['ForumID']; //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) { $PostNum = 1; } else { $postId = (int)($_GET['postid'] ?? 0); if (isset($_GET['post'])) { $PostNum = (int)($_GET['post'] ?? 1); } elseif (!($postId && $postId != $threadInfo['StickyPostID'])) { $PostNum = 1; } else { $PostNum = $forum->threadNumPosts($threadId, $postId, $threadInfo['StickyPostID'] < $postId); } } [$Page] = Format::page_limit($PerPage, min($threadInfo['Posts'], $PostNum)); if (($Page - 1) * $PerPage > $threadInfo['Posts']) { $Page = ceil($threadInfo['Posts'] / $PerPage); } $Catalogue = $forum->threadCatalog($threadId, $PerPage, $Page, THREAD_CATALOGUE); $thread = array_slice($Catalogue, (($Page - 1) * $PerPage) % THREAD_CATALOGUE, $PerPage, true); $FirstPost = current($thread)['ID'];; $LastPost = end($thread)['ID']; if ($threadInfo['Posts'] <= $PerPage * $Page && $threadInfo['StickyPostID'] > $LastPost) { $LastPost = $threadInfo['StickyPostID']; } //Handle last read if (!$threadInfo['isLocked'] || $threadInfo['isSticky']) { $lastRead = $forum->userLastReadPost($user->id(), $threadId); if ($lastRead < $LastPost) { $forum->userCatchupThread($user->id(), $threadId, $LastPost); } } $isSubscribed = (new Gazelle\Manager\Subscription($user->id()))->isSubscribed($threadId); if ($isSubscribed) { $Cache->delete_value('subscriptions_user_new_'.$user->id()); } $QuoteNotificationsCount = $Cache->get_value('notify_quoted_' . $user->id()); if ($QuoteNotificationsCount === false || $QuoteNotificationsCount > 0) { $user->clearThreadQuotes($threadId, $FirstPost, $LastPost); } $Pages = Format::get_pages($Page, $threadInfo['Posts'], $PerPage, 9); $transitions = Forums::get_thread_transitions($forumId); $auth = $LoggedUser['AuthKey']; 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 = ? ", $user->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:

prepared_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 = ? GROUP BY fpv.Vote ", $threadId ); $StaffVotesTmp = $DB->to_array(); $StaffCount = count($StaffNames); $StaffVotes = []; foreach ($StaffVotesTmp as $StaffVote) { [$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) { [$PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime] = array_values($Post); [$AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle] = array_values(Users::user_info($AuthorID)); $tableClass = ['forum_post', 'wrap_overflow', 'box vertical_margin']; if (((!$threadInfo['isLocked'] || $threadInfo['isSticky']) && $PostID > $lastRead && strtotime($AddedTime) > $LoggedUser['CatchupTime'] ) || (isset($RequestKey) && $Key == $RequestKey) ) { $tableClass[] = 'forum_unread'; } if (!Users::has_avatars_enabled()) { $tableClass[] = 'noavatar'; } if ($threadInfo['AuthorID'] == $AuthorID) { $tableClass[] = 'important_user'; } if ($PostID == $threadInfo['StickyPostID']) { $tableClass[] = 'sticky_post'; } ?>
# - Quote id()) || check_perms('site_moderate_forums')) { ?> - Edit 1) { ?> - Delete - X - ⇕
Report id()) { $AuthorInfo = Users::user_info($AuthorID); if ($LoggedUser['Class'] >= $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
threadNotes($threadId); ?>

Thread notes

Toggle

Edit thread

> 0) { ?>
tabindex="4" />
tabindex="6" />