From: Michael Date: Mon, 3 Oct 2022 13:53:19 +0000 (+0000) Subject: Issue 11891: Enable search for user@domain.tld X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4b8c63121637778261f7aa19f6a2999c9dd99714;p=friendica.git Issue 11891: Enable search for user@domain.tld --- diff --git a/src/Module/BaseSearch.php b/src/Module/BaseSearch.php index f1c9f451ec..276598131b 100644 --- a/src/Module/BaseSearch.php +++ b/src/Module/BaseSearch.php @@ -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); } diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 05c4e05081..9c073b3ef1 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -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;