2011-03-28 14:21:28 +00:00
|
|
|
<?
|
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;
|
|
|
|
|
|
|
|
authorize();
|
|
|
|
|
|
|
|
// Quick SQL injection check
|
2013-05-05 08:00:31 +00:00
|
|
|
if (!$_GET['postid'] || !is_number($_GET['postid'])) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(0);
|
|
|
|
}
|
|
|
|
$PostID = $_GET['postid'];
|
|
|
|
|
|
|
|
// Make sure they are moderators
|
2013-05-05 08:00:31 +00:00
|
|
|
if (!check_perms('site_moderate_forums')) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
|
2013-05-13 08:00:33 +00:00
|
|
|
// Get number of pages
|
|
|
|
// $Pages = number of pages in the thread
|
|
|
|
// $Page = which page the post is on
|
2013-07-13 08:00:46 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT
|
|
|
|
CollageID,
|
|
|
|
CEIL(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Pages,
|
|
|
|
CEIL(SUM(IF(ID <= '$PostID', 1, 0)) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page
|
2013-05-13 08:00:33 +00:00
|
|
|
FROM collages_comments
|
2013-07-13 08:00:46 +00:00
|
|
|
WHERE CollageID = (
|
|
|
|
SELECT CollageID
|
|
|
|
FROM collages_comments
|
|
|
|
WHERE ID = '$PostID'
|
|
|
|
)
|
2013-05-13 08:00:33 +00:00
|
|
|
GROUP BY CollageID");
|
|
|
|
list($CollageID, $Pages, $Page) = $DB->next_record();
|
2011-03-28 14:21:28 +00:00
|
|
|
|
2013-07-13 08:00:46 +00:00
|
|
|
$DB->query("
|
|
|
|
DELETE FROM collages_comments
|
|
|
|
WHERE ID = '$PostID'");
|
2011-03-28 14:21:28 +00:00
|
|
|
|
2013-07-13 08:00:46 +00:00
|
|
|
$Cache->delete_value("collage_$CollageID");
|
|
|
|
$Cache->increment_value("collage_comments_$CollageID", -1);
|
2013-05-13 08:00:33 +00:00
|
|
|
|
|
|
|
//We need to clear all subsequential catalogues as they've all been bumped with the absence of this post
|
|
|
|
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
|
|
|
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
|
|
|
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
|
2013-07-13 08:00:46 +00:00
|
|
|
$Cache->delete_value("collage_comments_$CollageID"."_catalogue_$i");
|
2013-05-13 08:00:33 +00:00
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|