diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index fcb073a074..af1a0370fc 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -127,15 +127,23 @@ function generate_forum_nav(&$forum_data) $forum_parents = get_forum_parents($forum_data); // Build navigation links - foreach ($forum_parents as $parent_forum_id => $parent_name) + foreach ($forum_parents as $parent_forum_id => $parent_data) { + list($parent_name, $parent_type) = array_values($parent_data); + $template->assign_block_vars('navlinks', array( + 'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false, 'FORUM_NAME' => $parent_name, 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=$parent_forum_id") ); } $template->assign_block_vars('navlinks', array( + 'S_IS_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, 'FORUM_NAME' => $forum_data['forum_name'], 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=" . $forum_data['forum_id']) ); @@ -159,7 +167,7 @@ function get_forum_parents(&$forum_data) { if ($forum_data['forum_parents'] == '') { - $sql = 'SELECT forum_id, forum_name + $sql = 'SELECT forum_id, forum_name, forum_type FROM ' . FORUMS_TABLE . ' WHERE left_id < ' . $forum_data['left_id'] . ' AND right_id > ' . $forum_data['right_id'] . ' @@ -168,7 +176,7 @@ function get_forum_parents(&$forum_data) while ($row = $db->sql_fetchrow($result)) { - $forum_parents[$row['forum_id']] = $row['forum_name']; + $forum_parents[$row['forum_id']] = array($row['forum_name'], (int) $row['forum_type']); } $db->sql_freeresult($result); @@ -285,15 +293,16 @@ function make_jumpbox($action, $forum_id = false, $select_all = false) return; } - $boxstring = ''; $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id FROM ' . FORUMS_TABLE . ' ORDER BY left_id ASC'; $result = $db->sql_query($sql); - $right = $cat_right = $padding_inc = 0; - $padding = $forum_list = $holding = ''; - $padding_store = array('0' => ''); + $right = $cat_right = $padding = 0; + $padding_store = array('0' => 0); + $display_jumpbox = false; + $iteration = 1; + while ($row = $db->sql_fetchrow($result)) { if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) @@ -307,10 +316,22 @@ function make_jumpbox($action, $forum_id = false, $select_all = false) // if the user does not have permissions to list this forum skip continue; } + + if (!$display_jumpbox) + { + $template->assign_block_vars('jumpbox_forums', array( + 'FORUM_ID' => ($select_all) ? 0 : -1, + 'FORUM_NAME' => ($select_all) ? $user->lang['ALL_FORUMS'] : $user->lang['SELECT_FORUM'], + 'S_FORUM_COUNT' => $iteration) + ); + $iteration++; + $display_jumpbox = true; + } + if ($row['left_id'] < $right) { - $padding .= '   '; + $padding++; $padding_store[$row['parent_id']] = $padding; } else if ($row['left_id'] > $right + 1) @@ -320,35 +341,32 @@ function make_jumpbox($action, $forum_id = false, $select_all = false) $right = $row['right_id']; - $selected = ($row['forum_id'] == $forum_id) ? ' selected="selected"' : ''; - - if ($row['left_id'] > $cat_right) - { - $holding = ''; - } - if ($row['right_id'] - $row['left_id'] > 1) { $cat_right = max($cat_right, $row['right_id']); + } - $holding .= ''; - } - else + $template->assign_block_vars('jumpbox_forums', array( + 'FORUM_ID' => $row['forum_id'], + 'FORUM_NAME' => $row['forum_name'], + 'SELECTED' => ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '', + 'S_FORUM_COUNT' => $iteration, + 'S_IS_CAT' => ($row['forum_type'] == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($row['forum_type'] == FORUM_POST) ? true : false) + ); + + for ($i = 0; $i < $padding; $i++) { - $boxstring .= $holding . ''; - $holding = ''; + $template->assign_block_vars('jumpbox_forums.level', array()); } + $iteration++; } $db->sql_freeresult($result); unset($padding_store); - if ($boxstring) - { - $boxstring = (($select_all) ? '' . $boxstring; - } - $template->assign_vars(array( - 'S_JUMPBOX_OPTIONS' => $boxstring, + 'S_DISPLAY_JUMPBOX' => $display_jumpbox, 'S_JUMPBOX_ACTION' => $action) ); @@ -1131,6 +1149,20 @@ function smilie_text($text, $force_option = false) return ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) ? preg_replace('# + + + +
- + -
{L_JUMP_TO}:  {L_JUMP_TO}:  
- + + + + \ No newline at end of file diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index cef6bd1a7e..9a899e75d5 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -162,7 +162,7 @@ if ($user->data['user_id'] != ANONYMOUS) // whereupon we join on the forum_id passed as a parameter ... this // is done so navigation, forum name, etc. remain consistent with where // user clicked to view a global topic -$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, ' . (($auth->acl_get('m_approve')) ? 't.topic_replies_real AS topic_replies' : 't.topic_replies') . ', t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.topic_bumped, t.topic_bumper, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style, f.forum_password' . $extra_fields . ' +$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, ' . (($auth->acl_get('m_approve')) ? 't.topic_replies_real AS topic_replies' : 't.topic_replies') . ', t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.topic_bumped, t.topic_bumper, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_type, f.forum_id, f.forum_style, f.forum_password' . $extra_fields . ' FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f' . $join_sql_table . " WHERE $join_sql AND (f.forum_id = t.forum_id @@ -448,10 +448,10 @@ $topic_title = censor_text($topic_title); // Send vars to template $template->assign_vars(array( 'FORUM_ID' => $forum_id, - 'FORUM_NAME' => $forum_name, + 'FORUM_NAME' => $forum_name, 'FORUM_DESC' => $forum_desc, - 'TOPIC_ID' => $topic_id, - 'TOPIC_TITLE' => $topic_title, + 'TOPIC_ID' => $topic_id, + 'TOPIC_TITLE' => $topic_title, 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => ($total_posts == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts), @@ -1029,6 +1029,10 @@ if ($bbcode_bitfield) $i_total = sizeof($rowset) - 1; $prev_post_id = ''; +$template->assign_vars(array( + 'S_NUM_POSTS' => count($post_list)) +); + // Output the posts //foreach ($rowset as $i => $row) for ($i = 0; $i < count($post_list); ++$i)