mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/11997] Add user's page dir to redirect path and fix unit tests for it
The user's page directory needs to be added to the redirect URL for proper redirects outside of the forum root. Fix the unit tests accordingly. PHPBB3-11997
This commit is contained in:
parent
ce2c5213d7
commit
4c1569dd8a
2 changed files with 13 additions and 2 deletions
|
@ -2708,7 +2708,14 @@ function redirect($url, $return = false, $disable_cd_check = false)
|
|||
}
|
||||
}
|
||||
|
||||
$url = generate_board_url() . '/' . $phpbb_path_helper->remove_web_root_path($url);
|
||||
$url = $phpbb_path_helper->remove_web_root_path($url);
|
||||
|
||||
if ($user->page['page_dir'])
|
||||
{
|
||||
$url = $user->page['page_dir'] . '/' . $url;
|
||||
}
|
||||
|
||||
$url = generate_board_url() . '/' . $url;
|
||||
}
|
||||
|
||||
// Clean URL and check if we go outside the forum directory
|
||||
|
|
|
@ -116,9 +116,12 @@ class phpbb_security_redirect_test extends phpbb_security_test_base
|
|||
$phpbb_path_helper = $this->path_helper;
|
||||
|
||||
$temp_phpbb_root_path = $phpbb_root_path;
|
||||
// We need to hack phpbb_root_path here, so it matches the actual fileinfo of the testing script.
|
||||
$temp_page_dir = $user->page['page_dir'];
|
||||
// We need to hack phpbb_root_path and the user's page_dir here
|
||||
// so it matches the actual fileinfo of the testing script.
|
||||
// Otherwise the paths are returned incorrectly.
|
||||
$phpbb_root_path = '';
|
||||
$user->page['page_dir'] = '';
|
||||
|
||||
if ($expected_error !== false)
|
||||
{
|
||||
|
@ -133,5 +136,6 @@ class phpbb_security_redirect_test extends phpbb_security_test_base
|
|||
$this->assertEquals($expected_result, $result);
|
||||
}
|
||||
$phpbb_root_path = $temp_phpbb_root_path;
|
||||
$user->page['page_dir'] = $temp_page_dir;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue