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']; } if (isset($LoggedUser['PostsPerPage'])) { $PerPage = $LoggedUser['PostsPerPage']; } else { $PerPage = POSTS_PER_PAGE; } //---------- Get some data to start processing // Thread information, constant across all pages $ThreadInfo = get_thread_info($ThreadID, true, true); $ForumID = $ThreadInfo['ForumID']; // Make sure they're allowed to look at the page if(!check_forumperm($ForumID)) { error(403); } //Escape strings for later display $ThreadTitle = display_str($ThreadInfo['Title']); $ForumName = display_str($Forums[$ForumID]['Name']); //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'])) { $DB->query("SELECT COUNT(ID) FROM forums_posts WHERE TopicID = $ThreadID AND ID <= $_GET[postid]"); list($PostNum) = $DB->next_record(); } else { $PostNum = 1; } } else { $PostNum = 1; } list($Page,$Limit) = page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum)); if(($Page-1)*$PerPage > $ThreadInfo['Posts']) { $Page = ceil($ThreadInfo['Posts']/$PerPage); } list($CatalogueID,$CatalogueLimit) = 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 = catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE); if($_GET['updatelastread'] != '0') { $LastPost = end($Thread); $LastPost = $LastPost['ID']; reset($Thread); if($ThreadInfo['Posts'] <= $PerPage*$Page && $ThreadInfo['StickyPostID'] > $LastPost) { $LastPost = $ThreadInfo['StickyPostID']; } //Handle last read if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) { $DB->query("SELECT PostID From forums_last_read_topics WHERE UserID='$LoggedUser[ID]' AND TopicID='$ThreadID'"); list($LastRead) = $DB->next_record(); if($LastRead < $LastPost) { $DB->query("INSERT INTO forums_last_read_topics (UserID, TopicID, PostID) VALUES ('$LoggedUser[ID]', '".$ThreadID ."', '".db_string($LastPost)."') ON DUPLICATE KEY UPDATE PostID='$LastPost'"); } } } //Handle subscriptions if(($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === FALSE) { $DB->query("SELECT TopicID FROM users_subscriptions WHERE UserID = '$LoggedUser[ID]'"); $UserSubscriptions = $DB->collect(0); $Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'],$UserSubscriptions,0); } if(empty($UserSubscriptions)) { $UserSubscriptions = array(); } if(in_array($ThreadID, $UserSubscriptions)) { $Cache->delete_value('subscriptions_user_new_'.$LoggedUser['ID']); } // Start printing show_header('Forums'.' > '.$Forums[$ForumID]['Name'].' > '.$ThreadInfo['Title'],'comments,subscriptions,bbcode'); ?>

Forums > >

get_value('polls_'.$ThreadID)) { $DB->query("SELECT Question, Answers, Featured, Closed FROM forums_polls WHERE TopicID='".$ThreadID."'"); list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1)); $Answers = unserialize($Answers); $DB->query("SELECT Vote, COUNT(UserID) FROM forums_polls_votes WHERE TopicID='$ThreadID' GROUP BY Vote"); $VoteArray = $DB->to_array(false, MYSQLI_NUM); $Votes = array(); foreach ($VoteArray as $VoteSet) { list($Key,$Value) = $VoteSet; $Votes[$Key] = $Value; } foreach(array_keys($Answers) as $i) { if (!isset($Votes[$i])) { $Votes[$i] = 0; } } $Cache->cache_value('polls_'.$ThreadID, array($Question,$Answers,$Votes,$Featured,$Closed), 0); } 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 $DB->query("SELECT Vote FROM forums_polls_votes WHERE UserID='".$LoggedUser['ID']."' AND TopicID='$ThreadID'"); list($UserResponse) = $DB->next_record(); if (!empty($UserResponse) && $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 = array(); foreach($StaffVotesTmp as $StaffVote) { list($Vote, $Names) = $StaffVote; $StaffVotes[$Vote] = $Names; $Names = explode(", ", $Names); $StaffNames = array_diff($StaffNames, $Names); } ?>
    $Answer) { ?>
  • -  (%) [X]
  • Blank -  (%)

Votes: /
Missing Votes:

[+]
    $Answer) { //for ($i = 1, $il = count($Answers); $i <= $il; $i++) { ?>


[+]

$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(user_info($AuthorID)); ?>
# - [Quote] - [Edit] 1) { ?> - [Delete] [Sticky] - [X] - [⇕] [Report] = $AuthorInfo['Class']) { ?> - [Warn]  
<?=$Username ?>'s avatar Default avatar >
full_format($Body) ?>

« Last edited by

Post reply

onsubmit="quickpostform.submit_button.disabled=true;" method="post">

tabindex="2" />

Edit thread

Sticky tabindex="2" />
Locked tabindex="2" />
Title
Move thread
Delete thread