2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
//TODO: Normalize thread_*_info don't need to waste all that ram on things that are already in other caches
|
|
|
|
/**********|| Page to show individual threads || ********************************\
|
|
|
|
|
|
|
|
Things to expect in $_GET:
|
|
|
|
ThreadID: ID of the forum curently being browsed
|
|
|
|
page: The page the user's on.
|
|
|
|
page = 1 is the same as no page
|
|
|
|
|
|
|
|
********************************************************************************/
|
|
|
|
|
|
|
|
//---------- Things to sort out before it can start printing/generating content
|
|
|
|
|
|
|
|
include(SERVER_ROOT.'/classes/class_text.php');
|
|
|
|
|
2012-10-27 08:00:09 +00:00
|
|
|
$Text = new TEXT(true);
|
2011-03-28 14:21:28 +00:00
|
|
|
|
|
|
|
// Check for lame SQL injection attempts
|
|
|
|
if(!isset($_GET['threadid']) || !is_number($_GET['threadid'])) {
|
2011-10-06 08:00:12 +00:00
|
|
|
if(isset($_GET['topicid']) && is_number($_GET['topicid'])) {
|
2011-03-28 14:21:28 +00:00
|
|
|
$ThreadID = $_GET['topicid'];
|
|
|
|
}
|
2011-10-06 08:00:12 +00:00
|
|
|
elseif(isset($_GET['postid']) && is_number($_GET['postid'])) {
|
|
|
|
$DB->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);
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
} 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
|
2011-05-29 08:00:05 +00:00
|
|
|
if(!check_forumperm($ForumID)) {
|
2011-05-15 12:06:04 +00:00
|
|
|
error(403);
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
|
2012-06-16 08:00:18 +00:00
|
|
|
//Escape strings for later display
|
|
|
|
$ThreadTitle = display_str($ThreadInfo['Title']);
|
|
|
|
$ForumName = display_str($Forums[$ForumID]['Name']);
|
|
|
|
|
2011-03-28 14:21:28 +00:00
|
|
|
//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'];
|
2012-11-09 08:00:18 +00:00
|
|
|
} 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);
|
2011-03-28 14:21:28 +00:00
|
|
|
list($PostNum) = $DB->next_record();
|
|
|
|
} else {
|
|
|
|
$PostNum = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$PostNum = 1;
|
|
|
|
}
|
2012-10-11 08:00:15 +00:00
|
|
|
list($Page,$Limit) = Format::page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum));
|
2012-08-27 08:00:24 +00:00
|
|
|
if(($Page-1)*$PerPage > $ThreadInfo['Posts']) {
|
2012-07-17 08:00:18 +00:00
|
|
|
$Page = ceil($ThreadInfo['Posts']/$PerPage);
|
|
|
|
}
|
2012-10-11 08:00:15 +00:00
|
|
|
list($CatalogueID,$CatalogueLimit) = Format::catalogue_limit($Page,$PerPage,THREAD_CATALOGUE);
|
2011-03-28 14:21:28 +00:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
}
|
|
|
|
}
|
2012-10-11 08:00:15 +00:00
|
|
|
$Thread = Format::catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE);
|
2013-04-13 08:00:19 +00:00
|
|
|
if ($_GET['updatelastread'] != '0') {
|
2012-02-09 08:00:20 +00:00
|
|
|
$LastPost = end($Thread);
|
|
|
|
$LastPost = $LastPost['ID'];
|
|
|
|
reset($Thread);
|
2012-07-17 08:00:18 +00:00
|
|
|
if($ThreadInfo['Posts'] <= $PerPage*$Page && $ThreadInfo['StickyPostID'] > $LastPost) {
|
|
|
|
$LastPost = $ThreadInfo['StickyPostID'];
|
|
|
|
}
|
2012-02-09 08:00:20 +00:00
|
|
|
|
|
|
|
//Handle last read
|
2012-04-02 08:00:21 +00:00
|
|
|
|
|
|
|
|
2012-02-09 08:00:20 +00:00
|
|
|
if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
|
2012-04-02 08:00:21 +00:00
|
|
|
|
2012-02-09 08:00:20 +00:00
|
|
|
$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'");
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Handle subscriptions
|
2013-04-13 08:00:19 +00:00
|
|
|
if (($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
|
2011-03-28 14:21:28 +00:00
|
|
|
$DB->query("SELECT TopicID FROM users_subscriptions WHERE UserID = '$LoggedUser[ID]'");
|
|
|
|
$UserSubscriptions = $DB->collect(0);
|
|
|
|
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'],$UserSubscriptions,0);
|
|
|
|
}
|
|
|
|
|
2013-04-13 08:00:19 +00:00
|
|
|
if (empty($UserSubscriptions)) {
|
2011-03-28 14:21:28 +00:00
|
|
|
$UserSubscriptions = array();
|
|
|
|
}
|
|
|
|
|
2013-04-13 08:00:19 +00:00
|
|
|
if (in_array($ThreadID, $UserSubscriptions)) {
|
2011-03-28 14:21:28 +00:00
|
|
|
$Cache->delete_value('subscriptions_user_new_'.$LoggedUser['ID']);
|
|
|
|
}
|
|
|
|
|
2012-10-30 08:00:18 +00:00
|
|
|
|
2013-03-21 08:00:33 +00:00
|
|
|
$DB->query("UPDATE users_notify_quoted SET UnRead = false WHERE UserID = '$LoggedUser[ID]' AND Page = 'forums' AND PageID = '$ThreadID'");
|
|
|
|
$Cache->delete_value('notify_quoted_' . $LoggedUser['ID']);
|
2013-01-16 08:00:31 +00:00
|
|
|
/*
|
2013-03-21 08:00:33 +00:00
|
|
|
$QuoteNotificationsCount = $Cache->get_value('notify_quoted_' . $LoggedUser['ID']);
|
2012-12-03 08:00:16 +00:00
|
|
|
if ($QuoteNotificationsCount > 0) {
|
2013-03-21 08:00:33 +00:00
|
|
|
$Cache->cache_value('notify_quoted_' . $LoggedUser['ID'], $QuoteNotificationsCount - 1, 0);
|
2012-12-03 08:00:16 +00:00
|
|
|
} else {
|
2013-03-21 08:00:33 +00:00
|
|
|
$Cache->delete_value('notify_quoted_' . $LoggedUser['ID']);
|
2012-10-30 08:00:18 +00:00
|
|
|
}
|
2013-01-16 08:00:31 +00:00
|
|
|
*/
|
2012-10-30 08:00:18 +00:00
|
|
|
|
2013-01-20 08:00:39 +00:00
|
|
|
// Start printing
|
2012-10-27 08:00:09 +00:00
|
|
|
View::show_header($ThreadInfo['Title'] . ' < '.$Forums[$ForumID]['Name'].' < '. 'Forums','comments,subscriptions,bbcode,jquery');
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
|
|
|
<div class="thin">
|
|
|
|
<h2>
|
|
|
|
<a href="forums.php">Forums</a> >
|
2012-06-16 08:00:18 +00:00
|
|
|
<a href="forums.php?action=viewforum&forumid=<?=$ThreadInfo['ForumID']?>"><?=$ForumName?></a> >
|
|
|
|
<?=$ThreadTitle?>
|
2011-03-28 14:21:28 +00:00
|
|
|
</h2>
|
|
|
|
<div class="linkbox">
|
|
|
|
<div class="center">
|
2013-03-02 08:00:34 +00:00
|
|
|
<a href="reports.php?action=report&type=thread&id=<?=$ThreadID?>" class="brackets">Report thread</a>
|
2013-01-24 08:00:24 +00:00
|
|
|
<a href="#" onclick="Subscribe(<?=$ThreadID?>);return false;" id="subscribelink<?=$ThreadID?>" class="brackets"><?=(in_array($ThreadID, $UserSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
|
2013-03-02 08:00:34 +00:00
|
|
|
<a href="#" onclick="$('#searchthread').toggle(); this.innerHTML = (this.innerHTML == 'Search this thread'?'Hide search':'Search this thread'); return false;" class="brackets">Search this thread</a>
|
2011-10-27 08:00:15 +00:00
|
|
|
</div>
|
|
|
|
<div id="searchthread" class="hidden center">
|
|
|
|
<div style="display: inline-block;">
|
|
|
|
<h3>Search this thread:</h3>
|
2012-09-15 08:00:25 +00:00
|
|
|
<form class="search_form" name="forum_thread" action="forums.php" method="get">
|
2013-02-10 08:00:29 +00:00
|
|
|
<table cellpadding="6" cellspacing="1" border="0" class="layout border">
|
2011-10-27 08:00:15 +00:00
|
|
|
<tr>
|
2013-01-16 08:00:31 +00:00
|
|
|
<td><strong>Search for:</strong></td>
|
|
|
|
<td><input type="text" id="searchbox" name="search" size="70" /></td>
|
2011-10-27 08:00:15 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2013-01-16 08:00:31 +00:00
|
|
|
<td><strong>Username:</strong></td>
|
|
|
|
<td><input type="text" id="username" name="user" size="70" /></td>
|
2011-10-27 08:00:15 +00:00
|
|
|
</tr>
|
2012-09-09 08:00:26 +00:00
|
|
|
<tr>
|
|
|
|
<td colspan="2" style="text-align: center">
|
|
|
|
<input type="hidden" name="action" value="search" />
|
|
|
|
<input type="hidden" name="threadid" value="<?=$ThreadID?>" />
|
|
|
|
<input type="submit" name="submit" value="Search" />
|
|
|
|
</td>
|
|
|
|
</tr>
|
2011-10-27 08:00:15 +00:00
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
<br />
|
|
|
|
</div>
|
2011-03-28 14:21:28 +00:00
|
|
|
</div>
|
|
|
|
<?
|
2012-10-11 08:00:15 +00:00
|
|
|
$Pages=Format::get_pages($Page,$ThreadInfo['Posts'],$PerPage,9);
|
2011-03-28 14:21:28 +00:00
|
|
|
echo $Pages;
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<?
|
|
|
|
if ($ThreadInfo['NoPoll'] == 0) {
|
|
|
|
if (!list($Question,$Answers,$Votes,$Featured,$Closed) = $Cache->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);
|
2012-10-27 08:00:09 +00:00
|
|
|
|
2011-03-28 14:21:28 +00:00
|
|
|
$Votes = array();
|
|
|
|
foreach ($VoteArray as $VoteSet) {
|
2012-10-27 08:00:09 +00:00
|
|
|
list($Key,$Value) = $VoteSet;
|
2011-03-28 14:21:28 +00:00
|
|
|
$Votes[$Key] = $Value;
|
|
|
|
}
|
2012-10-27 08:00:09 +00:00
|
|
|
|
2011-03-28 14:21:28 +00:00
|
|
|
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);
|
|
|
|
}
|
2012-10-27 08:00:09 +00:00
|
|
|
|
2011-03-28 14:21:28 +00:00
|
|
|
if (!empty($Votes)) {
|
|
|
|
$TotalVotes = array_sum($Votes);
|
|
|
|
$MaxVotes = max($Votes);
|
|
|
|
} else {
|
|
|
|
$TotalVotes = 0;
|
|
|
|
$MaxVotes = 0;
|
|
|
|
}
|
2012-10-27 08:00:09 +00:00
|
|
|
|
2011-05-13 08:00:07 +00:00
|
|
|
$RevealVoters = in_array($ForumID, $ForumsRevealVoters);
|
2011-03-28 14:21:28 +00:00
|
|
|
//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 {
|
2011-05-13 08:00:07 +00:00
|
|
|
if(!empty($UserResponse) && $RevealVoters) {
|
2011-03-28 14:21:28 +00:00
|
|
|
$Answers[$UserResponse] = '» '.$Answers[$UserResponse];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
<div class="box thin clear">
|
2013-03-02 08:00:34 +00:00
|
|
|
<div class="head colhead_dark"><strong>Poll<? if ($Closed) { echo ' [Closed]'; } ?><? if ($Featured && $Featured !== '0000-00-00 00:00:00') { echo ' [Featured]'; } ?></strong> <a href="#" onclick="$('#threadpoll').toggle();log_hit();return false;" class="brackets">View</a></div>
|
2011-03-28 14:21:28 +00:00
|
|
|
<div class="pad<? if (/*$LastRead !== null || */$ThreadInfo['IsLocked']) { echo ' hidden'; } ?>" id="threadpoll">
|
|
|
|
<p><strong><?=display_str($Question)?></strong></p>
|
2012-02-16 08:00:22 +00:00
|
|
|
<? if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || !check_forumperm($ForumID)) { ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<ul class="poll nobullet">
|
2012-10-27 08:00:09 +00:00
|
|
|
<?
|
2013-04-30 18:18:07 +00:00
|
|
|
if (!$RevealVoters) {
|
|
|
|
foreach ($Answers as $i => $Answer) {
|
2011-03-28 14:21:28 +00:00
|
|
|
if (!empty($Votes[$i]) && $TotalVotes > 0) {
|
2013-04-30 18:18:07 +00:00
|
|
|
$Ratio = $Votes[$i] / $MaxVotes;
|
|
|
|
$Percent = $Votes[$i] / $TotalVotes;
|
2011-03-28 14:21:28 +00:00
|
|
|
} else {
|
2013-04-30 18:18:07 +00:00
|
|
|
$Ratio = 0;
|
|
|
|
$Percent = 0;
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
?>
|
2013-04-30 18:18:07 +00:00
|
|
|
<li><?=display_str($Answer)?> (<?=number_format($Percent * 100,2)?>%)</li>
|
2011-03-28 14:21:28 +00:00
|
|
|
<li class="graph">
|
|
|
|
<span class="left_poll"></span>
|
2013-04-30 18:18:07 +00:00
|
|
|
<span class="center_poll" style="width: <?=round($Ratio * 750)?>px;"></span>
|
2011-03-28 14:21:28 +00:00
|
|
|
<span class="right_poll"></span>
|
|
|
|
</li>
|
|
|
|
<? }
|
|
|
|
if ($Votes[0] > 0) {
|
|
|
|
?>
|
2013-04-30 18:18:07 +00:00
|
|
|
<li>(Blank) (<?=number_format((float)($Votes[0] / $TotalVotes * 100),2)?>%)</li>
|
2011-03-28 14:21:28 +00:00
|
|
|
<li class="graph">
|
|
|
|
<span class="left_poll"></span>
|
2013-04-30 18:18:07 +00:00
|
|
|
<span class="center_poll" style="width: <?=round(($Votes[0] / $MaxVotes) * 750)?>px;"></span>
|
2011-03-28 14:21:28 +00:00
|
|
|
<span class="right_poll"></span>
|
|
|
|
</li>
|
|
|
|
<? } ?>
|
|
|
|
</ul>
|
|
|
|
<br />
|
|
|
|
<strong>Votes:</strong> <?=number_format($TotalVotes)?><br /><br />
|
|
|
|
<?
|
|
|
|
} else {
|
|
|
|
//Staff forum, output voters, not percentages
|
|
|
|
include(SERVER_ROOT.'/sections/staff/functions.php');
|
|
|
|
$Staff = get_staff();
|
|
|
|
|
|
|
|
$StaffNames = array();
|
|
|
|
foreach($Staff as $Staffer) {
|
|
|
|
$StaffNames[] = $Staffer['Username'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$DB->query("SELECT fpv.Vote AS Vote,
|
|
|
|
GROUP_CONCAT(um.Username SEPARATOR ', ')
|
2012-10-27 08:00:09 +00:00
|
|
|
FROM users_main AS um
|
2011-03-28 14:21:28 +00:00
|
|
|
LEFT JOIN forums_polls_votes AS fpv ON um.ID = fpv.UserID
|
|
|
|
WHERE TopicID = ".$ThreadID."
|
|
|
|
GROUP BY fpv.Vote");
|
2012-10-27 08:00:09 +00:00
|
|
|
|
2011-03-28 14:21:28 +00:00
|
|
|
$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);
|
|
|
|
}
|
|
|
|
?> <ul style="list-style: none;" id="poll_options">
|
|
|
|
<?
|
|
|
|
|
|
|
|
foreach($Answers as $i => $Answer) {
|
|
|
|
?>
|
2011-07-13 08:00:06 +00:00
|
|
|
<li>
|
2013-04-30 18:18:07 +00:00
|
|
|
<a href="forums.php?action=change_vote&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=<?=(int) $i?>"><?=display_str($Answer == '' ? 'Blank' : $Answer)?></a>
|
|
|
|
- <?=$StaffVotes[$i]?> (<?=number_format(((float) $Votes[$i] / $TotalVotes) * 100, 2)?>%)
|
2013-02-09 08:01:01 +00:00
|
|
|
<a href="forums.php?action=delete_poll_option&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=<?=(int) $i?>" class="brackets">X</a>
|
2011-07-13 08:00:06 +00:00
|
|
|
</li>
|
2011-03-28 14:21:28 +00:00
|
|
|
<? } ?>
|
2013-04-30 18:18:07 +00:00
|
|
|
<li><a href="forums.php?action=change_vote&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=0">Blank</a> - <?=$StaffVotes[0]?> (<?=number_format(((float) $Votes[0] / $TotalVotes) * 100, 2)?>%)</li>
|
2011-03-28 14:21:28 +00:00
|
|
|
</ul>
|
2011-05-13 08:00:07 +00:00
|
|
|
<?
|
2013-04-30 18:18:07 +00:00
|
|
|
if ($ForumID == STAFF_FORUM) {
|
2011-05-13 08:00:07 +00:00
|
|
|
?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<br />
|
|
|
|
<strong>Votes:</strong> <?=number_format($TotalVotes)?> / <?=$StaffCount ?>
|
|
|
|
<br />
|
2013-04-30 18:18:07 +00:00
|
|
|
<strong>Missing votes:</strong> <?=implode(", ", $StaffNames)?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<br /><br />
|
2011-05-13 08:00:07 +00:00
|
|
|
<?
|
|
|
|
}
|
|
|
|
?>
|
2013-02-09 08:01:01 +00:00
|
|
|
<a href="#" onclick="AddPollOption(<?=$ThreadID?>); return false;" class="brackets">+</a>
|
2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
}
|
|
|
|
|
2012-10-27 08:00:09 +00:00
|
|
|
} else {
|
2011-03-28 14:21:28 +00:00
|
|
|
//User has not voted
|
|
|
|
?>
|
2012-09-15 08:00:25 +00:00
|
|
|
<div id="poll_container">
|
2013-01-15 08:00:37 +00:00
|
|
|
<form class="vote_form" name="poll" id="poll" action="">
|
2012-09-18 08:00:29 +00:00
|
|
|
<input type="hidden" name="action" value="poll" />
|
2011-03-28 14:21:28 +00:00
|
|
|
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
2012-09-18 08:00:29 +00:00
|
|
|
<input type="hidden" name="large" value="1" />
|
2011-03-28 14:21:28 +00:00
|
|
|
<input type="hidden" name="topicid" value="<?=$ThreadID?>" />
|
|
|
|
<ul style="list-style: none;" id="poll_options">
|
2012-10-29 08:00:20 +00:00
|
|
|
<? foreach($Answers as $i => $Answer) { //for ($i = 1, $il = count($Answers); $i <= $il; $i++) { ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<li>
|
|
|
|
<input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" />
|
|
|
|
<label for="answer_<?=$i?>"><?=display_str($Answer)?></label>
|
|
|
|
</li>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? } ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<li>
|
|
|
|
<br />
|
2013-04-30 18:18:07 +00:00
|
|
|
<input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank — Show the results!</label><br />
|
2011-03-28 14:21:28 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? if($ForumID == STAFF_FORUM) { ?>
|
2013-02-09 08:01:01 +00:00
|
|
|
<a href="#" onclick="AddPollOption(<?=$ThreadID?>); return false;" class="brackets">+</a>
|
2011-03-28 14:21:28 +00:00
|
|
|
<br />
|
|
|
|
<br />
|
2012-10-29 08:00:20 +00:00
|
|
|
<? } ?>
|
2012-09-18 08:00:29 +00:00
|
|
|
<input type="button" style="float: left;" onclick="ajax.post('index.php','poll',function(response){$('#poll_container').raw().innerHTML = response});" value="Vote" />
|
2011-03-28 14:21:28 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? } ?>
|
|
|
|
<? if(check_perms('forums_polls_moderate') && !$RevealVoters) {
|
|
|
|
if (!$Featured || $Featured == '0000-00-00 00:00:00') {
|
|
|
|
?>
|
2012-09-15 08:00:25 +00:00
|
|
|
<form class="manage_form" name="poll" action="forums.php" method="post">
|
2012-09-18 08:00:29 +00:00
|
|
|
<input type="hidden" name="action" value="poll_mod" />
|
2011-03-28 14:21:28 +00:00
|
|
|
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
|
|
|
<input type="hidden" name="topicid" value="<?=$ThreadID?>" />
|
2012-09-18 08:00:29 +00:00
|
|
|
<input type="hidden" name="feature" value="1" />
|
|
|
|
<input type="submit" style="float: left;" onclick="return confirm('Are you sure you want to feature this poll?');" value="Feature" />
|
2011-03-28 14:21:28 +00:00
|
|
|
</form>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? } ?>
|
2012-09-15 08:00:25 +00:00
|
|
|
<form class="manage_form" name="poll" action="forums.php" method="post">
|
2012-09-18 08:00:29 +00:00
|
|
|
<input type="hidden" name="action" value="poll_mod" />
|
2011-03-28 14:21:28 +00:00
|
|
|
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
|
|
|
<input type="hidden" name="topicid" value="<?=$ThreadID?>" />
|
2012-09-18 08:00:29 +00:00
|
|
|
<input type="hidden" name="close" value="1" />
|
|
|
|
<input type="submit" style="float: left;" value="<?=(!$Closed ? 'Close' : 'Open')?>" />
|
2011-03-28 14:21:28 +00:00
|
|
|
</form>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? } ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2012-10-27 08:00:09 +00:00
|
|
|
<?
|
2011-03-28 14:21:28 +00:00
|
|
|
} //End Polls
|
|
|
|
|
|
|
|
//Sqeeze in stickypost
|
|
|
|
if($ThreadInfo['StickyPostID']) {
|
|
|
|
if($ThreadInfo['StickyPostID'] != $Thread[0]['ID']) {
|
|
|
|
array_unshift($Thread, $ThreadInfo['StickyPost']);
|
|
|
|
}
|
|
|
|
if($ThreadInfo['StickyPostID'] != $Thread[count($Thread)-1]['ID']) {
|
|
|
|
$Thread[] = $ThreadInfo['StickyPost'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-29 08:00:20 +00:00
|
|
|
foreach ($Thread as $Key => $Post) {
|
2011-03-28 14:21:28 +00:00
|
|
|
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
|
2012-10-11 08:00:15 +00:00
|
|
|
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
2013-03-30 08:00:31 +00:00
|
|
|
<table class="forum_post wrap_overflow box vertical_margin<?
|
2012-10-29 08:00:20 +00:00
|
|
|
if (((!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) && $PostID>$LastRead && strtotime($AddedTime)>$LoggedUser['CatchupTime']) || (isset($RequestKey) && $Key==$RequestKey)) {
|
|
|
|
echo ' forum_unread';
|
|
|
|
}
|
2012-11-01 08:00:21 +00:00
|
|
|
if (!Users::has_avatars_enabled()) {
|
2012-10-29 08:00:20 +00:00
|
|
|
echo ' noavatar';
|
|
|
|
}
|
|
|
|
if ($ThreadInfo['OP'] == $AuthorID) {
|
|
|
|
echo ' important_user';
|
2012-11-09 08:00:18 +00:00
|
|
|
}
|
|
|
|
if ($PostID == $ThreadInfo['StickyPostID']) {
|
|
|
|
echo ' sticky_post';
|
2012-10-29 08:00:20 +00:00
|
|
|
} ?>" id="post<?=$PostID?>">
|
|
|
|
<colgroup>
|
2012-11-01 08:00:21 +00:00
|
|
|
<? if (Users::has_avatars_enabled()) { ?>
|
2012-10-29 08:00:20 +00:00
|
|
|
<col class="col_avatar" />
|
|
|
|
<? } ?>
|
|
|
|
<col class="col_post_body" />
|
|
|
|
</colgroup>
|
2011-03-28 14:21:28 +00:00
|
|
|
<tr class="colhead_dark">
|
2012-11-01 08:00:21 +00:00
|
|
|
<td colspan="<?=Users::has_avatars_enabled() ? 2 : 1?>">
|
2012-10-11 08:00:15 +00:00
|
|
|
<div style="float:left;"><a class="post_id" href="forums.php?action=viewthread&threadid=<?=$ThreadID?>&postid=<?=$PostID?>#post<?=$PostID?>">#<?=$PostID?></a>
|
|
|
|
<?=Users::format_username($AuthorID, true, true, true, true, true)?>
|
2013-01-16 08:00:31 +00:00
|
|
|
<?=time_diff($AddedTime,2)?>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) { ?>
|
2013-02-09 08:01:01 +00:00
|
|
|
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>', true);" class="brackets">Quote</a>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? }
|
|
|
|
if ((!$ThreadInfo['IsLocked'] && check_forumperm($ForumID, 'Write') && $AuthorID == $LoggedUser['ID']) || check_perms('site_moderate_forums')) { ?>
|
2013-02-09 08:01:01 +00:00
|
|
|
- <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');" class="brackets">Edit</a>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? }
|
2013-01-16 08:00:31 +00:00
|
|
|
if(check_perms('site_admin_forums') && $ThreadInfo['Posts'] > 1) { ?>
|
2013-02-09 08:01:01 +00:00
|
|
|
- <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');" class="brackets">Delete</a>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? }
|
|
|
|
if($PostID == $ThreadInfo['StickyPostID']) { ?>
|
2013-02-09 08:01:01 +00:00
|
|
|
<strong><span class="sticky_post_label" class="brackets">Sticky</span></strong>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? if(check_perms('site_moderate_forums')) { ?>
|
2013-02-09 08:01:01 +00:00
|
|
|
- <a href="forums.php?action=sticky_post&threadid=<?=$ThreadID?>&postid=<?=$PostID?>&remove=true&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">X</a>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? }
|
|
|
|
} else {
|
|
|
|
if(check_perms('site_moderate_forums')) { ?>
|
2013-02-09 08:01:01 +00:00
|
|
|
- <a href="forums.php?action=sticky_post&threadid=<?=$ThreadID?>&postid=<?=$PostID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">⇕</a>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? }
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
2012-10-06 08:00:19 +00:00
|
|
|
</div>
|
|
|
|
<div id="bar<?=$PostID?>" style="float:right;">
|
2013-02-09 08:01:01 +00:00
|
|
|
<a href="reports.php?action=report&type=post&id=<?=$PostID?>" class="brackets">Report</a>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? if (check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
|
|
|
|
$AuthorInfo = Users::user_info($AuthorID);
|
|
|
|
if($LoggedUser['Class'] >= $AuthorInfo['Class']) {
|
|
|
|
?>
|
|
|
|
<form class="manage_form hidden" name="user" id="warn<?=$PostID?>" action="" method="post">
|
|
|
|
<input type="hidden" name="action" value="warn" />
|
|
|
|
<input type="hidden" name="postid" value="<?=$PostID?>" />
|
|
|
|
<input type="hidden" name="userid" value="<?=$AuthorID?>" />
|
|
|
|
<input type="hidden" name="key" value="<?=$Key?>" />
|
|
|
|
</form>
|
2013-02-09 08:01:01 +00:00
|
|
|
- <a href="#" onclick="$('#warn<?=$PostID?>').raw().submit(); return false;" class="brackets">Warn</a>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? }
|
|
|
|
}
|
2012-08-27 08:00:24 +00:00
|
|
|
?>
|
2012-10-29 08:00:20 +00:00
|
|
|
|
2011-03-28 14:21:28 +00:00
|
|
|
<a href="#">↑</a>
|
2012-10-06 08:00:19 +00:00
|
|
|
</div>
|
2011-03-28 14:21:28 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2012-11-01 08:00:21 +00:00
|
|
|
<? if (Users::has_avatars_enabled()) { ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<td class="avatar" valign="top">
|
2012-11-01 08:00:21 +00:00
|
|
|
<?=Users::show_avatar($Avatar, $Username, $HeavyInfo['DisableAvatars'])?>
|
2012-10-29 08:00:20 +00:00
|
|
|
</td>
|
|
|
|
<? } ?>
|
2012-11-01 08:00:21 +00:00
|
|
|
<td class="body" valign="top"<? if(!Users::has_avatars_enabled()) { echo ' colspan="2"'; } ?>>
|
2011-03-28 14:21:28 +00:00
|
|
|
<div id="content<?=$PostID?>">
|
|
|
|
<?=$Text->full_format($Body) ?>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? if ($EditedUserID) { ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<br />
|
|
|
|
<br />
|
2012-10-29 08:00:20 +00:00
|
|
|
<? if(check_perms('site_admin_forums')) { ?>
|
2012-10-27 08:00:09 +00:00
|
|
|
<a href="#content<?=$PostID?>" onclick="LoadEdit('forums', <?=$PostID?>, 1); return false;">«</a>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? } ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
Last edited by
|
2012-10-11 08:00:15 +00:00
|
|
|
<?=Users::format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime,2,true,true)?>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? } ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? } ?>
|
2011-12-13 08:00:17 +00:00
|
|
|
<div class="breadcrumbs">
|
|
|
|
<a href="forums.php">Forums</a> >
|
2012-06-16 08:00:18 +00:00
|
|
|
<a href="forums.php?action=viewforum&forumid=<?=$ThreadInfo['ForumID']?>"><?=$ForumName?></a> >
|
|
|
|
<?=$ThreadTitle?>
|
2011-12-13 08:00:17 +00:00
|
|
|
</div>
|
2011-03-28 14:21:28 +00:00
|
|
|
<div class="linkbox">
|
|
|
|
<?=$Pages?>
|
|
|
|
</div>
|
|
|
|
<?
|
2012-10-29 08:00:20 +00:00
|
|
|
if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
|
2011-10-11 08:00:15 +00:00
|
|
|
if(check_forumperm($ForumID, 'Write') && !$LoggedUser['DisablePosting']) {
|
2013-01-23 08:00:38 +00:00
|
|
|
View::parse('generic/reply/quickreply.php', array(
|
|
|
|
'InputTitle' => 'Post reply',
|
|
|
|
'InputName' => 'thread',
|
|
|
|
'InputID' => $ThreadID,
|
|
|
|
'ForumID' => $ForumID,
|
|
|
|
'TextareaCols' => 90
|
|
|
|
));
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(check_perms('site_moderate_forums')) {
|
|
|
|
?>
|
|
|
|
<br />
|
|
|
|
<h3>Edit thread</h3>
|
2012-09-15 08:00:25 +00:00
|
|
|
<form class="edit_form" name="forum_thread" action="forums.php" method="post">
|
2011-03-28 14:21:28 +00:00
|
|
|
<div>
|
|
|
|
<input type="hidden" name="action" value="mod_thread" />
|
|
|
|
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
|
|
|
<input type="hidden" name="threadid" value="<?=$ThreadID?>" />
|
|
|
|
<input type="hidden" name="page" value="<?=$Page?>" />
|
|
|
|
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
|
|
|
</div>
|
2012-09-01 08:00:24 +00:00
|
|
|
<table cellpadding="6" cellspacing="1" border="0" width="100%" class="layout border">
|
2011-03-28 14:21:28 +00:00
|
|
|
<tr>
|
|
|
|
<td class="label">Sticky</td>
|
|
|
|
<td>
|
2013-04-30 18:18:07 +00:00
|
|
|
<input type="checkbox" name="sticky"<? if ($ThreadInfo['IsSticky']) { echo ' checked="checked"'; } ?> tabindex="2" />
|
2011-03-28 14:21:28 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="label">Locked</td>
|
|
|
|
<td>
|
2013-04-30 18:18:07 +00:00
|
|
|
<input type="checkbox" name="locked"<? if ($ThreadInfo['IsLocked']) { echo ' checked="checked"'; } ?> tabindex="2" />
|
2011-03-28 14:21:28 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="label">Title</td>
|
|
|
|
<td>
|
|
|
|
<input type="text" name="title" style="width: 75%;" value="<?=display_str($ThreadInfo['Title'])?>" tabindex="2" />
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="label">Move thread</td>
|
|
|
|
<td>
|
|
|
|
<select name="forumid" tabindex="2">
|
2012-10-27 08:00:09 +00:00
|
|
|
<?
|
2012-10-29 08:00:20 +00:00
|
|
|
$OpenGroup = false;
|
|
|
|
$LastCategoryID = -1;
|
2011-03-28 14:21:28 +00:00
|
|
|
|
2012-10-29 08:00:20 +00:00
|
|
|
foreach ($Forums as $Forum) {
|
|
|
|
if ($Forum['MinClassRead'] > $LoggedUser['Class']) {
|
|
|
|
continue;
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
|
2012-10-29 08:00:20 +00:00
|
|
|
if ($Forum['CategoryID'] != $LastCategoryID) {
|
|
|
|
$LastCategoryID = $Forum['CategoryID'];
|
|
|
|
if($OpenGroup) { ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
</optgroup>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? } ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<optgroup label="<?=$ForumCats[$Forum['CategoryID']]?>">
|
2012-10-29 08:00:20 +00:00
|
|
|
<? $OpenGroup = true;
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
2012-09-09 08:00:26 +00:00
|
|
|
<option value="<?=$Forum['ID']?>"<? if($ThreadInfo['ForumID'] == $Forum['ID']) { echo ' selected="selected"';} ?>><?=display_str($Forum['Name'])?></option>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? } ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
</optgroup>
|
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? if(check_perms('site_admin_forums')) { ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<tr>
|
|
|
|
<td class="label">Delete thread</td>
|
|
|
|
<td>
|
|
|
|
<input type="checkbox" name="delete" tabindex="2" />
|
|
|
|
</td>
|
|
|
|
</tr>
|
2012-10-29 08:00:20 +00:00
|
|
|
<? } ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<tr>
|
|
|
|
<td colspan="2" class="center">
|
|
|
|
<input type="submit" value="Edit thread" tabindex="2" />
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
<?
|
|
|
|
} // If user is moderator
|
|
|
|
?>
|
|
|
|
</div>
|
2012-10-11 08:00:15 +00:00
|
|
|
<? View::show_footer();
|