X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FNav.php;h=335f81bf3d80f54216f7bb55618e371d324cff29;hb=6749b2c887552feef3a671c4063425b11a92014a;hp=30e4a1c0872df48f9bd3ca0bf2c433db2e2b6211;hpb=5dfee31108fc92a7abca5f99b8fdf1b34aec5dd5;p=friendica.git
diff --git a/src/Content/Nav.php b/src/Content/Nav.php
index 30e4a1c087..335f81bf3d 100644
--- a/src/Content/Nav.php
+++ b/src/Content/Nav.php
@@ -1,13 +1,28 @@
.
+ *
*/
+
namespace Friendica\Content;
use Friendica\App;
-use Friendica\Core\Config;
use Friendica\Core\Hook;
-use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Database\DBA;
@@ -75,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')
]);
@@ -106,7 +122,7 @@ class Nav
self::$app_menu = [];
//Don't populate apps_menu if apps are private
- $privateapps = Config::get('config', 'private_addons', false);
+ $privateapps = DI::config()->get('config', 'private_addons', false);
if (local_user() || !$privateapps) {
$arr = ['app_menu' => self::$app_menu];
@@ -155,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
@@ -181,13 +201,13 @@ class Nav
$nav['home'] = [$homelink, DI::l10n()->t('Home'), '', DI::l10n()->t('Home Page')];
}
- if (intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::OPEN && !Session::isAuthenticated()) {
+ if (intval(DI::config()->get('config', 'register_policy')) === \Friendica\Module\Register::OPEN && !Session::isAuthenticated()) {
$nav['register'] = ['register', DI::l10n()->t('Register'), '', DI::l10n()->t('Create an account')];
}
$help_url = 'help';
- if (!Config::get('system', 'hide_help')) {
+ if (!DI::config()->get('system', 'hide_help')) {
$nav['help'] = [$help_url, DI::l10n()->t('Help'), '', DI::l10n()->t('Help and documentation')];
}
@@ -195,7 +215,7 @@ class Nav
$nav['apps'] = ['apps', DI::l10n()->t('Apps'), '', DI::l10n()->t('Addon applications, utilities, games')];
}
- if (local_user() || !Config::get('system', 'local_search')) {
+ if (local_user() || !DI::config()->get('system', 'local_search')) {
$nav['search'] = ['search', DI::l10n()->t('Search'), '', DI::l10n()->t('Search site content')];
$nav['searchoption'] = [
@@ -204,22 +224,22 @@ class Nav
DI::l10n()->t('Contacts')
];
- if (Config::get('system', 'poco_local_search')) {
+ if (DI::config()->get('system', 'poco_local_search')) {
$nav['searchoption'][] = DI::l10n()->t('Forums');
}
}
$gdirpath = 'directory';
- if (strlen(Config::get('system', 'singleuser'))) {
- $gdir = Config::get('system', 'directory');
+ if (strlen(DI::config()->get('system', 'singleuser'))) {
+ $gdir = DI::config()->get('system', 'directory');
if (strlen($gdir)) {
$gdirpath = Profile::zrl($gdir, true);
}
}
- if ((local_user() || Config::get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) &&
- !(Config::get('system', 'community_page_style') == CP_NO_INTERNAL_COMMUNITY)) {
+ if ((local_user() || DI::config()->get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) &&
+ !(DI::config()->get('system', 'community_page_style') == CP_NO_INTERNAL_COMMUNITY)) {
$nav['community'] = ['community', DI::l10n()->t('Community'), '', DI::l10n()->t('Conversations on this and other servers')];
}
@@ -231,12 +251,12 @@ class Nav
$nav['about'] = ['friendica', DI::l10n()->t('Information'), '', DI::l10n()->t('Information about this friendica instance')];
- if (Config::get('system', 'tosdisplay')) {
+ if (DI::config()->get('system', 'tosdisplay')) {
$nav['tos'] = ['tos', DI::l10n()->t('Terms of Service'), '', DI::l10n()->t('Terms of Service of this Friendica instance')];
}
// 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')];
@@ -255,15 +275,11 @@ 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')];
- if (Feature::isEnabled(local_user(), 'multi_profiles')) {
- $nav['profiles'] = ['profiles', DI::l10n()->t('Profiles'), '', DI::l10n()->t('Manage/Edit Profiles')];
- }
-
$nav['contacts'] = ['contact', DI::l10n()->t('Contacts'), '', DI::l10n()->t('Manage/edit friends and contacts')];
}
@@ -275,7 +291,7 @@ class Nav
$nav['navigation'] = ['navigation/', DI::l10n()->t('Navigation'), '', DI::l10n()->t('Site map')];
// Provide a banner/logo/whatever
- $banner = Config::get('system', 'banner');
+ $banner = DI::config()->get('system', 'banner');
if (is_null($banner)) {
$banner = '
Friendica';
}