<?php
-function nav(&$a) {
+function nav(App $a) {
/*
*
$tpl = get_markup_template('nav.tpl');
$a->page['nav'] .= replace_macros($tpl, array(
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => App::get_baseurl(),
'$sitelocation' => $nav_info['sitelocation'],
'$nav' => $nav_info['nav'],
'$banner' => $nav_info['banner'],
call_hooks('page_header', $a->page['nav']);
}
-
-function nav_info(&$a)
+/**
+ * @brief Prepares a list of navigation links
+ *
+ * @param App $a
+ * @return array Navigation links
+ * string 'sitelocation' => The webbie (username@site.com)
+ * array 'nav' => Array of links used in the nav menu
+ * string 'banner' => Formatted html link with banner image
+ * array 'userinfo' => Array of user information (name, icon)
+ */
+function nav_info(App $a)
{
$ssl_state = ((local_user()) ? true : false);
$myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : '');
- $sitelocation = $myident . substr($a->get_baseurl($ssl_state),strpos($a->get_baseurl($ssl_state),'//') + 2 );
+ $sitelocation = $myident . substr(App::get_baseurl($ssl_state), strpos(App::get_baseurl($ssl_state), '//') + 2 );
// nav links: array of array('href', 'text', 'extra css classes', 'title')
$nav = array();
// user info
$r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self` = 1", intval($a->user['uid']));
$userinfo = array(
- 'icon' => (count($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg'),
+ 'icon' => (dbm::is_result($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg'),
'name' => $a->user['username'],
);
} else {
$nav['login'] = array('login', t('Login'), ($a->module == 'login' ? 'selected' : ''), t('Sign in'));
}
- // "Home" should also take you home from an authenticated remote profile connection
+ // "Home" should also take you home from an authenticated remote profile connection
$homelink = get_my_url();
if (! $homelink) {
$homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : '');
$nav['contacts'] = array('contacts', t('Contacts'), '', t('Manage/edit friends and contacts'));
}
+ // Show the link to the admin configuration page if user is admin
if (is_site_admin()) {
$nav['admin'] = array('admin/', t('Admin'), '', t('Site setup and configuration'));
}
// 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 = '<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>';
}
call_hooks('nav_info', $nav);
);
}
-
/**
* Set a menu item in navbar as selected
*