diff --git a/phpBB/common.php b/phpBB/common.php index 82b0a4cc99..5fb5d4cd00 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -125,6 +125,7 @@ define('STYLES_TPL_TABLE', $table_prefix.'styles_template'); define('STYLES_CSS_TABLE', $table_prefix.'styles_theme'); define('STYLES_IMAGE_TABLE', $table_prefix.'styles_imageset'); define('TOPICS_TABLE', $table_prefix.'topics'); +define('TOPICS_PREFETCH_TABLE', $table_prefix.'topics_prefetch'); define('TOPICS_RATINGS_TABLE', $table_prefix.'topics_rating'); define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch'); define('USER_GROUP_TABLE', $table_prefix.'user_group'); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 04993251c1..28832bca24 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -94,7 +94,7 @@ function get_moderators(&$forum_moderators, $forum_id = false) { global $SID, $db, $acl_options, $phpEx; - if (is_array($forum_id)) + if (is_array($forum_id) && !empty($forum_id)) { $forum_sql = 'AND a.forum_id IN (' . implode(', ', $forum_id) . ')'; } diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index df325baecf..2a86e237a6 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -19,18 +19,19 @@ * ***************************************************************************/ -function display_forums($root_data, $display_moderators=TRUE) +function display_forums($root_data=array(), $display_moderators=TRUE) { global $db, $template, $auth, $user, $phpEx, $SID; global $total_posts; - $where_sql = ($root_data['left_id'] && $root_data['right_id']) ? ' WHERE left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id'] : ''; + $where_sql = ($root_data['forum_id']) ? ' WHERE left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id'] : ''; - $sql = 'SELECT * FROM ' . FORUMS_TABLE . $where_sql . ' ORDER BY left_id ASC'; + $sql = 'SELECT * FROM ' . FORUMS_TABLE . $where_sql . ' ORDER BY left_id'; $result = $db->sql_query($sql); - $branch_root_id = $total_posts = 0; - $forum_rows = $subforums = $alist = $forum_ids = $forum_moderators = array(); + $total_posts = 0; + $branch_root_id = $root_data['forum_id']; + $forum_rows = $subforums = $forum_ids = $forum_moderators = array(); while ($row = $db->sql_fetchrow($result)) { @@ -91,15 +92,9 @@ function display_forums($root_data, $display_moderators=TRUE) if ($row['display_on_index']) { // Subforum - $subforums[$parent_id][] = $row; + $subforums[$parent_id][$row['forum_id']] = $row['forum_name']; } } - else - { - // what the heck is happening here?? - -// echo '
';print_r($row);echo''; - } } $db->sql_freeresult(); @@ -172,16 +167,17 @@ function display_forums($root_data, $display_moderators=TRUE) if (isset($subforums[$forum_id])) { - foreach ($subforums[$forum_id] as $subrow) + $alist = array(); + foreach ($subforums[$forum_id] as $forum_id => $forum_name) { - $alist[$subrow['forum_id']] = $subrow['forum_name']; + $alist[$forum_id] = $forum_name; } - asort($alist); + natsort($alist); $links = array(); foreach ($alist as $subforum_id => $subforum_name) { - $links[] = '' . htmlspecialchars($subforum_name) . ''; + $links[] = '' . $subforum_name . ''; } $subforums_list = implode(', ', $links); @@ -229,19 +225,5 @@ function display_forums($root_data, $display_moderators=TRUE) 'U_VIEWFORUM' => 'viewforum.' . $phpEx . $SID . '&f=' . $row['forum_id'] )); } - - $template->assign_vars(array( - 'L_FORUM' => $user->lang['Forum'], - 'L_TOPICS' => $user->lang['Topics'], - 'L_REPLIES' => $user->lang['Replies'], - 'L_VIEWS' => $user->lang['Views'], - 'L_POSTS' => $user->lang['Posts'], - 'L_LASTPOST' => $user->lang['Last_Post'], - 'L_MODERATORS' => $user->lang['Moderators'], - 'L_NO_NEW_POSTS' => $user->lang['No_new_posts'], - 'L_NEW_POSTS' => $user->lang['New_posts'], - 'L_NO_NEW_POSTS_LOCKED' => $user->lang['No_new_posts_locked'], - 'L_NEW_POSTS_LOCKED' => $user->lang['New_posts_locked'] - )); } ?> \ No newline at end of file diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index 35cd861a9e..bd2b7b9dc6 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -409,7 +409,7 @@ class Template { } // This will handle the remaining root-level varrefs - $text_blocks = preg_replace('#\{L_([a-z0-9\-_]*?)\}#is', '\' . ((isset($this->_tpldata[\'.\'][0][\'L_\1\'])) ? $this->_tpldata[\'.\'][0][\'L_\1\'] : ((isset($user->lang[\'\1\'])) ? $user->lang[\'\1\'] : \'\')) . \'', $text_blocks); + $text_blocks = preg_replace('#\{L_([a-z0-9\-_]*?)\}#is', '\' . ((isset($this->_tpldata[\'.\'][0][\'L_\1\'])) ? $this->_tpldata[\'.\'][0][\'L_\1\'] : ((isset($user->lang[\'\1\'])) ? $user->lang[\'\1\'] : \'{ \' . ucfirst(strtolower(str_replace(\'_\', \' \', \'\1\'))) . \' }\')) . \'', $text_blocks); $text_blocks = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . ((isset($this->_tpldata[\'.\'][0][\'\1\'])) ? $this->_tpldata[\'.\'][0][\'\1\'] : \'\') . \'', $text_blocks); return; diff --git a/phpBB/index.php b/phpBB/index.php index 737bdaa647..f3342e78ce 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -81,45 +81,8 @@ else $l_total_user_s = $user->lang['Registered_users_total']; } -// Forum moderators ... a static template var could allow us -// to drop these queries ... -//$forum_moderators = array(); -//get_moderators($forum_moderators); - -// Set some vars -$root_id = $branch_root_id = $cat_id; -$forum_rows = $subforums = $nav_forums = array(); - -if ($cat_id == 0) -{ - $is_nav = FALSE; - $total_posts = 0; - switch (SQL_LAYER) - { - case 'oracle': - $sql = 'SELECT f.*, u.username - FROM ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . 'u - WHERE f.forum_last_poster_id = u.user_id(+) - ORDER BY f.left_id'; - break; - - default: - $sql = 'SELECT f.*, u.username - FROM ' . FORUMS_TABLE . ' f - LEFT JOIN ' . USERS_TABLE . ' u ON f.forum_last_poster_id = u.user_id - ORDER BY f.left_id'; - } - - $sql = 'SELECT * FROM ' . FORUMS_TABLE . ' ORDER BY left_id'; -} - - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); -display_forums(array( - 'forum_id' => 0, - 'left_id' => 0, - 'right_id' => 0 -)); +display_forums(array('forum_id' => 0)); if ($total_posts == 0) { @@ -154,23 +117,6 @@ $template->assign_vars(array( 'U_MARK_READ' => "index.$phpEx$SID&mark=forums") ); -foreach ($nav_forums as $row) -{ - if ($row['forum_status'] == ITEM_CATEGORY) - { - $link = 'index.' . $phpEx . $SID . '&c=' . $row['forum_id']; - } - else - { - $link = 'viewforum.' . $phpEx . $SID . '&f=' . $row['forum_id']; - } - - $template->assign_block_vars('navlinks', array( - 'FORUM_NAME' => $row['forum_name'], - 'U_VIEW_FORUM' => $link - )); -} - // Start output of page $page_title = $user->lang['Index']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index b6c0524d95..6750e4d8af 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -139,7 +139,7 @@ $lang = array_merge($lang, array( 'Last_Post' => 'Last Post', 'Moderator' => 'Moderator', 'Moderators' => 'Moderators', - 'View_moderators' => 'List forum moderators', + 'VIEW_MODERATORS' => 'List forum moderators', 'Login_check_pm' => 'Login to check your private messages', 'New_pms' => '%d new messages', 'New_pm' => '%d new message', diff --git a/phpBB/templates/subSilver/index_body.html b/phpBB/templates/subSilver/index_body.html index ba1f612999..d23659bfff 100644 --- a/phpBB/templates/subSilver/index_body.html +++ b/phpBB/templates/subSilver/index_body.html @@ -5,9 +5,6 @@
{TOTAL_POSTS} |
{L_SEARCH_NEW} {L_SEARCH_SELF} {L_SEARCH_UNANSWERED} {LAST_VISIT_DATE} {CURRENT_TIME} |
||||||||
{forumrow.CAT_NAME} | +{forumrow.FORUM_NAME} |