1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-09-01 04:22:11 +02:00

[ticket/17398] Use referer for web paths in ajax requests

PHPBB-17398
This commit is contained in:
Marc Alexander
2024-10-09 20:16:30 +02:00
parent ecceeab709
commit fd58e4f338
3 changed files with 6 additions and 6 deletions

View File

@@ -4069,7 +4069,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'),
'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'),
'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'),
'U_DELETE_COOKIES' => $controller_helper->route('phpbb_ucp_delete_cookies_controller', ['_referer' => $controller_helper->get_current_url()]),
'U_DELETE_COOKIES' => $controller_helper->route('phpbb_ucp_delete_cookies_controller'),
'U_CONTACT_US' => ($config['contact_admin_form_enable'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin') : '',
'U_TEAM' => (!$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=team'),
'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'),

View File

@@ -223,13 +223,13 @@ class path_helper
*
* The referer must be specified as a parameter in the query.
*/
if ($this->request->is_ajax() && $this->symfony_request->get('_referer'))
if ($this->request->is_ajax() && $this->request->header('Referer'))
{
// We need to escape $absolute_board_url because it can be partially concatenated to the result.
$absolute_board_url = $this->request->escape($this->symfony_request->getSchemeAndHttpHost() . $this->symfony_request->getBasePath(), true);
$referer_web_root_path = $this->get_web_root_path_from_ajax_referer(
$this->symfony_request->get('_referer'),
$this->request->header('Referer'),
$absolute_board_url
);
return $this->web_root_path = $referer_web_root_path;