Merge pull request #11957 from annando/issue-11891

Issue 11891: Enable search for user@domain.tld
This commit is contained in:
Hypolite Petovan 2022-10-03 11:15:55 -04:00 committed by GitHub
commit 168827c8ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -64,7 +64,7 @@ class BaseSearch extends BaseModule
$header = '';
if (strpos($search, '@') === 0) {
$search = substr($search, 1);
$search = trim(substr($search, 1));
$type = Search::TYPE_PEOPLE;
$header = DI::l10n()->t('People Search - %s', $search);
@ -74,7 +74,7 @@ class BaseSearch extends BaseModule
}
if (strpos($search, '!') === 0) {
$search = substr($search, 1);
$search = trim(substr($search, 1));
$type = Search::TYPE_FORUM;
$header = DI::l10n()->t('Forum Search - %s', $search);
}

View file

@ -246,8 +246,10 @@ class Contact extends BaseModule
if ($search) {
$searching = true;
$search_hdr = $search;
$search_txt = preg_quote($search);
$sql_extra .= " AND (name REGEXP ? OR url REGEXP ? OR nick REGEXP ?)";
$search_txt = preg_quote(trim($search, ' @!'));
$sql_extra .= " AND (`name` REGEXP ? OR `url` REGEXP ? OR `nick` REGEXP ? OR `addr` REGEXP ? OR `alias` REGEXP ?)";
$sql_values[] = $search_txt;
$sql_values[] = $search_txt;
$sql_values[] = $search_txt;
$sql_values[] = $search_txt;
$sql_values[] = $search_txt;