diff --git a/phpBB/templates/PSO/viewforum_body.tpl b/phpBB/templates/PSO/viewforum_body.tpl index c99cf79d98..8702765217 100644 --- a/phpBB/templates/PSO/viewforum_body.tpl +++ b/phpBB/templates/PSO/viewforum_body.tpl @@ -1,7 +1,7 @@
- +
{SITENAME} {L_INDEX} -> {FORUM_NAME}{L_DISPLAY_TOPICS}: {S_SELECT_TOPIC_DAYS} {L_DISPLAY_TOPICS}: {S_SELECT_TOPIC_DAYS} 
@@ -68,6 +68,9 @@
{S_TIMEZONE} + +
{L_MARK_TOPICS_READ} + {JUMPBOX}{S_AUTH_LIST} diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index ed06aa808d..99f6bcbc64 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -38,6 +38,15 @@ else } $start = (isset($HTTP_GET_VARS['start'])) ? $HTTP_GET_VARS['start'] : 0; + +if( isset($HTTP_GET_VARS['mark']) || isset($HTTP_POST_VARS['mark']) ) +{ + $mark_read = (isset($HTTP_POST_VARS['mark'])) ? $HTTP_POST_VARS['mark'] : $HTTP_GET_VARS['mark']; +} +else +{ + $mark_read = ""; +} // // End initial var setup // @@ -103,7 +112,6 @@ if(!$is_auth['auth_read'] || !$is_auth['auth_view']) // // Do the forum Prune // -/* if( $is_auth['auth_mod'] && $board_config['prune_enable'] ) { if( $forum_row['prune_next'] < time() && $forum_row['prune_enable'] ) @@ -112,7 +120,6 @@ if( $is_auth['auth_mod'] && $board_config['prune_enable'] ) auto_prune($forum_id); } } -*/ // // End of forum prune // @@ -217,7 +224,7 @@ for($i = 0; $i < count($previous_days); $i++) $select_topic_days .= ""; // -// Grab all the basic data (all topics except global announcements) +// Grab all the basic data (all topics except announcements) // for this forum // $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username @@ -226,26 +233,44 @@ $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as i AND t.topic_poster = u.user_id AND p.post_id = t.topic_last_post_id AND p.poster_id = u2.user_id - AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . " + AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . " + AND t.topic_type <> " . POST_ANNOUNCE . " $limit_topics_time ORDER BY t.topic_type DESC, p.post_time DESC LIMIT $start, ".$board_config['topics_per_page']; - if(!$t_result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql); } $total_topics = $db->sql_numrows($t_result); +// +// All announcement data, this keeps announcements +// on each viewforum page ... +// +$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username + FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2 + WHERE ( t.forum_id = $forum_id + OR t.forum_id = -1 ) + AND t.topic_poster = u.user_id + AND p.post_id = t.topic_last_post_id + AND p.poster_id = u2.user_id + AND ( t.topic_type = " . POST_GLOBAL_ANNOUNCE . " + OR t.topic_type = " . POST_ANNOUNCE . " ) + ORDER BY p.post_time DESC"; +if(!$ta_result = $db->sql_query($sql)) +{ + message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql); +} +$total_announcements = $db->sql_numrows($ta_result); + // // Post URL generation for templating vars // -$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, + "U_POST_NEW_TOPIC" => append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id"), "S_SELECT_TOPIC_DAYS" => $select_topic_days, "S_POST_DAYS_ACTION" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&start=$start")) @@ -260,9 +285,23 @@ $s_auth_can .= $lang['You'] . " " . ( ($is_auth['auth_reply']) ? $lang['can'] : $s_auth_can .= $lang['You'] . " " . ( ($is_auth['auth_edit']) ? $lang['can'] : $lang['cannot'] ) . " " . $lang['edit_posts'] . "
"; $s_auth_can .= $lang['You'] . " " . ( ($is_auth['auth_delete']) ? $lang['can'] : $lang['cannot'] ) . " " . $lang['delete_posts'] . "
"; +/* +$s_auth_read_img = "\"""; +$s_auth_post_img = "\"""; +$s_auth_reply_img = "\"""; +$s_auth_edit_img = "\"""; +$s_auth_delete_img = "\"""; +*/ if( $is_auth['auth_mod'] ) { $s_auth_can .= $lang['You'] . " " . $lang['can'] . " " . $lang['moderate_forum'] . "
"; + +// $s_auth_mod_img = "\"""; + +} +else +{ + $s_auth_mod_img = ""; } // @@ -290,10 +329,18 @@ $template->assign_vars(array( "FORUM_ID" => $forum_id, "FORUM_NAME" => $forum_name, "MODERATORS" => $forum_moderators, - "IMG_POST" => ($forum_row['forum_status'] == FORUM_LOCKED) ? $images['post_locked'] : $images['post_new'], - "S_AUTH_LIST" => $s_auth_can) + "L_MARK_TOPICS_READ" => $lang['Mark_all_topics'], + + "U_MARK_READ" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&mark=topics"), + + "S_AUTH_LIST" => $s_auth_can, + "S_AUTH_READ_IMG" => $s_auth_read_img, + "S_AUTH_POST_IMG" => $s_auth_post_img, + "S_AUTH_REPLY_IMG" => $s_auth_reply_img, + "S_AUTH_EDIT_IMG" => $s_auth_edit_img, + "S_AUTH_MOD_IMG" => $s_auth_mod_img) ); // // End header @@ -302,9 +349,22 @@ $template->assign_vars(array( // // Okay, lets dump out the page ... // -if($total_topics) +if($total_topics || $total_announcements) { - $topic_rowset = $db->sql_fetchrowset($t_result); + // + // First get announcements + // + while( $row = $db->sql_fetchrow($ta_result) ) + { + $topic_rowset[] = $row; + } + // + // Now get everything else + // + while( $row = $db->sql_fetchrow($t_result) ) + { + $topic_rowset[] = $row; + } for($i = 0; $i < $total_topics; $i++) { @@ -314,11 +374,11 @@ if($total_topics) if($topic_type == POST_ANNOUNCE) { - $topic_type = $lang['Annoucement'] . " "; + $topic_type = $lang['Topic_Announcement'] . " "; } else if($topic_type == POST_STICKY) { - $topic_type = $lang['Sticky'] . " "; + $topic_type = $lang['Topic_Sticky'] . " "; } else { @@ -385,13 +445,29 @@ if($total_topics) if(empty($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id]) && $topic_rowset[$i]['post_time'] > $userdata['session_last_visit']) { - $folder_image = "\"""; + if($mark_read == "topics") + { + setcookie('phpbb2_' . $forum_id . '_' . $topic_id, time(), time()+6000, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); + $folder_image = "\"""; + } + else + { + $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'] ) ? "\""" : "\"""; + if($mark_read == "topics") + { + setcookie('phpbb2_' . $forum_id . '_' . $topic_id, time(), time()+6000, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); + $folder_image = "\"""; + } + else + { + $folder_image = ($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id] < $topic_rowset[$i]['post_time'] ) ? "\""" : "\"""; + } } else { @@ -417,7 +493,7 @@ if($total_topics) $last_post_user = $topic_rowset[$i]['user2']; } - $last_post = $last_post_time . "
by "; + $last_post = $last_post_time . "
" . $lang['by'] . " "; $last_post .= "" . $last_post_user . " "; $last_post .= "\""";