mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-12 03:34:04 +02:00
[ticket/10423] Move code into a function and add tests for it
PHPBB3-10423
This commit is contained in:
@@ -574,9 +574,9 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
}
|
||||
|
||||
// define some vars for urls
|
||||
// A single wildcard will destroy the search query
|
||||
$hilit = trim(preg_replace('#(?<=^|\s)\*(?=\s|$)#', '', str_replace(array('+', '-', '|', '(', ')', '"'), ' ', $keywords)));
|
||||
$hilit = implode('|', explode(' ', preg_replace('#\s+#u', ' ', $hilit)));
|
||||
// A single wildcard will make the search results look ugly
|
||||
$hilit = phpbb_clean_search_string(str_replace(array('+', '-', '|', '(', ')', '"'), ' ', $keywords));
|
||||
$hilit = str_replace(' ', '|', $hilit);
|
||||
|
||||
$u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit)));
|
||||
$u_show_results = '&sr=' . $show_results;
|
||||
@@ -840,7 +840,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
$hilit_array = array_filter(explode('|', $hilit), 'strlen');
|
||||
foreach ($hilit_array as $key => $value)
|
||||
{
|
||||
$hilit_array[$key] = preg_replace('#\s+#u', ' ', trim(preg_replace('#(?<=^|\s)\*(?=\s|$)#', '', $value)));
|
||||
$hilit_array[$key] = phpbb_clean_search_string($value);
|
||||
$hilit_array[$key] = str_replace('\*', '\w*?', preg_quote($hilit_array[$key], '#'));
|
||||
$hilit_array[$key] = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $hilit_array[$key]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user