X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapigrouplistall.php;h=cc7cd901dcfe052c1307e20c061a3a6205758b92;hb=aa80d8fee3865e25e8d47a5c83b6575ca3dc79ea;hp=e1b54a83229ae1bcf985444d8ceebde0b572ace1;hpb=6781f95c733ed4d678fc4c09926efe195e590359;p=quix0rs-gnu-social.git diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php index e1b54a8322..cc7cd901dc 100644 --- a/actions/apigrouplistall.php +++ b/actions/apigrouplistall.php @@ -26,6 +26,7 @@ * @author Jeffery To * @author Zach Copley * @copyright 2009 StatusNet, Inc. + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -66,7 +67,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 +88,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 +139,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); } @@ -195,6 +204,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), strtotime($this->groups[0]->created), strtotime($this->groups[$last]->created))