From db8652122c2b0705eed8e4fde76baccbe497319a Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Tue, 31 Jul 2001 18:37:25 +0000 Subject: More compliance updates + select previous posts in viewtopic git-svn-id: file:///svn/phpbb/trunk@770 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 26 +++--- phpBB/language/lang_english.php | 12 ++- phpBB/templates/PSO/index_body.tpl | 8 +- phpBB/templates/PSO/jumpbox.tpl | 11 +-- phpBB/templates/PSO/viewforum_body.tpl | 41 +++++---- phpBB/templates/PSO/viewtopic_body.tpl | 22 ++--- phpBB/viewforum.php | 63 +++++++------- phpBB/viewtopic.php | 146 +++++++++++++++++++++++++-------- 8 files changed, 210 insertions(+), 119 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4e41e1e9fb..ee87251a6d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -120,8 +120,7 @@ function get_userdata($username) { function make_jumpbox() { - global $db; - global $l_jumpto, $l_noforums, $l_nocategories; + global $lang, $db; $sql = "SELECT c.cat_id, c.cat_title, c.cat_order FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f @@ -141,7 +140,7 @@ function make_jumpbox() $limit_forums = ""; $sql = "SELECT * - FROM ".FORUMS_TABLE." + FROM " . FORUMS_TABLE . " ORDER BY cat_id, forum_order"; if(!$q_forums = $db->sql_query($sql)) { @@ -152,11 +151,11 @@ function make_jumpbox() // $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata); - $boxstring = ''; + $boxstring = ''; for($i = 0; $i < $total_categories; $i++) { $boxstring .= "\n"; - $boxstring .= "\n"; + $boxstring .= "\n"; $boxstring .= "\n"; if($total_forums) @@ -165,8 +164,7 @@ function make_jumpbox() { if( $forum_rows[$y]['cat_id'] == $category_rows[$i]['cat_id'] ) { - $name = stripslashes($forum_rows[$y]['forum_name']); - $boxstring .= "\n"; + $boxstring .= "\n"; } } } @@ -191,7 +189,7 @@ function make_forum_box($box_name, $default_forum = -1) $limit_forums = ""; $sql = "SELECT forum_id, forum_name - FROM ".FORUMS_TABLE." + FROM " . FORUMS_TABLE . " ORDER BY cat_id, forum_order"; if(!$q_forums = $db->sql_query($sql)) { @@ -395,7 +393,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add for($i = $this_block_start; $i <= $this_block_end; $i++) { - $page_string .= ($i == $on_page) ? "$i" : "$i"; + $page_string .= ($i == $on_page) ? "$i" : "$i"; if($i < $this_block_end) { $page_string .= ", "; @@ -407,7 +405,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add $page_string_prepend = ""; for($i = 0; $i < $this_block_start; $i += 10) { - $page_string_prepend .= "" . ( ($i == 0) ? ($i + 1) : $i) . " - " . ($i + 9) . ", "; + $page_string_prepend .= "" . ( ($i == 0) ? ($i + 1) : $i) . " - " . ($i + 9) . ", "; } $page_string = $page_string_prepend . $page_string; @@ -419,7 +417,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add if(!($total_pages%10)) { - $page_url = append_sid($base_url."&start=".( ( ($this_block_end + 1) * $per_page ) - $per_page ) ); + $page_url = append_sid($base_url."&start=".( ( ($this_block_end + 1) * $per_page ) - $per_page ) ); $page_string_append .= "$total_pages"; } else @@ -427,7 +425,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add for($i = $this_block_end + 1; $i < $total_pages; $i += 10) { - $page_string_append .= "" . ( ($i == 0) ? ($i + 1) : $i) . " - " . ((($i + 9) < $total_pages) ? ($i + 9) : $total_pages) . ""; + $page_string_append .= "" . ( ($i == 0) ? ($i + 1) : $i) . " - " . ((($i + 9) < $total_pages) ? ($i + 9) : $total_pages) . ""; if($i < $total_pages - 10) { $page_string_append .= ", "; @@ -441,11 +439,11 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add { if($on_page > 1) { - $page_string = " " . $lang['Previous'] . "  " . $page_string; + $page_string = " " . $lang['Previous'] . "  " . $page_string; } if($on_page < $total_pages) { - $page_string .= "  " . $lang['Next'] . ""; + $page_string .= "  " . $lang['Next'] . ""; } $page_string = $lang['Goto_page'] . ": " . $page_string; diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index 5e3c0ebda4..18e5e5a80e 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -59,7 +59,6 @@ $lang['Author'] = "Author"; $lang['is'] = "is"; $lang['are'] = "are"; $lang['by'] = "by"; -$lang['All_Topics'] = "All Topics"; $lang['Time'] = "Time"; $lang['Hour'] = "Hour"; $lang['Hours'] = "Hours"; @@ -113,6 +112,10 @@ $lang['Error'] = "Error"; $lang['IP_Address'] = "IP Address"; +$lang['Jump_to'] = "Jump to"; +$lang['Select_forum'] = "Select a forum"; +$lang['Go'] = "Go"; + // // Global Header strings // @@ -181,7 +184,8 @@ $lang['View_forum'] = "View Forum"; $lang['Forum_not_exist'] = "The forum you selected does not exist, please go back and try again"; $lang['Reached_on_error'] = "You have reached this page in error, please go back and try again"; -$lang['Display_topics'] = "Display Topics from previous"; +$lang['Display_topics'] = "Display topics from previous"; +$lang['All_Topics'] = "All Topics"; $lang['Annoucement'] = "Annoucement:"; $lang['Sticky'] = "Sticky:"; @@ -198,6 +202,10 @@ $lang['View_previous_topic'] = "View previous topic"; $lang['No_newer_topics'] = "There are no newer topics in this forum"; $lang['No_older_topics'] = "There are no older topics in this forum"; $lang['Topic_post_not_exist'] = "The topic or post you requested does not exist"; +$lang['Display_posts'] = "Display posts from previous"; +$lang['All_Posts'] = "All Posts"; +$lang['Newest_First'] = "Newest First"; +$lang['Oldest_First'] = "Oldest First"; $lang['Read_profile'] = "Read profile of"; // Followed by username of poster $lang['Send_email'] = "Send email to "; // Followed by username of poster diff --git a/phpBB/templates/PSO/index_body.tpl b/phpBB/templates/PSO/index_body.tpl index ce82025995..2accb0013b 100644 --- a/phpBB/templates/PSO/index_body.tpl +++ b/phpBB/templates/PSO/index_body.tpl @@ -49,17 +49,19 @@ +
+ diff --git a/phpBB/templates/PSO/jumpbox.tpl b/phpBB/templates/PSO/jumpbox.tpl index 8de4b5e85b..a4885dc371 100644 --- a/phpBB/templates/PSO/jumpbox.tpl +++ b/phpBB/templates/PSO/jumpbox.tpl @@ -1,5 +1,6 @@ -
- + - + - +
{L_NEWPOSTS}{L_NEWPOSTS} {L_NEWPOSTS}   {L_NONEWPOSTS}{L_NONEWPOSTS} {L_NONEWPOSTS}   {L_FORUM_LOCKED}{L_FORUM_LOCKED} {L_FORUM_LOCKED}
- - - -
Jump To:  
\ No newline at end of file + +
+ + + +
{L_JUMP_TO}:  
diff --git a/phpBB/templates/PSO/viewforum_body.tpl b/phpBB/templates/PSO/viewforum_body.tpl index 75a4fb1ec6..3fd29d4ba1 100644 --- a/phpBB/templates/PSO/viewforum_body.tpl +++ b/phpBB/templates/PSO/viewforum_body.tpl @@ -1,8 +1,8 @@ - - - - - +
{SITENAME} {L_INDEX} -> {FORUM_NAME}{L_DISPLAY_TOPICS}: {S_SELECT_POST_DAYS} 
+ + + +
{SITENAME} {L_INDEX} -> {FORUM_NAME}{L_DISPLAY_TOPICS}: {S_SELECT_TOPIC_DAYS} 
@@ -11,8 +11,8 @@ @@ -42,7 +42,7 @@ -
- - + +
{FORUM_NAME}
{L_MODERATOR}: {MODERATORS}
{FORUM_NAME}
{L_MODERATOR}: {MODERATORS}
{L_NEW_TOPIC}
- + @@ -50,28 +50,25 @@
{L_NEW_TOPIC}    {L_PAGE} {ON_PAGE} {L_OF} {TOTAL_PAGES}  {PAGINATION} 
+ - @@ -24,7 +24,7 @@
- - - - + - +
{S_TIMEZONE}
- - - - - + + + + + + + - - +
{L_NEWPOSTS}
{L_NEWPOSTS}{L_NEWPOSTS}  {L_NONEWPOSTS} {L_NONEWPOSTS}  {L_FORUM_LOCKED}{L_TOPIC_IS_LOCKED}
{L_TOPIC_IS_LOCKED}
{S_TIMEZONE}
{JUMPBOX}
{S_AUTH_LIST}
{JUMPBOX}{S_AUTH_LIST}
diff --git a/phpBB/templates/PSO/viewtopic_body.tpl b/phpBB/templates/PSO/viewtopic_body.tpl index 8e3e7cd216..4b185a6f75 100644 --- a/phpBB/templates/PSO/viewtopic_body.tpl +++ b/phpBB/templates/PSO/viewtopic_body.tpl @@ -1,7 +1,7 @@ - +
{SITENAME} {L_INDEX} -> {FORUM_NAME} -> {TOPIC_TITLE} {L_VIEW_PREVIOUS_TOPIC} :: {L_VIEW_NEXT_TOPIC} {L_VIEW_PREVIOUS_TOPIC} :: {L_VIEW_NEXT_TOPIC}
@@ -12,7 +12,7 @@
- +
{TOPIC_TITLE}  L_TOPIC_POST  L_TOPIC_REPLY
- + @@ -34,11 +34,11 @@ @@ -48,7 +48,7 @@
{postrow.POSTER_NAME}
{postrow.POSTER_RANK}
{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}

{postrow.POSTER_JOINED}
{postrow.POSTER_POSTS}
{postrow.POSTER_FROM}


{postrow.POSTER_NAME}
{postrow.POSTER_RANK}
{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}

{postrow.POSTER_JOINED}
{postrow.POSTER_POSTS}
{postrow.POSTER_FROM}


Back to top
- - + + - +
Post image icon{L_POSTED}: {postrow.POST_DATE}    {L_POST_SUBJECT}: {postrow.POST_SUBJECT}  {postrow.EDIT_IMG} {postrow.QUOTE_IMG} Post image icon{L_POSTED}: {postrow.POST_DATE}    {L_POST_SUBJECT}: {postrow.POST_SUBJECT}  {postrow.EDIT_IMG} {postrow.QUOTE_IMG} 


- + @@ -62,7 +62,7 @@


 {postrow.PROFILE_IMG} {postrow.PM_IMG} {postrow.EMAIL_IMG} {postrow.WWW_IMG} {postrow.ICQ_STATUS_IMG} {postrow.ICQ_ADD_IMG} {postrow.AIM_IMG} {postrow.YIM_IMG} {postrow.MSN_IMG} 
- + @@ -72,9 +72,11 @@
  {L_TOPIC_REPLY}  {L_TOPIC_POST}  {L_PAGE} {ON_PAGE} {L_OF} {TOTAL_PAGES}  {PAGINATION}
+
+ - - + +
{S_TIMEZONE}

{S_TOPIC_ADMIN}
{JUMPBOX}
{S_AUTH_LIST}
{L_DISPLAY_POSTS}: {S_SELECT_POST_DAYS} {S_SELECT_POST_ORDER} 
{S_TIMEZONE}

{S_TOPIC_ADMIN}
{JUMPBOX}{S_AUTH_LIST}
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 64e1d6f32f..82a0edf24b 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -140,7 +140,7 @@ if( $total_mods = $db->sql_numrows($result_mods) ) { if($mods_rowset[$i]['group_single_user']) { - $mod_url = "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $mods_rowset[$i]['user_id']; + $mod_url = "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $mods_rowset[$i]['user_id']; $mod_name = $mods_rowset[$i]['username']; } else @@ -166,23 +166,23 @@ else } // -// Generate a 'Show posts in previous x days' select box. If the postdays var is POSTed +// Generate a 'Show topics in previous x days' select box. If the topicsdays var is sent // then get it's value, find the number of topics with dates newer than it (to properly // handle pagination) and alter the main query // $previous_days = array(0, 1, 7, 14, 30, 90, 180, 364); $previous_days_text = array($lang['All_Topics'], "1 " . $lang['Day'], "7 " . $lang['Days'], "2 " . $lang['Weeks'], "1 " . $lang['Month'], "3 ". $lang['Months'], "6 " . $lang['Months'], "1 " . $lang['Year']); -if(!empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays'])) +if(!empty($HTTP_POST_VARS['topicdays']) || !empty($HTTP_GET_VARS['topicdays'])) { - $post_days = (!empty($HTTP_POST_VARS['postdays'])) ? $HTTP_POST_VARS['postdays'] : $HTTP_GET_VARS['postdays']; - $min_post_time = time() - ($post_days * 86400); + $topic_days = (!empty($HTTP_POST_VARS['topicdays'])) ? $HTTP_POST_VARS['topicdays'] : $HTTP_GET_VARS['topicdays']; + $min_topic_time = time() - ($topic_days * 86400); $sql = "SELECT COUNT(t.topic_id) AS forum_topics FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p WHERE t.forum_id = $forum_id AND p.post_id = t.topic_last_post_id - AND ( p.post_time > $min_post_time + AND ( p.post_time >= $min_topic_time OR t.topic_type = " . POST_ANNOUNCE . " )"; if(!$result = $db->sql_query($sql)) @@ -191,9 +191,9 @@ if(!empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays'])) } list($topics_count) = $db->sql_fetchrow($result); - $limit_posts_time = "AND ( p.post_time > $min_post_time OR t.topic_type = " . POST_ANNOUNCE . " ) "; + $limit_topics_time = "AND ( p.post_time >= $min_post_time OR t.topic_type = " . POST_ANNOUNCE . " ) "; - if(!empty($HTTP_POST_VARS['postdays'])) + if(!empty($HTTP_POST_VARS['topicdays'])) { $start = 0; } @@ -202,17 +202,17 @@ else { $topics_count = $forum_row['forum_topics']; - $limit_posts_time = ""; - $post_days = 0; + $limit_topics_time = ""; + $topic_days = 0; } -$select_post_days = ""; for($i = 0; $i < count($previous_days); $i++) { - $selected = ($post_days == $previous_days[$i]) ? " selected" : ""; - $select_post_days .= ""; + $selected = ($topic_days == $previous_days[$i]) ? " selected=\"selected\"" : ""; + $select_topic_days .= ""; } -$select_post_days .= ""; +$select_topic_days .= ""; // // Grab all the basic data (all topics except global announcements) @@ -225,7 +225,7 @@ $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as i AND p.post_id = t.topic_last_post_id AND p.poster_id = u2.user_id AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . " - $limit_posts_time + $limit_topics_time ORDER BY t.topic_type DESC, p.post_time DESC LIMIT $start, ".$board_config['topics_per_page']; @@ -238,15 +238,15 @@ $total_topics = $db->sql_numrows($t_result); // // Post URL generation for templating vars // -$post_new_topic_url = append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id"); +$post_new_topic_url = append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id"); $template->assign_vars(array( "L_DISPLAY_TOPICS" => $lang['Display_topics'], "U_POST_NEW_TOPIC" => $post_new_topic_url, - "S_SELECT_POST_DAYS" => $select_post_days, - "S_POST_DAYS_ACTION" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&start=$start")) + "S_SELECT_TOPIC_DAYS" => $select_topic_days, + "S_POST_DAYS_ACTION" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&start=$start")) ); // @@ -276,6 +276,9 @@ $template->set_filenames(array( $jumpbox = make_jumpbox(); $template->assign_vars(array( + "L_GO" => $lang['Go'], + "L_JUMP_TO" => $lang['Jump_to'], + "L_SELECT_FORUM" => $lang['Select_forum'], "JUMPBOX_LIST" => $jumpbox, "SELECT_NAME" => POST_FORUM_URL) ); @@ -326,7 +329,7 @@ if($total_topics) if($replies > $board_config['posts_per_page']) { - $goto_page = "   (" . $lang['Goto_page'] . ": "; + $goto_page = "   (" . $lang['Goto_page'] . ": "; $times = 1; for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page']) @@ -335,7 +338,7 @@ if($total_topics) { if( $j + $board_config['posts_per_page'] >= $replies + 1 ) { - $goto_page .= " ... $times"; + $goto_page .= " ... $times"; } } else @@ -344,7 +347,7 @@ if($total_topics) { $goto_page .= ", "; } - $goto_page .= "$times"; + $goto_page .= "$times"; } $times++; } @@ -357,7 +360,7 @@ if($total_topics) if($topic_rowset[$i]['topic_status'] == TOPIC_LOCKED) { - $folder_image = "\"Topic"; + $folder_image = "\"""; } else { @@ -380,26 +383,26 @@ if($total_topics) if(empty($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id]) && $topic_rowset[$i]['post_time'] > $userdata['session_last_visit']) { - $folder_image = ""; + $folder_image = "\"""; } else { if( isset($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id]) ) { - $folder_image = ($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id] < $topic_rowset[$i]['post_time'] ) ? "" : ""; + $folder_image = ($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id] < $topic_rowset[$i]['post_time'] ) ? "\""" : "\"""; } else { - $folder_image = ""; + $folder_image = "\"""; } } } - $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&" . $replies); + $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"); $topic_poster = stripslashes($topic_rowset[$i]['username']); - $topic_poster_profile_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $topic_rowset[$i]['user_id']); + $topic_poster_profile_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $topic_rowset[$i]['user_id']); $last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['default_timezone']); @@ -413,8 +416,8 @@ if($total_topics) } $last_post = $last_post_time . "
by "; - $last_post .= "" . $last_post_user . " "; - $last_post .= "\"View"; + $last_post .= "" . $last_post_user . " "; + $last_post .= "\"""; $views = $topic_rowset[$i]['topic_views']; @@ -436,7 +439,7 @@ if($total_topics) } $template->assign_vars(array( - "PAGINATION" => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&postdays=$post_days", $topics_count, $board_config['topics_per_page'], $start), + "PAGINATION" => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start), "ON_PAGE" => ( floor( $start / $board_config['topics_per_page'] ) + 1 ), "TOTAL_PAGES" => ceil( $topics_count / $board_config['topics_per_page'] ), diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index eb8269466e..3ca7068f68 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -133,7 +133,7 @@ $join_sql_table = (!isset($post_id)) ? "" : "" . POSTS_TABLE . " p, " . POSTS_TA $join_sql = (!isset($post_id)) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= $post_id"; $count_sql = (!isset($post_id)) ? "" : ", COUNT(p2.post_id) AS prev_posts"; -$order_sql = (!isset($post_id)) ? "" : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_votecreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC"; +$order_sql = (!isset($post_id)) ? "" : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_votecreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC"; $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_votecreate, f.auth_vote, f.auth_attachments" . $count_sql . " FROM $join_sql_table " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f @@ -158,7 +158,6 @@ $forum_id = $forum_row['forum_id']; $topic_title = stripslashes($forum_row['topic_title']); $topic_id = $forum_row['topic_id']; $topic_time = $forum_row['topic_time']; -$total_replies = $forum_row['topic_replies'] + 1; if(!empty($post_id)) { @@ -192,6 +191,76 @@ if(!$is_auth['auth_view'] || !$is_auth['auth_read']) // End auth check // +// +// Generate a 'Show posts in previous x days' select box. If the postdays var is POSTed +// then get it's value, find the number of topics with dates newer than it (to properly +// handle pagination) and alter the main query +// +$previous_days = array(0, 1, 7, 14, 30, 90, 180, 364); +$previous_days_text = array($lang['All_Posts'], "1 " . $lang['Day'], "7 " . $lang['Days'], "2 " . $lang['Weeks'], "1 " . $lang['Month'], "3 ". $lang['Months'], "6 " . $lang['Months'], "1 " . $lang['Year']); + +if(!empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays'])) +{ + $post_days = (!empty($HTTP_POST_VARS['postdays'])) ? $HTTP_POST_VARS['postdays'] : $HTTP_GET_VARS['postdays']; + $min_post_time = time() - ($post_days * 86400); + + $sql = "SELECT COUNT(post_id) AS num_posts + FROM " . POSTS_TABLE . " + WHERE topic_id = $topic_id + AND post_time >= $min_post_time"; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't obtain limited topics count information", "", __LINE__, __FILE__, $sql); + } + list($total_replies) = $db->sql_fetchrow($result); + + $limit_posts_time = "AND p.post_time >= $min_post_time "; + + if(!empty($HTTP_POST_VARS['postdays'])) + { + $start = 0; + } +} +else +{ + $total_replies = $forum_row['topic_replies'] + 1; + + $limit_posts_time = ""; + $post_days = 0; +} + +$select_post_days = ""; + +// +// Decide how to order the post display +// +if(!empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder'])) +{ + $post_order = (!empty($HTTP_POST_VARS['postorder'])) ? $HTTP_POST_VARS['postorder'] : $HTTP_GET_VARS['postorder']; + $post_time_order = ($post_order == "asc") ? "ASC" : "DESC"; +} +else +{ + $post_time_order = "ASC"; +} + +$select_post_order = ""; + // // Go ahead and pull all data for this topic // @@ -199,8 +268,9 @@ $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt WHERE p.topic_id = $topic_id AND p.poster_id = u.user_id - AND p.post_id = pt.post_id - ORDER BY p.post_time ASC + AND p.post_id = pt.post_id + $limit_posts_time + ORDER BY p.post_time $post_time_order LIMIT $start, ".$board_config['posts_per_page']; if(!$result = $db->sql_query($sql)) { @@ -236,6 +306,9 @@ $template->set_filenames(array( $jumpbox = make_jumpbox(); $template->assign_vars(array( + "L_GO" => $lang['Go'], + "L_JUMP_TO" => $lang['Jump_to'], + "L_SELECT_FORUM" => $lang['Select_forum'], "JUMPBOX_LIST" => $jumpbox, "SELECT_NAME" => POST_FORUM_URL) ); @@ -246,8 +319,13 @@ $template->assign_vars(array( "FORUM_NAME" => $forum_name, "TOPIC_ID" => $topic_id, "TOPIC_TITLE" => $topic_title, - "POST_FORUM_URL" => POST_FORUM_URL, - "USERS_BROWSING" => $users_browsing) + + "L_DISPLAY_POSTS" => $lang['Display_posts'], + + "S_SELECT_POST_DAYS" => $select_post_days, + "S_SELECT_POST_ORDER" => $select_post_order, + "S_POST_DAYS_ACTION" => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$start")) + ); // // End header @@ -257,13 +335,13 @@ $template->assign_vars(array( // Post, reply and other URL generation for // templating vars // -$new_topic_url = append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id"); -$reply_topic_url = append_sid("posting.$phpEx?mode=reply&" . POST_TOPIC_URL . "=$topic_id"); +$new_topic_url = append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id"); +$reply_topic_url = append_sid("posting.$phpEx?mode=reply&" . POST_TOPIC_URL . "=$topic_id"); $view_forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"); -$view_prev_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=previous"); -$view_next_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=next"); +$view_prev_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=previous"); +$view_next_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=next"); $reply_img = ($forum_row['forum_status'] == FORUM_LOCKED || $forum_row['topic_status'] == TOPIC_LOCKED) ? $images['reply_locked'] : $images['reply_new']; $post_img = ($forum_row['forum_status'] == FORUM_LOCKED) ? $images['post_locked'] : $images['post_new']; @@ -318,7 +396,7 @@ for($i = 0; $i < $total_posts; $i++) if($postrow[$i]['user_avatar'] != "" && $poster_id != ANONYMOUS) { - $poster_avatar = (strstr("http", $postrow[$i]['user_avatar']) && $board_config['allow_avatar_remote']) ? "

" : "

"; + $poster_avatar = (strstr("http", $postrow[$i]['user_avatar']) && $board_config['allow_avatar_remote']) ? "

" : "
\"\"
"; } else { @@ -367,19 +445,19 @@ for($i = 0; $i < $total_posts; $i++) if($poster_id != ANONYMOUS) { - $profile_img = "\"""; + $profile_img = "\"""; - $pm_img = "\"""; + $pm_img = "\"""; - $email_img = ($postrow[$i]['user_viewemail'] == 1) ? "\""" : ""; + $email_img = ($postrow[$i]['user_viewemail'] == 1) ? "\""" : ""; - $www_img = ($postrow[$i]['user_website']) ? "\""" : ""; + $www_img = ($postrow[$i]['user_website']) ? "\""" : ""; if($postrow[$i]['user_icq']) { - $icq_status_img = ""; + $icq_status_img = ""; - $icq_add_img = "\"""; + $icq_add_img = "\"""; } else { @@ -387,11 +465,11 @@ for($i = 0; $i < $total_posts; $i++) $icq_add_img = ""; } - $aim_img = ($postrow[$i]['user_aim']) ? "\""" : ""; + $aim_img = ($postrow[$i]['user_aim']) ? "\""" : ""; - $msn_img = ($postrow[$i]['user_msnm']) ? "\""" : ""; + $msn_img = ($postrow[$i]['user_msnm']) ? "\""" : ""; - $yim_img = ($postrow[$i]['user_yim']) ? "\""" : ""; + $yim_img = ($postrow[$i]['user_yim']) ? "\""" : ""; } else { @@ -406,17 +484,17 @@ for($i = 0; $i < $total_posts; $i++) $yim_img = ""; } - $search_img = ""; + $search_img = ""; - $edit_img = "\"""; + $edit_img = "\"""; - $quote_img = "\"""; + $quote_img = "\"""; if( $is_auth['auth_mod'] ) { - $ip_img = "\"""; + $ip_img = "\"""; - $delpost_img = "\"""; + $delpost_img = "\"""; } $post_subject = ($postrow[$i]['post_subject'] != "") ? stripslashes($postrow[$i]['post_subject']) : $topic_title; @@ -474,13 +552,15 @@ for($i = 0; $i < $total_posts; $i++) // Again this will be handled by the templating // code at some point // - $color = (!($i % 2)) ? "#" . $theme['td_color1'] : "#" . $theme['td_color2']; + $row_color = ( !($i % 2) ) ? "#" . $theme['td_color1'] : "#" . $theme['td_color2']; + $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars("postrow", array( + "ROW_COLOR" => $row_color, + "ROW_CLASS" => $row_class, "POSTER_NAME" => $poster, "POSTER_RANK" => $poster_rank, "RANK_IMAGE" => $rank_image, - "ROW_COLOR" => $color, "POSTER_JOINED" => $poster_joined, "POSTER_POSTS" => $poster_posts, "POSTER_FROM" => $poster_from, @@ -521,23 +601,23 @@ if( $is_auth['auth_mod'] ) { $s_auth_can .= $lang['You'] . " " . $lang['can'] . " " . $lang['moderate_forum'] . "
"; - $topic_mod = "\"" "; + $topic_mod = "\"" "; - $topic_mod .= "\"" "; + $topic_mod .= "\"" "; if($forum_row['topic_status'] == TOPIC_UNLOCKED) { - $topic_mod .= "\"" "; + $topic_mod .= "\"" "; } else { - $topic_mod .= "\"" "; + $topic_mod .= "\"" "; } - $topic_mod .= "\"" "; + $topic_mod .= "\"" "; } $template->assign_vars(array( - "PAGINATION" => generate_pagination("viewtopic.$phpEx?".POST_TOPIC_URL."=$topic_id", $total_replies, $board_config['posts_per_page'], $start), + "PAGINATION" => generate_pagination("viewtopic.$phpEx?".POST_TOPIC_URL."=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start), "ON_PAGE" => ( floor( $start / $board_config['posts_per_page'] ) + 1 ), "TOTAL_PAGES" => ceil( $total_replies / $board_config['posts_per_page'] ), -- cgit v1.2.1