2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
/**********|| Page to show individual threads || ********************************\
|
|
|
|
|
|
|
|
Things to expect in $_GET:
|
|
|
|
ThreadID: ID of the forum curently being browsed
|
2013-02-22 08:00:24 +00:00
|
|
|
page: The page the user's on.
|
2011-03-28 14:21:28 +00:00
|
|
|
page = 1 is the same as no page
|
|
|
|
|
|
|
|
********************************************************************************/
|
|
|
|
|
|
|
|
//---------- Things to sort out before it can start printing/generating content
|
|
|
|
|
2013-05-27 08:00:58 +00:00
|
|
|
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
|
2011-03-28 14:21:28 +00:00
|
|
|
$Text = new TEXT;
|
|
|
|
|
|
|
|
// Check for lame SQL injection attempts
|
|
|
|
$CollageID = $_GET['collageid'];
|
2013-05-04 08:00:48 +00:00
|
|
|
if (!is_number($CollageID)) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(0);
|
|
|
|
}
|
|
|
|
|
2013-05-13 08:00:33 +00:00
|
|
|
// gets the amount of comments for this collage
|
|
|
|
$NumComments = Collages::get_comment_count($CollageID);
|
|
|
|
|
|
|
|
if (isset($_GET['postid']) && is_number($_GET['postid']) && $NumComments > TORRENT_COMMENTS_PER_PAGE) {
|
|
|
|
$DB->query("SELECT COUNT(ID) FROM collages_comments WHERE CollageID = $CollageID AND ID <= $_GET[postid]");
|
|
|
|
list($PostNum) = $DB->next_record();
|
|
|
|
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $PostNum);
|
|
|
|
} else {
|
|
|
|
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $NumComments);
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
|
|
|
|
//Get the cache catalogue
|
2013-05-13 08:00:33 +00:00
|
|
|
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
|
|
|
$CatalogueLimit = $CatalogueID * THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE;
|
2011-03-28 14:21:28 +00:00
|
|
|
|
|
|
|
//---------- Get some data to start processing
|
|
|
|
|
|
|
|
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
|
2013-05-13 08:00:33 +00:00
|
|
|
$Catalogue = Collages::get_comment_catalogue($CollageID, $CatalogueID);
|
2011-03-28 14:21:28 +00:00
|
|
|
|
|
|
|
//This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue
|
2013-05-13 08:00:33 +00:00
|
|
|
$Thread = array_slice($Catalogue, ((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) % THREAD_CATALOGUE), TORRENT_COMMENTS_PER_PAGE, true);
|
2011-03-28 14:21:28 +00:00
|
|
|
|
|
|
|
$DB->query("SELECT Name FROM collages WHERE ID='$CollageID'");
|
|
|
|
list($Name) = $DB->next_record();
|
|
|
|
|
|
|
|
// Start printing
|
2013-01-23 08:00:38 +00:00
|
|
|
View::show_header('Comments for collage '.$Name, 'comments,bbcode,jquery');
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
|
|
|
<div class="thin">
|
2012-08-19 08:00:19 +00:00
|
|
|
<div class="header">
|
|
|
|
<h2>
|
|
|
|
<a href="collages.php">Collages</a> >
|
|
|
|
<a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a>
|
|
|
|
</h2>
|
|
|
|
<div class="linkbox">
|
2011-03-28 14:21:28 +00:00
|
|
|
<?
|
2013-05-13 08:00:33 +00:00
|
|
|
$Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9);
|
2011-03-28 14:21:28 +00:00
|
|
|
echo $Pages;
|
|
|
|
?>
|
2012-08-19 08:00:19 +00:00
|
|
|
</div>
|
2011-03-28 14:21:28 +00:00
|
|
|
</div>
|
|
|
|
<?
|
|
|
|
|
|
|
|
//---------- Begin printing
|
2013-05-04 08:00:48 +00:00
|
|
|
foreach ($Thread as $Post) {
|
2013-05-13 08:00:33 +00:00
|
|
|
list($PostID, $AuthorID, $AddedTime, $Body) = 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-05-04 08:00:48 +00:00
|
|
|
<table class="forum_post box vertical_margin<?=(!Users::has_avatars_enabled() ? ' noavatar' : '')?>" id="post<?=$PostID?>">
|
2012-10-29 08:00:20 +00:00
|
|
|
<colgroup>
|
2013-05-04 08:00:48 +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">
|
2013-05-04 08:00:48 +00:00
|
|
|
<td colspan="<?=(Users::has_avatars_enabled() ? 2 : 1)?>">
|
2013-03-04 08:00:25 +00:00
|
|
|
<span style="float: left;"><a href="#post<?=$PostID?>">#<?=$PostID?></a>
|
|
|
|
<?=Users::format_username($AuthorID, true, true, true, true, true)?> <?=time_diff($AddedTime)?>
|
2013-05-04 08:00:48 +00:00
|
|
|
<? if (!$ThreadInfo['IsLocked']) { ?> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');" class="brackets">Quote</a><? }
|
|
|
|
if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')) { ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>');" class="brackets">Edit</a><? }
|
|
|
|
if (check_perms('site_moderate_forums')) { ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');" class="brackets">Delete</a> <? } ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
</span>
|
2013-03-04 08:00:25 +00:00
|
|
|
<span id="bar<?=$PostID?>" style="float: right;">
|
|
|
|
<a href="reports.php?action=report&type=collages_comment&id=<?=$PostID?>" class="brackets">Report</a>
|
2011-03-28 14:21:28 +00:00
|
|
|
<a href="#">↑</a>
|
|
|
|
</span>
|
|
|
|
</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'])?>
|
2011-03-28 14:21:28 +00:00
|
|
|
</td>
|
2012-11-01 08:00:21 +00:00
|
|
|
<? } ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<td class="body" valign="top">
|
|
|
|
<div id="content<?=$PostID?>">
|
|
|
|
<?=$Text->full_format($Body)?>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2013-02-22 08:00:24 +00:00
|
|
|
<? }
|
2013-05-04 08:00:48 +00:00
|
|
|
if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
|
|
|
|
if ($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) {
|
2013-01-23 08:00:38 +00:00
|
|
|
|
|
|
|
View::parse('generic/reply/quickreply.php', array(
|
|
|
|
'InputName' => 'collageid',
|
|
|
|
'InputID' => $CollageID,
|
|
|
|
'InputAction' => 'add_comment',
|
|
|
|
'TextareaCols' => 90));
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="linkbox">
|
|
|
|
<?=$Pages?>
|
|
|
|
</div>
|
|
|
|
</div>
|
2012-10-11 08:00:15 +00:00
|
|
|
<? View::show_footer(); ?>
|