]> git.mxchange.org Git - friendica.git/commitdiff
Issue 11891: Enable search for user@domain.tld
authorMichael <heluecht@pirati.ca>
Mon, 3 Oct 2022 13:53:19 +0000 (13:53 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 3 Oct 2022 13:53:19 +0000 (13:53 +0000)
src/Module/BaseSearch.php
src/Module/Contact.php

index f1c9f451ec1e7947db327fb7746a2b2010c9f1cc..276598131b6411513fef1eb3b1fae9655bf519d1 100644 (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);
                }
index 05c4e05081254dce75fa3cb78a4c5748a6b0deab..9c073b3ef1a892a15b06951eb0fb58107a5338e5 100644 (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;