X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fpersonalgroupnav.php;h=8c413c6ab951e9c2943aa1796f17f687707c79ee;hb=b66ec247db709a73646f750759a8e4fed408b4d5;hp=812e7194ef004c7466257609472eb3dfce8d9259;hpb=4d61760154a53e39d1e0499d5fe7a4a586e7a9f0;p=quix0rs-gnu-social.git diff --git a/lib/personalgroupnav.php b/lib/personalgroupnav.php index 812e7194ef..8c413c6ab9 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,27 +95,9 @@ 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)), - _('People tags'), - sprintf(_('People tags by %s'), ($user_profile) ? $name : _('User')), - in_array($action, array('peopletagsbyuser', 'peopletagsforuser')), - 'nav_timeline_peopletags'); - $cur = common_current_user(); - if ($cur && $cur->id == $user->id && + if ($scoped instanceof Profile && $scoped->id == $target->id && !common_config('singleuser', 'enabled')) { $this->out->menuItem(common_local_url('inbox', array('nickname' => @@ -124,7 +109,7 @@ class PersonalGroupNav extends Menu $mine && $action =='inbox'); } - Event::handle('EndPersonalGroupNav', array($this)); + Event::handle('EndPersonalGroupNav', array($this, $target, $scoped)); } $this->out->elementEnd('ul'); }