]> git.mxchange.org Git - friendica.git/blobdiff - include/nav.php
Merge pull request #4246 from zeroadam/Widget-#3878
[friendica.git] / include / nav.php
index 2de1a15606ee046e570c94cb509bf1766e5bee8b..5c2d6efa0edf431ba8627b93c538386a24a805b8 100644 (file)
@@ -3,10 +3,11 @@
  * @file include/nav.php
  */
 use Friendica\App;
-use Friendica\Content\Features;
+use Friendica\Content\Feature;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
+use Friendica\Model\Profile;
 
 function nav(App $a) {
 
@@ -94,9 +95,9 @@ function nav_info(App $a)
                $nav['usermenu'][] = array('notes/', t('Personal notes'), '', t('Your personal notes'));
 
                // user info
-               $r = dba::select('contact', array('micro'), array('uid' => $a->user['uid'], 'self' => true), array('limit' => 1));
+               $contact = dba::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
                $userinfo = array(
-                       'icon' => (DBM::is_result($r) ? $a->remove_baseurl($r['micro']) : 'images/person-48.jpg'),
+                       'icon' => (DBM::is_result($contact) ? $a->remove_baseurl($contact['micro']) : 'images/person-48.jpg'),
                        'name' => $a->user['username'],
                );
        } else {
@@ -104,9 +105,9 @@ function nav_info(App $a)
        }
 
        // "Home" should also take you home from an authenticated remote profile connection
-       $homelink = get_my_url();
+       $homelink = Profile::getMyURL();
        if (! $homelink) {
-               $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : '');
+               $homelink = ((x($_SESSION, 'visitor_home')) ? $_SESSION['visitor_home'] : '');
        }
 
        if (($a->module != 'home') && (! (local_user()))) {
@@ -145,12 +146,12 @@ function nav_info(App $a)
        if (strlen(Config::get('system', 'singleuser'))) {
                $gdir = Config::get('system', 'directory');
                if (strlen($gdir)) {
-                       $gdirpath = zrl($gdir, true);
+                       $gdirpath = Profile::zrl($gdir, true);
                }
-       } elseif (Config::get('system', 'community_page_style') == CP_USERS_ON_SERVER) {
-               $nav['community'] = array('community', t('Community'), '', t('Conversations on this site'));
-       } elseif (Config::get('system', 'community_page_style') == CP_GLOBAL_COMMUNITY) {
-               $nav['community'] = array('community', t('Community'), '', t('Conversations on the network'));
+       }
+
+       if (local_user() || Config::get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) {
+               $nav['community'] = array('community', t('Community'), '', t('Conversations on this and other servers'));
        }
 
        if (local_user()) {
@@ -193,7 +194,7 @@ function nav_info(App $a)
 
                $nav['settings'] = array('settings', t('Settings'), '', t('Account settings'));
 
-               if (Features::isEnabled(local_user(), 'multi_profiles')) {
+               if (Feature::isEnabled(local_user(), 'multi_profiles')) {
                        $nav['profiles'] = array('profiles', t('Profiles'), '', t('Manage/Edit Profiles'));
                }
 
@@ -209,7 +210,7 @@ function nav_info(App $a)
 
        // Provide a banner/logo/whatever
        $banner = Config::get('system', 'banner');
-       if ($banner === false) {
+       if (is_null($banner)) {
                $banner = '<a href="https://friendi.ca"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="https://friendi.ca">Friendica</a></span>';
        }
 
@@ -230,6 +231,7 @@ function nav_info(App $a)
 function nav_set_selected($item){
        $a = get_app();
        $a->nav_sel = array(
+               'global'        => null,
                'community'     => null,
                'network'       => null,
                'home'          => null,