]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Nav.php
Added post update to remove duplicated contacts
[friendica.git] / src / Content / Nav.php
index b72f4dc043217e5961e82b2edc9ff0a9995b9aa3..ea5c0bbc05230c77984392b5171f1f2846383825 100644 (file)
@@ -9,6 +9,7 @@ use Friendica\Core\Config;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
+use Friendica\Core\Session;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Model\Profile;
@@ -67,7 +68,6 @@ class Nav
                $tpl = Renderer::getMarkupTemplate('nav.tpl');
 
                $nav .= Renderer::replaceMacros($tpl, [
-                       '$baseurl'      => System::baseUrl(),
                        '$sitelocation' => $nav_info['sitelocation'],
                        '$nav'          => $nav_info['nav'],
                        '$banner'       => $nav_info['banner'],
@@ -149,9 +149,13 @@ class Nav
                $nav['usermenu'] = [];
                $userinfo = null;
 
-               if (local_user()) {
+               if (local_user() || remote_user()) {
                        $nav['logout'] = ['logout', L10n::t('Logout'), '', L10n::t('End this session')];
+               } else {
+                       $nav['login'] = ['login', L10n::t('Login'), ($a->module == 'login' ? 'selected' : ''), L10n::t('Sign in')];
+               }
 
+               if (local_user()) {
                        // user menu
                        $nav['usermenu'][] = ['profile/' . $a->user['nickname'], L10n::t('Status'), '', L10n::t('Your posts and conversations')];
                        $nav['usermenu'][] = ['profile/' . $a->user['nickname'] . '?tab=profile', L10n::t('Profile'), '', L10n::t('Your profile page')];
@@ -166,21 +170,19 @@ class Nav
                                'icon' => (DBA::isResult($contact) ? $a->removeBaseURL($contact['micro']) : 'images/person-48.jpg'),
                                'name' => $a->user['username'],
                        ];
-               } else {
-                       $nav['login'] = ['login', L10n::t('Login'), ($a->module == 'login' ? 'selected' : ''), L10n::t('Sign in')];
                }
 
                // "Home" should also take you home from an authenticated remote profile connection
                $homelink = Profile::getMyURL();
                if (! $homelink) {
-                       $homelink = defaults($_SESSION, 'visitor_home', '');
+                       $homelink = Session::get('visitor_home', '');
                }
 
                if (($a->module != 'home') && (! (local_user()))) {
                        $nav['home'] = [$homelink, L10n::t('Home'), '', L10n::t('Home Page')];
                }
 
-               if (intval(Config::get('config', 'register_policy')) === REGISTER_OPEN && !local_user() && !remote_user()) {
+               if (intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::OPEN && !local_user() && !remote_user()) {
                        $nav['register'] = ['register', L10n::t('Register'), '', L10n::t('Create an account')];
                }
 
@@ -242,7 +244,7 @@ class Nav
                        $nav['home'] = ['profile/' . $a->user['nickname'], L10n::t('Home'), '', L10n::t('Your posts and conversations')];
 
                        // Don't show notifications for public communities
-                       if (defaults($_SESSION, 'page_flags', '') != User::PAGE_FLAGS_COMMUNITY) {
+                       if (Session::get('page_flags', '') != User::PAGE_FLAGS_COMMUNITY) {
                                $nav['introductions'] = ['notifications/intros', L10n::t('Introductions'), '', L10n::t('Friend Requests')];
                                $nav['notifications'] = ['notifications',       L10n::t('Notifications'), '', L10n::t('Notifications')];
                                $nav['notifications']['all'] = ['notifications/system', L10n::t('See all notifications'), '', ''];