2009-09-30 18:22:26 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* StatusNet, the distributed open-source microblogging tool
|
|
|
|
*
|
2009-09-30 18:30:06 +01:00
|
|
|
* Show a user's followers (subscribers)
|
2009-09-30 18:22:26 +01:00
|
|
|
*
|
|
|
|
* PHP version 5
|
|
|
|
*
|
|
|
|
* LICENCE: This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* @category API
|
|
|
|
* @package StatusNet
|
2009-10-13 00:36:00 +01:00
|
|
|
* @author Dan Moore <dan@moore.cx>
|
|
|
|
* @author Evan Prodromou <evan@status.net>
|
2009-09-30 18:22:26 +01:00
|
|
|
* @author Zach Copley <zach@status.net>
|
|
|
|
* @copyright 2009 StatusNet, Inc.
|
|
|
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
|
|
|
* @link http://status.net/
|
|
|
|
*/
|
|
|
|
|
2013-10-15 01:54:10 +01:00
|
|
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
2009-09-30 18:22:26 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Ouputs the authenticating user's followers (subscribers), each with
|
|
|
|
* current Twitter-style status inline. They are ordered by the order
|
|
|
|
* in which they subscribed to the user, 100 at a time.
|
|
|
|
*
|
|
|
|
* @category API
|
|
|
|
* @package StatusNet
|
2009-10-13 00:36:00 +01:00
|
|
|
* @author Dan Moore <dan@moore.cx>
|
|
|
|
* @author Evan Prodromou <evan@status.net>
|
2009-09-30 18:22:26 +01:00
|
|
|
* @author Zach Copley <zach@status.net>
|
|
|
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
|
|
|
* @link http://status.net/
|
|
|
|
*/
|
2009-10-02 02:19:59 +01:00
|
|
|
class ApiUserFollowersAction extends ApiSubscriptionsAction
|
2009-09-30 18:22:26 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Get the user's subscribers (followers) as an array of profiles
|
|
|
|
*
|
|
|
|
* @return array Profiles
|
|
|
|
*/
|
2013-10-15 01:54:10 +01:00
|
|
|
protected function getProfiles()
|
2009-09-30 18:22:26 +01:00
|
|
|
{
|
|
|
|
$offset = ($this->page - 1) * $this->count;
|
|
|
|
$limit = $this->count + 1;
|
|
|
|
|
|
|
|
$subs = null;
|
|
|
|
|
|
|
|
if (isset($this->tag)) {
|
2013-10-15 01:54:10 +01:00
|
|
|
$subs = $this->target->getTaggedSubscribers(
|
2009-09-30 18:22:26 +01:00
|
|
|
$this->tag, $offset, $limit
|
|
|
|
);
|
|
|
|
} else {
|
2013-10-15 01:54:10 +01:00
|
|
|
$subs = $this->target->getSubscribers(
|
2009-09-30 18:22:26 +01:00
|
|
|
$offset,
|
|
|
|
$limit
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$profiles = array();
|
|
|
|
|
2013-10-15 01:54:10 +01:00
|
|
|
while ($subs->fetch()) {
|
|
|
|
$profiles[] = clone($subs);
|
2009-09-30 18:22:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return $profiles;
|
|
|
|
}
|
|
|
|
}
|