From f28034f3355fc06a1f247ca2383cff2f73442e00 Mon Sep 17 00:00:00 2001 From: Git Date: Fri, 8 Jun 2012 08:00:23 +0000 Subject: [PATCH] Empty commit --- sections/forums/delete.php | 9 +++++++-- sections/forums/sticky_post.php | 25 ++++++++++++++++++++----- sections/torrents/details.php | 3 +-- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/sections/forums/delete.php b/sections/forums/delete.php index 8bbeeb96..610dccd4 100644 --- a/sections/forums/delete.php +++ b/sections/forums/delete.php @@ -14,12 +14,13 @@ TopicID, ForumID, CEIL(COUNT(p.ID)/".POSTS_PER_PAGE.") AS Pages, - CEIL(SUM(IF(p.ID<='$PostID',1,0))/".POSTS_PER_PAGE.") AS Page + CEIL(SUM(IF(p.ID<='$PostID',1,0))/".POSTS_PER_PAGE.") AS Page, + StickyPostID FROM forums_posts AS p JOIN forums_topics AS t ON t.ID=p.TopicID WHERE p.TopicID=(SELECT TopicID FROM forums_posts WHERE ID='$PostID') GROUP BY t.ID"); -list($TopicID, $ForumID, $Pages, $Page) = $DB->next_record(); +list($TopicID, $ForumID, $Pages, $Page, $StickyPostID) = $DB->next_record(); // $Pages = number of pages in the thread // $Page = which page the post is on @@ -66,6 +67,10 @@ $UpdateArrayThread = array('Posts' => '-1'); } +if($StickyPostID == $PostID) { + $DB->query("UPDATE forums_topics SET StickyPostID = 0 WHERE ID = $TopicID"); +} + //We need to clear all subsequential catalogues as they've all been bumped with the absence of this post $ThisCatalogue = floor((POSTS_PER_PAGE*$Page-POSTS_PER_PAGE)/THREAD_CATALOGUE); $LastCatalogue = floor((POSTS_PER_PAGE*$Pages-POSTS_PER_PAGE)/THREAD_CATALOGUE); diff --git a/sections/forums/sticky_post.php b/sections/forums/sticky_post.php index da9d1212..8f4c6c89 100644 --- a/sections/forums/sticky_post.php +++ b/sections/forums/sticky_post.php @@ -13,11 +13,26 @@ error(404); } -if($Delete) { - $DB->query("UPDATE forums_topics SET StickyPostID = 0 WHERE ID = ".$ThreadID); -} else { - $DB->query("UPDATE forums_topics SET StickyPostID = ".$PostID." WHERE ID = ".$ThreadID); +$DB->query("SELECT + CEIL(COUNT(ID)/".POSTS_PER_PAGE.") AS Pages, + CEIL(SUM(IF(ID<=$PostID,1,0))/".POSTS_PER_PAGE.") AS Page + FROM forums_posts + WHERE TopicID=$ThreadID + GROUP BY TopicID"); + +if($DB->record_count()) { + list($Pages,$Page) = $DB->next_record(); + if($Delete) { + $DB->query("UPDATE forums_topics SET StickyPostID = 0 WHERE ID = ".$ThreadID); + } else { + $DB->query("UPDATE forums_topics SET StickyPostID = ".$PostID." WHERE ID = ".$ThreadID); + } + $Cache->delete_value('thread_'.$ThreadID.'_info'); + $ThisCatalogue = floor((POSTS_PER_PAGE*$Page-POSTS_PER_PAGE)/THREAD_CATALOGUE); + $LastCatalogue = floor((POSTS_PER_PAGE*$Pages-POSTS_PER_PAGE)/THREAD_CATALOGUE); + for($i=$ThisCatalogue;$i<=$LastCatalogue;$i++) { + $Cache->delete('thread_'.$ThreadID.'_catalogue_'.$i); + } } -$Cache->delete_value('thread_'.$ThreadID.'_info'); header('Location: forums.php?action=viewthread&threadid='.$ThreadID); diff --git a/sections/torrents/details.php b/sections/torrents/details.php index c8075045..0971c310 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -571,9 +571,8 @@ function filelist($Str) { (View Downloadlist) (View Snatchlist) - (Check Private Flag) - (View Filelist) + (View Filelist) (View Report Information)