X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fpersonalgroupnav.php;h=06bd2474bb928292dd043496bc4ae436adc448f4;hb=3138fa0b4080c135f4e509992f3c5d7fd82538de;hp=3b3a87ff0d9d4ee4d84c3ce204846f27746cdcdb;hpb=5304373b0b5c9905b30c85b565c23246d377467b;p=quix0rs-gnu-social.git diff --git a/lib/personalgroupnav.php b/lib/personalgroupnav.php index 3b3a87ff0d..06bd2474bb 100644 --- a/lib/personalgroupnav.php +++ b/lib/personalgroupnav.php @@ -50,24 +50,27 @@ class PersonalGroupNav extends Menu * * @return void */ - function show() + public function show() { - $user = common_current_user(); + // FIXME: Legacy StatusNet behaviour was to do this, but really it should be the GroupNav + // of the targeted user! ($this->action->arg('nickname') + $target = Profile::current(); - if (empty($user)) { + if (!$target instanceof Profile) { throw new ServerException('Cannot show personal group navigation without a current user.'); } - $user_profile = $user->getProfile(); - $nickname = $user->nickname; - $name = $user_profile->getBestName(); + $nickname = $target->getNickname(); + $name = $target->getBestName(); + + $scoped = Profile::current(); $action = $this->actionName; $mine = ($this->action->arg('nickname') == $nickname); // @fixme kinda vague $this->out->elementStart('ul', array('class' => 'nav')); - if (Event::handle('StartPersonalGroupNav', array($this))) { + if (Event::handle('StartPersonalGroupNav', array($this, $target, $scoped))) { $this->out->menuItem(common_local_url('all', array('nickname' => $nickname)), // TRANS: Menu item in personal group navigation menu. @@ -92,45 +95,8 @@ class PersonalGroupNav extends Menu // TRANS: %s is a username. sprintf(_('Replies to %s'), $name), $mine && $action =='replies', 'nav_timeline_replies'); - $this->out->menuItem(common_local_url('showfavorites', array('nickname' => - $nickname)), - // TRANS: Menu item in personal group navigation menu. - _m('MENU','Favorites'), - // @todo i18n FIXME: Need to make this two messages. - // TRANS: Menu item title in personal group navigation menu. - // TRANS: %s is a username. - sprintf(_('%s\'s favorite notices'), - // TRANS: Replaces %s in '%s\'s favorite notices'. (Yes, we know we need to fix this.) - ($user_profile) ? $name : _m('FIXME','User')), - $mine && $action =='showfavorites', 'nav_timeline_favorites'); - $this->out->menuItem(common_local_url('peopletagsbyuser', array('nickname' => - $nickname)), - // TRANS: Menu item in personal group navigation menu. - _m('MENU','People tags'), - // @todo i18n FIXME: Need to make this two messages. - // TRANS: Menu item title in personal group navigation menu. - // TRANS: %s is a username. - sprintf(_('People tags by %s'), - // TRANS: Replaces %s in 'People tags by %s'. (Yes, we know we need to fix this.) - ($user_profile) ? $name : _('User')), - in_array($action, array('peopletagsbyuser', 'peopletagsforuser')), - 'nav_timeline_peopletags'); - - $cur = common_current_user(); - - if ($cur && $cur->id == $user->id && - !common_config('singleuser', 'enabled')) { - - $this->out->menuItem(common_local_url('inbox', array('nickname' => - $nickname)), - // TRANS: Menu item in personal group navigation menu. - _m('MENU','Messages'), - // TRANS: Menu item title in personal group navigation menu. - _('Your incoming messages'), - $mine && $action =='inbox'); - } - Event::handle('EndPersonalGroupNav', array($this)); + Event::handle('EndPersonalGroupNav', array($this, $target, $scoped)); } $this->out->elementEnd('ul'); }