diff --git a/phpBB/posting.php b/phpBB/posting.php index a0a2db74a9..2c1836d051 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1321,9 +1321,9 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id 'TOPIC_TITLE' => $topic_title, 'FORUM_NAME' => $forum_name, - 'U_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id&e=1", - 'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&e=1", - 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&p=$post_id&e=1#$post_id", + 'U_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id&e=0", + 'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&e=0", + 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&p=$post_id&e=$post_id", 'U_STOP_WATCHING_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&unwatch=topic", 'U_STOP_WATCHING_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id&unwatch=forum", )); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index cbc2cd114b..dee7062169 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -222,9 +222,10 @@ if ($forum_password) } // Redirect to login upon emailed notification links -if (!empty($_GET['e']) && $user->data['user_id'] == ANONYMOUS) +if (isset($_GET['e']) && $user->data['user_id'] == ANONYMOUS) { - login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])), '', $user->lang['LOGIN_NOTIFY_TOPIC']); + $redirect_url = htmlspecialchars(str_replace('&e=' . $_GET['e'], '', $_SERVER['REQUEST_URI'])) . (($_GET['e']) ? '#' . (int) $_GET['e'] : ''); + login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', $redirect_url), '', $user->lang['LOGIN_NOTIFY_TOPIC']); } // Not final in the slightest! Far too simplistic