]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Nav.php
Remove obsolete mod/lockview.php file
[friendica.git] / src / Content / Nav.php
index 3024fcaea1b627478687fcdb2e53275a9a105227..335f81bf3d80f54216f7bb55618e371d324cff29 100644 (file)
@@ -1,7 +1,24 @@
 <?php
 /**
- * @file src/Content/Nav.php
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  */
+
 namespace Friendica\Content;
 
 use Friendica\App;
@@ -73,6 +90,7 @@ class Nav
                        '$userinfo'     => $nav_info['userinfo'],
                        '$sel'          => self::$selected,
                        '$apps'         => self::getAppMenu(),
+                       '$home'         => DI::l10n()->t('Go back'),
                        '$clear_notifs' => DI::l10n()->t('Clear notifications'),
                        '$search_hint'  => DI::l10n()->t('@name, !forum, #tags, content')
                ]);
@@ -153,20 +171,24 @@ class Nav
                }
 
                if (local_user()) {
-                       // user menu
-                       $nav['usermenu'][] = ['profile/' . $a->user['nickname'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
-                       $nav['usermenu'][] = ['profile/' . $a->user['nickname'] . '?tab=profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
-                       $nav['usermenu'][] = ['photos/' . $a->user['nickname'], DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
-                       $nav['usermenu'][] = ['videos/' . $a->user['nickname'], DI::l10n()->t('Videos'), '', DI::l10n()->t('Your videos')];
-                       $nav['usermenu'][] = ['events/', DI::l10n()->t('Events'), '', DI::l10n()->t('Your events')];
-                       $nav['usermenu'][] = ['notes/', DI::l10n()->t('Personal notes'), '', DI::l10n()->t('Your personal notes')];
-
-                       // user info
-                       $contact = DBA::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
-                       $userinfo = [
-                               'icon' => (DBA::isResult($contact) ? DI::baseUrl()->remove($contact['micro']) : 'images/person-48.jpg'),
-                               'name' => $a->user['username'],
-                       ];
+                       if (!empty($a->user)) {
+                               // user menu
+                               $nav['usermenu'][] = ['profile/' . $a->user['nickname'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
+                               $nav['usermenu'][] = ['profile/' . $a->user['nickname'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
+                               $nav['usermenu'][] = ['photos/' . $a->user['nickname'], DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
+                               $nav['usermenu'][] = ['videos/' . $a->user['nickname'], DI::l10n()->t('Videos'), '', DI::l10n()->t('Your videos')];
+                               $nav['usermenu'][] = ['events/', DI::l10n()->t('Events'), '', DI::l10n()->t('Your events')];
+                               $nav['usermenu'][] = ['notes/', DI::l10n()->t('Personal notes'), '', DI::l10n()->t('Your personal notes')];
+
+                               // user info
+                               $contact = DBA::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
+                               $userinfo = [
+                                       'icon' => (DBA::isResult($contact) ? DI::baseUrl()->remove($contact['micro']) : 'images/person-48.jpg'),
+                                       'name' => $a->user['username'],
+                               ];
+                       } else {
+                               DI::logger()->warning('Empty $a->user for local user', ['local_user' => local_user(), '$a' => $a]);
+                       }
                }
 
                // "Home" should also take you home from an authenticated remote profile connection
@@ -234,7 +256,7 @@ class Nav
                }
 
                // The following nav links are only show to logged in users
-               if (local_user()) {
+               if (local_user() && !empty($a->user)) {
                        $nav['network'] = ['network', DI::l10n()->t('Network'), '', DI::l10n()->t('Conversations from your friends')];
 
                        $nav['home'] = ['profile/' . $a->user['nickname'], DI::l10n()->t('Home'), '', DI::l10n()->t('Your posts and conversations')];
@@ -253,7 +275,7 @@ class Nav
                        $nav['messages']['new'] = ['message/new', DI::l10n()->t('New Message'), '', DI::l10n()->t('New Message')];
 
                        if (is_array($a->identities) && count($a->identities) > 1) {
-                               $nav['delegation'] = ['delegation', DI::l10n()->t('Delegation'), '', DI::l10n()->t('Manage other pages')];
+                               $nav['delegation'] = ['delegation', DI::l10n()->t('Accounts'), '', DI::l10n()->t('Manage other pages')];
                        }
 
                        $nav['settings'] = ['settings', DI::l10n()->t('Settings'), '', DI::l10n()->t('Account settings')];