]> git.mxchange.org Git - friendica.git/blobdiff - mod/match.php
UserSession class [2] - Refactor mod/ files
[friendica.git] / mod / match.php
index 5a5d3be93d9941e67ce7ae6d8eb32eee8ad62d23..5b87c6870a630e8fb95befdc366da307a750265c 100644 (file)
@@ -23,6 +23,7 @@ use Friendica\App;
 use Friendica\Content\Widget;
 use Friendica\Core\Renderer;
 use Friendica\Core\Search;
+use Friendica\Core\Session;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
@@ -44,7 +45,7 @@ use Friendica\Module\Contact as ModuleContact;
  */
 function match_content(App $a)
 {
-       if (!local_user()) {
+       if (!DI::userSession()->getLocalUserId()) {
                return '';
        }
 
@@ -53,7 +54,7 @@ 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 '';
@@ -67,10 +68,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 +91,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 +115,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);
                }