]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/BaseSearch.php
Merge pull request #12896 from HankG/mastodon-status-edit-fix-link-preview-changing
[friendica.git] / src / Module / BaseSearch.php
index f1c9f451ec1e7947db327fb7746a2b2010c9f1cc..cc8fab8f7e5619511ad55b9f41f39dbade71e9aa 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -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);
                }
@@ -82,10 +82,10 @@ class BaseSearch extends BaseModule
                $search = Network::convertToIdn($search);
 
                if (DI::mode()->isMobile()) {
-                       $itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
+                       $itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',
                                DI::config()->get('system', 'itemspage_network_mobile'));
                } else {
-                       $itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
+                       $itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_network',
                                DI::config()->get('system', 'itemspage_network'));
                }
 
@@ -116,7 +116,7 @@ class BaseSearch extends BaseModule
        protected static function printResult(ResultList $results, Pager $pager, string $header = ''): string
        {
                if ($results->getTotal() == 0) {
-                       notice(DI::l10n()->t('No matches'));
+                       DI::sysmsg()->addNotice(DI::l10n()->t('No matches'));
                        return '';
                }
 
@@ -125,14 +125,14 @@ class BaseSearch extends BaseModule
 
                        // in case the result is a contact result, add a contact-specific entry
                        if ($result instanceof ContactResult) {
-                               $contact = Model\Contact::getByURLForUser($result->getUrl(), local_user());
+                               $contact = Model\Contact::getByURLForUser($result->getUrl(), DI::userSession()->getLocalUserId());
                                if (!empty($contact)) {
                                        $entries[] = Contact::getContactTemplateVars($contact);
                                }
                        }
                }
 
-               $tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
+               $tpl = Renderer::getMarkupTemplate('contact/list.tpl');
                return Renderer::replaceMacros($tpl, [
                        'title'     => $header,
                        '$contacts' => $entries,