]> git.mxchange.org Git - friendica.git/blobdiff - mod/match.php
Move mod/follow to src/Modules
[friendica.git] / mod / match.php
index 5f74b8d3a439955968202c13fb6536dc3fea589e..e8a0a660594fc7d5ae36909cd2a676247886b9ad 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -44,7 +44,7 @@ use Friendica\Module\Contact as ModuleContact;
  */
 function match_content(App $a)
 {
-       if (!local_user()) {
+       if (!DI::userSession()->getLocalUserId()) {
                return '';
        }
 
@@ -53,13 +53,13 @@ function match_content(App $a)
 
        $_SESSION['return_path'] = DI::args()->getCommand();
 
-       $profile = Profile::getByUID(local_user());
+       $profile = Profile::getByUID(DI::userSession()->getLocalUserId());
 
        if (!DBA::isResult($profile)) {
                return '';
        }
        if (!$profile['pub_keywords'] && (!$profile['prv_keywords'])) {
-               notice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.'));
+               DI::sysmsg()->addNotice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.'));
                return '';
        }
 
@@ -67,10 +67,10 @@ function match_content(App $a)
        $tags = trim($profile['pub_keywords'] . ' ' . $profile['prv_keywords']);
 
        if (DI::mode()->isMobile()) {
-               $limit = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
+               $limit = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',
                        DI::config()->get('system', 'itemspage_network_mobile'));
        } else {
-               $limit = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
+               $limit = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_network',
                        DI::config()->get('system', 'itemspage_network'));
        }
 
@@ -90,7 +90,7 @@ function match_content(App $a)
        }
 
        if (empty($entries)) {
-               info(DI::l10n()->t('No matches'));
+               DI::sysmsg()->addInfo(DI::l10n()->t('No matches'));
        }
 
        $tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
@@ -114,12 +114,12 @@ function match_get_contacts($msearch, $entries, $limit)
                }
 
                // Already known contact
-               $contact = Contact::getByURL($profile->url, null, ['rel'], local_user());
+               $contact = Contact::getByURL($profile->url, null, ['rel'], DI::userSession()->getLocalUserId());
                if (!empty($contact) && in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
                        continue;
                }
 
-               $contact = Contact::getByURLForUser($profile->url, local_user());
+               $contact = Contact::getByURLForUser($profile->url, DI::userSession()->getLocalUserId());
                if (!empty($contact)) {
                        $entries[$contact['id']] = ModuleContact::getContactTemplateVars($contact);
                }