$frio = 'view/theme/frio';
// disable the events module link in the profile tab
- $a->theme_events_in_profile = false;
- $a->videowidth = 622;
+ $a->setThemeInfoValue('events_in_profile', false);
+ $a->setThemeInfoValue('videowidth', 622);
Renderer::setActiveTemplateEngine('smarty3');
* Some links will point to the local pages because the user would expect
* local page (these pages are: search, community, help, apps, directory).
*
- * @param App $a The App class
- * @param array $nav The original nav menu
+ * @param App $a The App class
+ * @param array $nav_info The original nav info array: nav, banner, userinfo, sitelocation
+ * @throws Exception
*/
-function frio_remote_nav($a, &$nav)
+function frio_remote_nav(App $a, array &$nav_info)
{
// get the homelink from $_XSESSION
$homelink = Model\Profile::getMyURL();
// since $userinfo isn't available for the hook we write it to the nav array
// this isn't optimal because the contact query will be done now twice
- $fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl'];
- if (local_user() && !empty($a->user['uid'])) {
- $remoteUser = Contact::selectFirst($fields, ['uid' => $a->user['uid'], 'self' => true]);
+ $fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated'];
+ if ($a->isLoggedIn()) {
+ $remoteUser = Contact::selectFirst($fields, ['uid' => $a->getLoggedInUserId(), 'self' => true]);
} elseif (!local_user() && remote_user()) {
$remoteUser = Contact::getById(remote_user(), $fields);
- $nav['remote'] = DI::l10n()->t('Guest');
+ $nav_info['nav']['remote'] = DI::l10n()->t('Guest');
} elseif (Model\Profile::getMyURL()) {
$remoteUser = Contact::getByURL($homelink, null, $fields);
- $nav['remote'] = DI::l10n()->t('Visitor');
+ $nav_info['nav']['remote'] = DI::l10n()->t('Visitor');
} else {
$remoteUser = null;
}
if (DBA::isResult($remoteUser)) {
- $nav['userinfo'] = [
+ $nav_info['userinfo'] = [
'icon' => Contact::getMicro($remoteUser),
'name' => $remoteUser['name'],
];
if (!local_user() && !empty($server_url) && !is_null($remoteUser)) {
// user menu
- $nav['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
- $nav['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
- $nav['usermenu'][] = [$server_url . '/photos/' . $remoteUser['nick'], DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
- $nav['usermenu'][] = [$server_url . '/videos/' . $remoteUser['nick'], DI::l10n()->t('Videos'), '', DI::l10n()->t('Your videos')];
- $nav['usermenu'][] = [$server_url . '/events/', DI::l10n()->t('Events'), '', DI::l10n()->t('Your events')];
+ $nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
+ $nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
+ $nav_info['nav']['usermenu'][] = [$server_url . '/photos/' . $remoteUser['nick'], DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
+ $nav_info['nav']['usermenu'][] = [$server_url . '/videos/' . $remoteUser['nick'], DI::l10n()->t('Videos'), '', DI::l10n()->t('Your videos')];
+ $nav_info['nav']['usermenu'][] = [$server_url . '/events/', DI::l10n()->t('Events'), '', DI::l10n()->t('Your events')];
// navbar links
- $nav['network'] = [$server_url . '/network', DI::l10n()->t('Network'), '', DI::l10n()->t('Conversations from your friends')];
- $nav['events'] = [$server_url . '/events', DI::l10n()->t('Events'), '', DI::l10n()->t('Events and Calendar')];
- $nav['messages'] = [$server_url . '/message', DI::l10n()->t('Messages'), '', DI::l10n()->t('Private mail')];
- $nav['settings'] = [$server_url . '/settings', DI::l10n()->t('Settings'), '', DI::l10n()->t('Account settings')];
- $nav['contacts'] = [$server_url . '/contact', DI::l10n()->t('Contacts'), '', DI::l10n()->t('Manage/edit friends and contacts')];
- $nav['sitename'] = DI::config()->get('config', 'sitename');
+ $nav_info['nav']['network'] = [$server_url . '/network', DI::l10n()->t('Network'), '', DI::l10n()->t('Conversations from your friends')];
+ $nav_info['nav']['events'] = [$server_url . '/events', DI::l10n()->t('Events'), '', DI::l10n()->t('Events and Calendar')];
+ $nav_info['nav']['messages'] = [$server_url . '/message', DI::l10n()->t('Messages'), '', DI::l10n()->t('Private mail')];
+ $nav_info['nav']['settings'] = [$server_url . '/settings', DI::l10n()->t('Settings'), '', DI::l10n()->t('Account settings')];
+ $nav_info['nav']['contacts'] = [$server_url . '/contact', DI::l10n()->t('Contacts'), '', DI::l10n()->t('Manage/edit friends and contacts')];
+ $nav_info['nav']['sitename'] = DI::config()->get('config', 'sitename');
}
}
$followThread = [];
if (
local_user()
- && local_user() == $arr['item']['uid']
+ && in_array($arr['item']['uid'], [0, local_user()])
&& $arr['item']['gravity'] == GRAVITY_PARENT
&& !$arr['item']['self']
&& !$arr['item']['mention']