X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapisubscriptions.php;h=84731ac00fff4a46bf471cca286f756247bbdd6e;hb=26a92b28014685ba477888a27a49195b8e077b75;hp=bc68dd192a64dfa8b6a5a991c162266bfc2a30ab;hpb=ce4ed6cca54134152c11baf8e0d0ff5b587b4998;p=quix0rs-gnu-social.git diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php index bc68dd192a..84731ac00f 100644 --- a/actions/apisubscriptions.php +++ b/actions/apisubscriptions.php @@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiSubscriptionsAction extends ApiBareAuthAction { var $profiles = null; @@ -62,9 +61,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -84,7 +81,8 @@ class ApiSubscriptionsAction extends ApiBareAuthAction $this->user = $this->getTargetUser($this->arg('id')); if (empty($this->user)) { - $this->clientError(_('No such user!'), 404, $this->format); + // TRANS: Client error displayed when requesting a list of followers for a non-existing user. + $this->clientError(_('No such user.'), 404, $this->format); return false; } @@ -102,13 +100,13 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); if (!in_array($this->format, array('xml', 'json'))) { - $this->clientError(_('API method not found!'), $code = 404); + // TRANS: Client error displayed when coming across a non-supported API method. + $this->clientError(_('API method not found.'), $code = 404); return; } @@ -128,7 +126,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return array Profiles */ - function getProfiles() { } @@ -140,7 +137,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -151,7 +147,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return string datestamp of the latest profile in the stream */ - function lastModified() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -171,7 +166,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return string etag */ - function etag() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -181,8 +175,10 @@ class ApiSubscriptionsAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, + // Caching tags. isset($this->ids_only) ? 'IDs' : 'Profiles', strtotime($this->profiles[0]->created), strtotime($this->profiles[$last]->created)) @@ -201,12 +197,12 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return void */ - function showProfiles($include_statuses = true) { switch ($this->format) { case 'xml': - $this->elementStart('users', array('type' => 'array')); + $this->elementStart('users', array('type' => 'array', + 'xmlns:statusnet' => 'http://status.net/schema/api/1/')); foreach ($this->profiles as $profile) { $this->showProfile( $profile, @@ -228,6 +224,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction print json_encode($arrays); break; default: + // TRANS: Client error displayed when requesting profiles of followers in an unsupported format. $this->clientError(_('Unsupported format.')); break; } @@ -239,7 +236,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return void */ - function showIds() { switch ($this->format) { @@ -258,9 +254,9 @@ class ApiSubscriptionsAction extends ApiBareAuthAction print json_encode($ids); break; default: + // TRANS: Client error displayed when requesting IDs of followers in an unsupported format. $this->clientError(_('Unsupported format.')); break; } } - }