diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-03-10 10:15:38 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-03-10 10:15:38 +0100 |
commit | b876c073776a5b11c08e5f71bf12bc06fd5195d8 (patch) | |
tree | a6161a392aace38546f264588cdb2fcf5869c3c8 | |
parent | 4b6f3f8b0fc3fc3b0d7fa0147930d0ea02107a8f (diff) | |
download | forums-b876c073776a5b11c08e5f71bf12bc06fd5195d8.tar forums-b876c073776a5b11c08e5f71bf12bc06fd5195d8.tar.gz forums-b876c073776a5b11c08e5f71bf12bc06fd5195d8.tar.bz2 forums-b876c073776a5b11c08e5f71bf12bc06fd5195d8.tar.xz forums-b876c073776a5b11c08e5f71bf12bc06fd5195d8.zip |
[ticket/12261] Remove web root path from login redirect url
The redirect url must be relative to the ucp.php and not relative to the
current page.
PHPBB3-12261
-rw-r--r-- | phpBB/includes/functions.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 689a682de3..96b4161958 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2419,7 +2419,7 @@ function reapply_sid($url) */ function build_url($strip_vars = false) { - global $user, $phpbb_root_path; + global $config, $user, $phpEx, $phpbb_root_path; $page = $user->page['page']; @@ -2432,6 +2432,12 @@ function build_url($strip_vars = false) // URL if ($url_parts === false || empty($url_parts['scheme']) || empty($url_parts['host'])) { + // Remove 'app.php/' from the page, when rewrite is enabled + if ($config['enable_mod_rewrite'] && strpos($page, 'app.' . $phpEx . '/') === 0) + { + $page = substr($page, strlen('app.' . $phpEx . '/')); + } + $page = $phpbb_root_path . $page; } @@ -4893,6 +4899,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 $hidden_fields_for_jumpbox = phpbb_build_hidden_fields_for_query_params($request, array('f')); $notification_mark_hash = generate_link_hash('mark_all_notifications_read'); + $redirect_url = $phpbb_path_helper->remove_web_root_path(build_url()); + // The following assigns all _common_ variables that may be used at any point in a template. $template->assign_vars(array( 'SITENAME' => $config['sitename'], @@ -4977,7 +4985,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'S_TOPIC_ID' => $topic_id, 'S_LOGIN_ACTION' => ((!defined('ADMIN_START')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id)), - 'S_LOGIN_REDIRECT' => build_hidden_fields(array('redirect' => build_url())), + 'S_LOGIN_REDIRECT' => build_hidden_fields(array('redirect' => $redirect_url)), 'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false, 'S_ENABLE_FEEDS_OVERALL' => ($config['feed_overall']) ? true : false, |