X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Ffoafgroup.php;h=f9c61ac5dcda9f7a409917ec569fc82e59d84af9;hb=e06553b15b8a6cdc398562ea243a7368b10b373d;hp=f5fd7fe885e993adb4e2fa1fe64b468a3d6bdb81;hpb=b4b992bca77d34b8643910e8d590b5be7fede94b;p=quix0rs-gnu-social.git diff --git a/actions/foafgroup.php b/actions/foafgroup.php index f5fd7fe885..f9c61ac5dc 100644 --- a/actions/foafgroup.php +++ b/actions/foafgroup.php @@ -27,6 +27,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } +// @todo XXX: Documentation missing. class FoafGroupAction extends Action { function isReadOnly($args) @@ -41,8 +42,8 @@ class FoafGroupAction extends Action $nickname_arg = $this->arg('nickname'); if (empty($nickname_arg)) { + // TRANS: Client error displayed when requesting Friends of a Friend feed without providing a group nickname. $this->clientError(_('No such group.'), 404); - return false; } $this->nickname = common_canonical_nickname($nickname_arg); @@ -56,11 +57,18 @@ class FoafGroupAction extends Action return false; } - $this->group = User_group::staticGet('nickname', $this->nickname); + $local = Local_group::getKV('nickname', $this->nickname); + + if (!$local) { + // TRANS: Client error displayed when requesting Friends of a Friend feed for a non-local group. + $this->clientError(_('No such group.'), 404); + } + + $this->group = User_group::getKV('id', $local->group_id); if (!$this->group) { + // TRANS: Client error displayed when requesting Friends of a Friend feed for a nickname that is not a group. $this->clientError(_('No such group.'), 404); - return false; } common_set_returnto($this->selfUrl()); @@ -113,17 +121,18 @@ class FoafGroupAction extends Action if ($this->group->homepage_logo) { $this->element('depiction', array('rdf:resource' => $this->group->homepage_logo)); } - + $members = $this->group->getMembers(); $member_details = array(); while ($members->fetch()) { $member_uri = common_local_url('userbyid', array('id'=>$members->id)); $member_details[$member_uri] = array( - 'nickname' => $members->nickname + 'nickname' => $members->nickname, + 'is_admin' => false, ); $this->element('member', array('rdf:resource' => $member_uri)); } - + $admins = $this->group->getAdmins(); while ($admins->fetch()) { $admin_uri = common_local_url('userbyid', array('id'=>$admins->id)); @@ -132,14 +141,14 @@ class FoafGroupAction extends Action } $this->elementEnd('Group'); - + ksort($member_details); foreach ($member_details as $uri => $details) { if ($details['is_admin']) { $this->elementStart('Agent', array('rdf:about' => $uri)); $this->element('nick', null, $details['nickname']); - $this->elementStart('holdsAccount'); + $this->elementStart('account'); $this->elementStart('sioc:User', array('rdf:about'=>$uri.'#acct')); $this->elementStart('sioc:has_function'); $this->elementStart('statusnet:GroupAdminRole'); @@ -147,7 +156,7 @@ class FoafGroupAction extends Action $this->elementEnd('statusnet:GroupAdminRole'); $this->elementEnd('sioc:has_function'); $this->elementEnd('sioc:User'); - $this->elementEnd('holdsAccount'); + $this->elementEnd('account'); $this->elementEnd('Agent'); } else @@ -158,7 +167,7 @@ class FoafGroupAction extends Action )); } } - + $this->elementEnd('rdf:RDF'); $this->endXML(); } @@ -170,4 +179,4 @@ class FoafGroupAction extends Action $this->elementEnd('Document'); } -} \ No newline at end of file +}