]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Search/Index.php
old boot.php functions replaced in src/module (4)
[friendica.git] / src / Module / Search / Index.php
index db20dd0a3d76e616e74e93dd8866adf3adb46b1d..131cb5292f84291876cf2235d5b0642227ced752 100644 (file)
@@ -94,7 +94,7 @@ class Index extends BaseSearch
                        }
                }
 
-               if (local_user()) {
+               if (Session::getLocalUser()) {
                        DI::page()['aside'] .= Widget\SavedSearches::getHTML(Search::getSearchPath($search), $search);
                }
 
@@ -149,7 +149,7 @@ class Index extends BaseSearch
                // Tags don't look like an URL and the fulltext search does only work with natural words
                if (parse_url($search, PHP_URL_SCHEME) && parse_url($search, PHP_URL_HOST)) {
                        Logger::info('Skipping tag and fulltext search since the search looks like a URL.', ['q' => $search]);
-                       notice(DI::l10n()->t('No results.'));
+                       DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
                        return $o;
                }
 
@@ -161,10 +161,10 @@ class Index extends BaseSearch
                // No items will be shown if the member has a blocked profile wall.
 
                if (DI::mode()->isMobile()) {
-                       $itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
+                       $itemsPerPage = DI::pConfig()->get(Session::getLocalUser(), '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(Session::getLocalUser(), 'system', 'itemspage_network',
                                DI::config()->get('system', 'itemspage_network'));
                }
 
@@ -174,29 +174,29 @@ class Index extends BaseSearch
 
                if ($tag) {
                        Logger::info('Start tag search.', ['q' => $search]);
-                       $uriids = Tag::getURIIdListByTag($search, local_user(), $pager->getStart(), $pager->getItemsPerPage(), $last_uriid);
-                       $count = Tag::countByTag($search, local_user());
+                       $uriids = Tag::getURIIdListByTag($search, Session::getLocalUser(), $pager->getStart(), $pager->getItemsPerPage(), $last_uriid);
+                       $count = Tag::countByTag($search, Session::getLocalUser());
                } else {
                        Logger::info('Start fulltext search.', ['q' => $search]);
-                       $uriids = Post\Content::getURIIdListBySearch($search, local_user(), $pager->getStart(), $pager->getItemsPerPage(), $last_uriid);
-                       $count = Post\Content::countBySearch($search, local_user());
+                       $uriids = Post\Content::getURIIdListBySearch($search, Session::getLocalUser(), $pager->getStart(), $pager->getItemsPerPage(), $last_uriid);
+                       $count = Post\Content::countBySearch($search, Session::getLocalUser());
                }
 
                if (!empty($uriids)) {
-                       $condition = ["(`uid` = ? OR (`uid` = ? AND NOT `global`))", 0, local_user()];
+                       $condition = ["(`uid` = ? OR (`uid` = ? AND NOT `global`))", 0, Session::getLocalUser()];
                        $condition = DBA::mergeConditions($condition, ['uri-id' => $uriids]);
                        $params = ['order' => ['id' => true]];
-                       $items = Post::toArray(Post::selectForUser(local_user(), Item::DISPLAY_FIELDLIST, $condition, $params));
+                       $items = Post::toArray(Post::selectForUser(Session::getLocalUser(), Item::DISPLAY_FIELDLIST, $condition, $params));
                }
 
                if (empty($items)) {
                        if (empty($last_uriid)) {
-                               notice(DI::l10n()->t('No results.'));
+                               DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
                        }
                        return $o;
                }
 
-               if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
+               if (DI::pConfig()->get(Session::getLocalUser(), 'system', 'infinite_scroll')) {
                        $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
                        $o .= Renderer::replaceMacros($tpl, ['$reload_uri' => DI::args()->getQueryString()]);
                }
@@ -213,9 +213,9 @@ class Index extends BaseSearch
 
                Logger::info('Start Conversation.', ['q' => $search]);
 
-               $o .= DI::conversation()->create($items, 'search', false, false, 'commented', local_user());
+               $o .= DI::conversation()->create($items, 'search', false, false, 'commented', Session::getLocalUser());
 
-               if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
+               if (DI::pConfig()->get(Session::getLocalUser(), 'system', 'infinite_scroll')) {
                        $o .= HTML::scrollLoader();
                } else {
                        $o .= $pager->renderMinimal($count);
@@ -254,9 +254,9 @@ class Index extends BaseSearch
                        $search = $matches[1];
                }
 
-               if (local_user()) {
+               if (Session::getLocalUser()) {
                        // User-specific contact URL/address search
-                       $contact_id = Contact::getIdForURL($search, local_user());
+                       $contact_id = Contact::getIdForURL($search, Session::getLocalUser());
                        if (!$contact_id) {
                                // User-specific contact URL/address search and probe
                                $contact_id = Contact::getIdForURL($search);
@@ -293,9 +293,9 @@ class Index extends BaseSearch
 
                $search = Network::convertToIdn($search);
 
-               if (local_user()) {
+               if (Session::getLocalUser()) {
                        // Post URL search
-                       $item_id = Item::fetchByLink($search, local_user());
+                       $item_id = Item::fetchByLink($search, Session::getLocalUser());
                        if (!$item_id) {
                                // If the user-specific search failed, we search and probe a public post
                                $item_id = Item::fetchByLink($search);