From b5053a0b74af3cf6c1107772b5e8258e181b7f46 Mon Sep 17 00:00:00 2001 From: Git Date: Tue, 14 Feb 2012 08:00:22 +0000 Subject: [PATCH] Empty commit --- sections/ajax/forum/index.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sections/ajax/forum/index.php b/sections/ajax/forum/index.php index 515474a1..d16b8649 100644 --- a/sections/ajax/forum/index.php +++ b/sections/ajax/forum/index.php @@ -8,6 +8,18 @@ } else { include(SERVER_ROOT.'/sections/forums/functions.php'); + // Replace the old hard-coded forum categories + unset($ForumCats); + $ForumCats = $Cache->get_value('forums_categories'); + if ($ForumCats === false) { + $DB->query("SELECT ID, Name FROM forums_categories"); + $ForumCats = array(); + while (list($ID, $Name) = $DB->next_record()) { + $ForumCats[$ID] = $Name; + } + $Cache->cache_value('forums_categories', $ForumCats, 0); //Inf cache. + } + //This variable contains all our lovely forum data if(!$Forums = $Cache->get_value('forums_list')) { $DB->query("SELECT @@ -30,11 +42,12 @@ t.IsLocked, t.IsSticky FROM forums AS f + JOIN forums_categories AS fc ON fc.ID = f.CategoryID LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID LEFT JOIN users_main AS um ON um.ID=f.LastPostAuthorID LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID GROUP BY f.ID - ORDER BY f.CategoryID, f.Sort"); + ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort"); $Forums = $DB->to_array('ID', MYSQLI_ASSOC, false); foreach($Forums as $ForumID => $Forum) { if(count($Forum['SpecificRules'])) {