summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-30 11:07:01 -0700
committerBrion Vibber <brion@pobox.com>2010-03-30 11:10:29 -0700
commitca897ef346ef54952900879c3c845910bc5f54cb (patch)
tree459c4868163811d2f8c63a87c416cebaaaf51dd6 /actions
parent17f1ea703dc86ea0791cc9399cdce8d2dc88bfb0 (diff)
Quick fixes for grouplistall:
* respect count instead of listing all groups * respect page parameter * don't spew notice on undefined $id * don't spew notice on undefined $group->homepage_url (dropped the element since there's nothing to go in it)
Diffstat (limited to 'actions')
-rw-r--r--actions/apigrouplistall.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php
index e1b54a832..f7677970f 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;
@@ -137,11 +137,18 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
$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->query($qry);
+ $groups = array();
while ($group->fetch()) {
$groups[] = clone($group);
}