Experimental: link to the first unread post without redirection

git-svn-id: file:///svn/phpbb/trunk@3009 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Ludovic Arnaud 2002-11-05 07:03:14 +00:00
parent a583f7bd10
commit e9e9716acc
2 changed files with 10 additions and 7 deletions

View file

@ -502,7 +502,7 @@ if ($total_topics)
$unread_topic = true;
}
$newest_post_img = ($unread_topic) ? '<a href="viewtopic.' . $phpEx . $SID . '&amp;t=' . $topic_id . '&amp;view=newest">' . $user->img('goto_post_newest', 'View_newest_post') . '</a> ' : '';
$newest_post_img = ($unread_topic) ? '<a href="viewtopic.' . $phpEx . $SID . '&amp;t=' . $topic_id . '&amp;view=newest#newest">' . $user->img('goto_post_newest', 'View_newest_post') . '</a> ' : '';
$folder_img = ($unread_topic) ? $folder_new : $folder;
$folder_alt = ($unread_topic) ? 'New_posts' : (($topic_rowset[$i]['topic_status'] == ITEM_LOCKED) ? 'Topic_locked' : 'No_new_posts');

View file

@ -48,8 +48,6 @@ if (isset($_GET['view']) && empty($post_id))
{
$session_id = (!empty($_COOKIE[$config['cookie_name'] . '_sid'])) ? $_COOKIE[$config['cookie_name'] . '_sid'] : $_GET['sid'];
$SID = '?sid=' . ((!empty($_GET['sid'])) ? $session_id : '');
if ($session_id)
{
$sql = "SELECT p.post_id
@ -69,11 +67,12 @@ if (isset($_GET['view']) && empty($post_id))
}
$post_id = $row['post_id'];
redirect("viewtopic.$phpEx$SID&p=$post_id#$post_id");
$newest_post_id = $post_id;
// redirect("viewtopic.$phpEx$SID&p=$post_id#$post_id");
}
}
redirect("index.$phpEx");
// redirect("index.$phpEx");
}
else if ($_GET['view'] == 'next' || $_GET['view'] == 'previous')
{
@ -801,6 +800,10 @@ if ($row = $db->sql_fetchrow($result))
// Define the little post icon
$mini_post_img = ($row['post_time'] > $user->data['user_lastvisit'] && $row['post_time'] > $topic_last_read) ? $user->img('goto_post_new', $user->lang['New_post']) : $user->img('goto_post', $user->lang['Post']);
// Little post link and anchor name
$mini_post_url = 'viewtopic.' . $phpEx . $SID . '&amp;p=' . $row['post_id'] . '#' . $row['post_id'];
$u_post_id = (!empty($newest_post_id) && $newest_post_id == $row['post_id']) ? 'newest' : $row['post_id'];
// Dump vars into template
$template->assign_block_vars('postrow', array(
'POSTER_NAME' => $poster,
@ -852,8 +855,8 @@ if ($row = $db->sql_fetchrow($result))
'S_ROW_COUNT' => $i++,
'U_MINI_POST' => $mini_post_url,
'U_POST_ID' => $row['post_id'])
);
'U_POST_ID' => $u_post_id
));
}
while ($row = $db->sql_fetchrow($result));
}