X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapigrouplistall.php;h=f7677970f8e387442c49569c57e07c1ddbd318a2;hb=a21a17263956808e074fb62551300c5d6297387b;hp=1921c1f193f3396e4c5d42c2007515487b649280;hpb=02a6006bafd663443b512c5c283b64c7dacfbbb1;p=quix0rs-gnu-social.git diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php index 1921c1f193..f7677970f8 100644 --- a/actions/apigrouplistall.php +++ b/actions/apigrouplistall.php @@ -66,7 +66,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction { parent::prepare($args); - $this->user = $this->getTargetUser($id); + $this->user = $this->getTargetUser(null); $this->groups = $this->getGroups(); return true; @@ -88,7 +88,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction $sitename = common_config('site', 'name'); $title = sprintf(_("%s groups"), $sitename); - $taguribase = common_config('integration', 'taguri'); + $taguribase = TagURI::base(); $id = "tag:$taguribase:Groups"; $link = common_local_url('groups'); $subtitle = sprintf(_("groups on %s"), $sitename); @@ -134,14 +134,21 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction function getGroups() { - $groups = array(); - - // XXX: Use the $page, $count, $max_id, $since_id, and $since parameters - + $qry = 'SELECT user_group.* '. + 'from user_group join local_group on user_group.id = local_group.group_id '. + 'order by created desc '; + $offset = intval($this->page - 1) * intval($this->count); + $limit = intval($this->count); + if (common_config('db', 'type') == 'pgsql') { + $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; + } else { + $qry .= ' LIMIT ' . $offset . ', ' . $limit; + } $group = new User_group(); - $group->orderBy('created DESC'); - $group->find(); + $group->query($qry); + + $groups = array(); while ($group->fetch()) { $groups[] = clone($group); }