]> git.mxchange.org Git - friendica.git/blobdiff - include/nav.php
Replace dba::select(limit => 1) by dba::selectOne
[friendica.git] / include / nav.php
index e2633be0af5eb3dc2ea18d3fa5b2dbc1f0b3a521..8f2f5dd70ba1a49d09fb0a1d74e95de00a666b55 100644 (file)
@@ -1,6 +1,12 @@
 <?php
-
+/**
+ * @file include/nav.php
+ */
 use Friendica\App;
+use Friendica\Content\Feature;
+use Friendica\Core\Config;
+use Friendica\Core\System;
+use Friendica\Database\DBM;
 
 function nav(App $a) {
 
@@ -10,7 +16,7 @@ function nav(App $a) {
         *
         */
 
-       if(!(x($a->page,'nav')))
+       if (!(x($a->page,'nav')))
                $a->page['nav'] = '';
 
        $a->page['htmlhead'] .= replace_macros(get_markup_template('nav_head.tpl'), array());
@@ -30,7 +36,7 @@ function nav(App $a) {
        $tpl = get_markup_template('nav.tpl');
 
        $a->page['nav'] .= replace_macros($tpl, array(
-               '$baseurl' => App::get_baseurl(),
+               '$baseurl' => System::baseUrl(),
                '$sitelocation' => $nav_info['sitelocation'],
                '$nav' => $nav_info['nav'],
                '$banner' => $nav_info['banner'],
@@ -67,7 +73,7 @@ function nav_info(App $a)
 
        $myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : '');
 
-       $sitelocation = $myident . substr(App::get_baseurl($ssl_state), strpos(App::get_baseurl($ssl_state), '//') + 2 );
+       $sitelocation = $myident . substr(System::baseUrl($ssl_state), strpos(System::baseUrl($ssl_state), '//') + 2 );
 
        // nav links: array of array('href', 'text', 'extra css classes', 'title')
        $nav = array();
@@ -88,9 +94,9 @@ function nav_info(App $a)
                $nav['usermenu'][] = array('notes/', t('Personal notes'), '', t('Your personal notes'));
 
                // user info
-               $r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self` = 1", intval($a->user['uid']));
+               $r = dba::selectOne('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
                $userinfo = array(
-                       'icon' => (dbm::is_result($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg'),
+                       'icon' => (DBM::is_result($r) ? $a->remove_baseurl($r['micro']) : 'images/person-48.jpg'),
                        'name' => $a->user['username'],
                );
        } else {
@@ -113,7 +119,7 @@ function nav_info(App $a)
 
        $help_url = 'help';
 
-       if (! get_config('system', 'hide_help')) {
+       if (!Config::get('system', 'hide_help')) {
                $nav['help'] = array($help_url, t('Help'), '', t('Help and documentation'));
        }
 
@@ -121,7 +127,7 @@ function nav_info(App $a)
                $nav['apps'] = array('apps', t('Apps'), '', t('Addon applications, utilities, games'));
        }
 
-       if (local_user() OR !get_config('system', 'local_search')) {
+       if (local_user() || !Config::get('system', 'local_search')) {
                $nav['search'] = array('search', t('Search'), '', t('Search site content'));
 
                $nav['searchoption'] = array(
@@ -129,22 +135,22 @@ function nav_info(App $a)
                                                t('Tags'),
                                                t('Contacts'));
 
-               if (get_config('system', 'poco_local_search')) {
+               if (Config::get('system', 'poco_local_search')) {
                        $nav['searchoption'][] = t('Forums');
                }
        }
 
        $gdirpath = 'directory';
 
-       if (strlen(get_config('system', 'singleuser'))) {
-               $gdir = get_config('system', 'directory');
-               if(strlen($gdir)) {
+       if (strlen(Config::get('system', 'singleuser'))) {
+               $gdir = Config::get('system', 'directory');
+               if (strlen($gdir)) {
                        $gdirpath = zrl($gdir, true);
                }
-       } elseif (get_config('system', 'community_page_style') == CP_USERS_ON_SERVER) {
-               $nav['community'] = array('community', t('Community'), '', t('Conversations on this site'));
-       } elseif (get_config('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()) {
@@ -187,7 +193,7 @@ function nav_info(App $a)
 
                $nav['settings'] = array('settings', t('Settings'), '', t('Account settings'));
 
-               if (feature_enabled(local_user(), 'multi_profiles')) {
+               if (Feature::isEnabled(local_user(), 'multi_profiles')) {
                        $nav['profiles'] = array('profiles', t('Profiles'), '', t('Manage/Edit Profiles'));
                }
 
@@ -202,9 +208,9 @@ function nav_info(App $a)
        $nav['navigation'] = array('navigation/', t('Navigation'), '', t('Site map'));
 
        // Provide a banner/logo/whatever
-       $banner = get_config('system', 'banner');
-       if ($banner === false) {
-               $banner = '<a href="http://friendica.com"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="http://friendica.com">Friendica</a></span>';
+       $banner = Config::get('system', 'banner');
+       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>';
        }
 
        call_hooks('nav_info', $nav);
@@ -224,6 +230,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,