diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index b324acb4a9..b2e8ead497 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -71,6 +71,8 @@ p,ul,td {font-size:10pt;}
[Fix] Prevent login attempts from incrementing for inactive users
[Fix] Do not check maximum login attempts on re-authentication to the admin panel - tomknight
[Fix] Regenerate session keys on password change
+[Fix] retrieving category rows in index.php (Bug #90)
+[Fix] improved index performance by determining the permissions before iterating through all forums (Bug #91)
[Fix] Better handling of short usernames within the search (bug #105)
[Fix] Workaround for an issue in either PHP or MSSQL resulting in a space being returned instead of an empty string (bug #830)
[Fix] Correct use of default_style config value (Bug #861)
@@ -101,8 +103,6 @@ p,ul,td {font-size:10pt;}
- [Fix] incorrect handling of password resets if admin activation is enabled (Bug #88)
-- [Fix] retrieving category rows in index.php (Bug #90)
-- [Fix] improved index performance by determining the permissions before iterating through all forums (Bug #91)
- [Fix] wrong topic redirection after login redirect (Bug #94)
- [Fix] improved handling of username lists in admin_ug_auth.php (Bug #98)
- [Fix] incorrect removal of bbcode_uid values if bbcode has been turned off (Bug #100)
diff --git a/phpBB/index.php b/phpBB/index.php
index 1a8edd8e66..438ddaab12 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -119,7 +119,10 @@ if( !($result = $db->sql_query($sql)) )
}
$category_rows = array();
-while( $category_rows[] = $db->sql_fetchrow($result) );
+while ($row = $db->sql_fetchrow($result))
+{
+ $category_rows[] = $row;
+}
$db->sql_freeresult($result);
if( ( $total_categories = count($category_rows) ) )
@@ -299,6 +302,19 @@ if( ( $total_categories = count($category_rows) ) )
'U_MARK_READ' => append_sid("index.$phpEx?mark=forums"))
);
+ //
+ // Let's decide which categories we should display
+ //
+ $display_categories = array();
+
+ for ($i = 0; $i < $total_forums; $i++ )
+ {
+ if ($is_auth_ary[$forum_data[$i]['forum_id']]['auth_view'])
+ {
+ $display_categories[$forum_data[$i]['cat_id']] = true;
+ }
+ }
+
//
// Okay, let's build the index
//
@@ -306,23 +322,11 @@ if( ( $total_categories = count($category_rows) ) )
{
$cat_id = $category_rows[$i]['cat_id'];
- //
- // Should we display this category/forum set?
- //
- $display_forums = false;
- for($j = 0; $j < $total_forums; $j++)
- {
- if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'] && $forum_data[$j]['cat_id'] == $cat_id )
- {
- $display_forums = true;
- }
- }
-
//
// Yes, we should, so first dump out the category
// title, then, if appropriate the forum list
//
- if ( $display_forums )
+ if (isset($display_categories[$cat_id]) && $display_categories[$cat_id])
{
$template->assign_block_vars('catrow', array(
'CAT_ID' => $cat_id,