Improved index folder mark code

git-svn-id: file:///svn/phpbb/trunk@821 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-08-09 17:05:20 +00:00
parent 53150c6803
commit bd3a6850aa
3 changed files with 32 additions and 28 deletions

View file

@ -176,14 +176,14 @@ if($total_categories = $db->sql_numrows($q_categories))
{ {
$forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = 1; $forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = 1;
$forum_mods_name[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['username']; $forum_mods_name[$forum_mods_list[$i]['forum_id']][] = stripslashes($forum_mods_list[$i]['username']);
$forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['user_id']; $forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['user_id'];
} }
else else
{ {
$forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = 0; $forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = 0;
$forum_mods_name[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_name']; $forum_mods_name[$forum_mods_list[$i]['forum_id']][] = stripslashes($forum_mods_list[$i]['group_name']);
$forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_id']; $forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_id'];
} }
} }
@ -193,12 +193,6 @@ if($total_categories = $db->sql_numrows($q_categories))
// //
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_rows); $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_rows);
//
// Output page header and open the index body template
//
$page_title = $lang['Forum_Index'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "index_body.tpl") "body" => "index_body.tpl")
); );
@ -248,37 +242,29 @@ if($total_categories = $db->sql_numrows($q_categories))
if($forum_rows[$j]['forum_status'] == FORUM_LOCKED) if($forum_rows[$j]['forum_status'] == FORUM_LOCKED)
{ {
$folder_image = "<img src=\"" . $images['folder_locked'] . "\" alt=\"" . $lang['Forum_locked'] . "\" />"; $folder_image = "<img src=\"" . $images['folder_locked'] . "\" alt=\"" . $lang['Forum_locked'] . "\" />";
} }
else else
{ {
$unread_topics = false;
if( count($new_topic_data[$forum_id]) ) if( count($new_topic_data[$forum_id]) )
{ {
for($k = 0; $k < count($new_topic_data[$forum_id]); $k++) for($k = 0; $k < count($new_topic_data[$forum_id]); $k++)
{ {
if( isset($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $new_topic_data[$forum_id][$k]]) ) if( !isset($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $new_topic_data[$forum_id][$k]]) )
{
$folder_image = "<img src=\"" . $images['folder'] . "\" alt=\"" . $lang['No_new_posts'] . "\" />";
}
else
{ {
if($mark_read == "forums") if($mark_read == "forums")
{ {
setcookie('phpbb2_' . $forum_id . '_' . $new_topic_data[$forum_id][$k], time(), time()+6000, $cookiepath, $cookiedomain, $cookiesecure); setcookie('phpbb2_' . $forum_id . '_' . $new_topic_data[$forum_id][$k], time(), 0, $cookiepath, $cookiedomain, $cookiesecure);
$folder_image = "<img src=\"" . $images['folder'] . "\" alt=\"" . $lang['No_new_posts'] . "\" />";
} }
else else
{ {
$folder_image = "<img src=\"" . $images['folder_new'] . "\" alt=\"" . $lang['New_posts'] . "\" />"; $unread_topics = true;
} }
} }
} }
} }
else
{
$folder_image = "<img src=\"" . $images['folder'] . "\" alt=\"" . $lang['No_new_posts'] . "\" />";
}
$folder_image = ( $unread_topics ) ? "<img src=\"" . $images['folder_new'] . "\" alt=\"" . $lang['New_posts'] . "\" />" : "<img src=\"" . $images['folder'] . "\" alt=\"" . $lang['No_new_posts'] . "\" />";
} }
$posts = $forum_rows[$j]['forum_posts']; $posts = $forum_rows[$j]['forum_posts'];
@ -288,15 +274,15 @@ if($total_categories = $db->sql_numrows($q_categories))
{ {
if($forum_rows[$j]['user_id'] == ANONYMOUS && $forum_rows[$j]['post_username'] != '') if($forum_rows[$j]['user_id'] == ANONYMOUS && $forum_rows[$j]['post_username'] != '')
{ {
$last_poster = $forum_rows[$j]['post_username']; $last_poster = stripslashes($forum_rows[$j]['post_username']);
} }
else else
{ {
$last_poster = $forum_rows[$j]['username']; $last_poster = stripslashes($forum_rows[$j]['username']);
} }
$last_post_time = create_date($board_config['default_dateformat'], $forum_rows[$j]['post_time'], $board_config['default_timezone']); $last_post_time = create_date($board_config['default_dateformat'], $forum_rows[$j]['post_time'], $board_config['default_timezone']);
$last_post = $last_post_time . "<br />by "; $last_post = $last_post_time . "<br />" . $lang['by'] . " ";
$last_post .= "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $forum_rows[$j]['user_id']) . "\">" . $last_poster . "</a>&nbsp;"; $last_post .= "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $forum_rows[$j]['user_id']) . "\">" . $last_poster . "</a>&nbsp;";
$last_post .= "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $forum_rows[$j]['topic_last_post_id']) . "#" . $forum_rows[$j]['topic_last_post_id'] . "\"><img src=\"" . $images['icon_latest_reply'] . "\" border=\"0\" alt=\"" . $lang['View_latest_post'] . "\" /></a>"; $last_post .= "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $forum_rows[$j]['topic_last_post_id']) . "#" . $forum_rows[$j]['topic_last_post_id'] . "\"><img src=\"" . $images['icon_latest_reply'] . "\" border=\"0\" alt=\"" . $lang['View_latest_post'] . "\" /></a>";
@ -380,6 +366,14 @@ else
message_die(GENERAL_MESSAGE, $lang['No_forums']); message_die(GENERAL_MESSAGE, $lang['No_forums']);
} }
//
// Output page header and open the index body template
// we do this here because of the mark topics read cookie
// code
//
$page_title = $lang['Forum_Index'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
// //
// Generate the page // Generate the page
// //

View file

@ -6,7 +6,11 @@
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * email : support@phpbb.com
* *
<<<<<<< lang_english.php
* $Id$ * $Id$
=======
* $Id$
>>>>>>> 1.104
* *
* ***************************************************************************/ * ***************************************************************************/
@ -141,6 +145,9 @@ $lang['Usergroups'] = "Usergroups";
$lang['Last_Post'] = "Last Post"; $lang['Last_Post'] = "Last Post";
$lang['Moderator'] = "Moderator/s"; $lang['Moderator'] = "Moderator/s";
$lang['Mark_all_topics'] = "Mark all topics read";
$lang['Mark_all_forums'] = "Mark all forums read";
// //
// Stats block text // Stats block text
// //
@ -188,8 +195,8 @@ $lang['Reached_on_error'] = "You have reached this page in error, please go back
$lang['Display_topics'] = "Display topics from previous"; $lang['Display_topics'] = "Display topics from previous";
$lang['All_Topics'] = "All Topics"; $lang['All_Topics'] = "All Topics";
$lang['Annoucement'] = "<b>Annoucement:</b>"; $lang['Topic_Announcement'] = "<b>Announcement:</b>";
$lang['Sticky'] = "<b>Sticky:</b>"; $lang['Topic_Sticky'] = "<b>Sticky:</b>";
// //
// Viewtopic // Viewtopic
@ -242,7 +249,7 @@ $lang['Post_a_reply'] = "Post a reply";
$lang['Post_topic_as'] = "Post topic as"; $lang['Post_topic_as'] = "Post topic as";
$lang['Edit_Post'] = "Edit post"; $lang['Edit_Post'] = "Edit post";
$lang['Post_Normal'] = "Normal"; $lang['Post_Normal'] = "Normal";
$lang['Post_Annoucement'] = "Announcement"; $lang['Post_Announcement'] = "Announcement";
$lang['Post_Sticky'] = "Sticky"; $lang['Post_Sticky'] = "Sticky";
$lang['Options'] = "Options"; $lang['Options'] = "Options";
@ -547,6 +554,7 @@ $lang['this_forum'] = " this forum";
// //
$lang['Who_is_online'] = "Who is online"; $lang['Who_is_online'] = "Who is online";
$lang['Online_explain'] = "This data is based on users active over the past five minutes"; $lang['Online_explain'] = "This data is based on users active over the past five minutes";
$lang['No_users_browsing'] = "There are no users currently browsing this forum";
$lang['Location'] = "Location"; $lang['Location'] = "Location";
$lang['Last_updated'] = "Last Updated"; $lang['Last_updated'] = "Last Updated";

View file

@ -64,6 +64,8 @@
<td width="20" align="center"><img src="images/folder_lock.gif" alt="{L_FORUM_LOCKED}" /></td> <td width="20" align="center"><img src="images/folder_lock.gif" alt="{L_FORUM_LOCKED}" /></td>
<td><span class="gensmall">{L_FORUM_LOCKED}</span></td> <td><span class="gensmall">{L_FORUM_LOCKED}</span></td>
</tr> </tr>
<tr>
<td colspan="8"><br /><span class="gensmall"><a href="{U_MARK_READ}">{L_MARK_FORUMS_READ}</a></span></td>
</table></td> </table></td>
<td align="right" valign="top"><span class="gensmall"><b>{S_TIMEZONE}</b></span></td> <td align="right" valign="top"><span class="gensmall"><b>{S_TIMEZONE}</b></span></td>
</tr> </tr>