]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apigrouplistall.php
Document messages for which clarification was requested.
[quix0rs-gnu-social.git] / actions / apigrouplistall.php
index e1b54a83229ae1bcf985444d8ceebde0b572ace1..bd05fa3ea880712a1c1061af5d7039d0730bbbd4 100644 (file)
@@ -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;
@@ -87,6 +87,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
         parent::handle($args);
 
         $sitename   = common_config('site', 'name');
+        // TRANS: Message is used as a title. %s is a site name.
         $title      = sprintf(_("%s groups"), $sitename);
         $taguribase = TagURI::base();
         $id         = "tag:$taguribase:Groups";
@@ -137,11 +138,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);
         }