diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index d971af70ee..ad1bbe86fc 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -230,6 +230,7 @@
[Change] Unapproved topics can no longer be replied to (Bug #44005)
[Change] Require user to be registered and logged in to search for unread posts if topic read tracking is disabled for guests (Bug #49525)
[Change] Allow three-digit hex notation in Color BBcode. (Bug #39965 - Patch by m0rpha)
+ [Change] Simplified login_box() and redirection after login. S_LOGIN_ACTION can now be used on every page. (Bug #50285)
[Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
[Feature] Backported 3.2 captcha plugins.
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index d6ca262ab8..c6a6d354ce 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2978,28 +2978,18 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
}
}
- if (!$redirect)
- {
- // We just use what the session code determined...
- // If we are not within the admin directory we use the page dir...
- $redirect = '';
-
- if (!$admin)
- {
- $redirect .= ($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '';
- }
-
- $redirect .= $user->page['page_name'] . (($user->page['query_string']) ? '?' . htmlspecialchars($user->page['query_string']) : '');
- }
-
// Assign credential for username/password pair
$credential = ($admin) ? md5(unique_id()) : false;
$s_hidden_fields = array(
- 'redirect' => $redirect,
'sid' => $user->session_id,
);
+ if ($redirect)
+ {
+ $s_hidden_fields['redirect'] = $redirect;
+ }
+
if ($admin)
{
$s_hidden_fields['credential'] = $credential;
@@ -3017,7 +3007,6 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'),
'S_DISPLAY_FULL_LOGIN' => ($s_display) ? true : false,
- 'S_LOGIN_ACTION' => (!$admin) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("index.$phpEx", false, true, $user->session_id), // Needs to stay index.$phpEx because we are within the admin directory
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_ADMIN_AUTH' => $admin,
@@ -4195,6 +4184,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'S_FORUM_ID' => $forum_id,
'S_TOPIC_ID' => $topic_id,
+ 'S_LOGIN_ACTION' => (!defined('ADMIN_START')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') . '&redirect=' . urlencode(str_replace('&', '&', build_url())) : append_sid("index.$phpEx", false, true, $user->session_id) . '&redirect=' . urlencode(str_replace('&', '&', build_url())),
+
'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false,
'S_ENABLE_FEEDS_FORUMS' => ($config['feed_overall_forums']) ? true : false,
'S_ENABLE_FEEDS_TOPICS' => ($config['feed_overall_topics']) ? true : false,
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index b60eaa34e1..95c142d865 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -166,8 +166,6 @@ if (!$auth->acl_get('f_read', $forum_id))
{
$template->assign_vars(array(
'S_NO_READ_ACCESS' => true,
- 'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false,
- 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') . '&redirect=' . urlencode(str_replace('&', '&', build_url())),
));
page_footer();