[ticket/17463] Remove extraneous '&' from search page urls

Normally $u_show_results always starts with '&' as it is appended to the
$u_sort_param variable. Which is fine if $u_sort_param is always populated,
which it is, except when searching for new or unread posts. This fix adds a
check for when $u_sort_param is empty and adds '&' as needed.

PHPBB-17463
This commit is contained in:
NeoDev 2025-01-22 19:31:25 -06:00
parent 2f08d8eb72
commit 3d6e63154f

View file

@ -697,10 +697,10 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$hilit = str_replace(' ', '|', $hilit);
$u_hilit = urlencode(html_entity_decode(str_replace('|', ' ', $hilit), ENT_COMPAT));
$u_show_results = '&sr=' . $show_results;
$u_show_results = 'sr=' . $show_results;
$u_search_forum = implode('&fid%5B%5D=', $search_forum);
$u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results);
$u_search = append_sid("{$phpbb_root_path}search.$phpEx", (($u_sort_param) ? $u_sort_param . '&' : '') . $u_show_results);
$u_search .= ($search_id) ? '&search_id=' . $search_id : '';
$u_search .= ($u_hilit) ? '&keywords=' . urlencode(html_entity_decode($keywords, ENT_COMPAT)) : '';
$u_search .= ($search_terms != 'all') ? '&terms=' . $search_terms : '';