X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapisubscriptions.php;h=fc0a2638b6bdb50a88f898f5ed48ec06d98a69ed;hb=9d0ccbff01c1d861d152e30feeb2094f5a2742b4;hp=a952e20b8725de270e9bb26076a62f9edbddd95f;hpb=061af8fa06ccb98f667d1ee670da2dbb179d8b0e;p=quix0rs-gnu-social.git diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php index a952e20b87..fc0a2638b6 100644 --- a/actions/apisubscriptions.php +++ b/actions/apisubscriptions.php @@ -21,6 +21,8 @@ * * @category API * @package StatusNet + * @author Dan Moore + * @author Evan Prodromou * @author Zach Copley * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 @@ -31,7 +33,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/apibareauth.php'; +require_once INSTALLDIR . '/lib/apibareauth.php'; /** * This class outputs a list of profiles as Twitter-style user and status objects. @@ -40,11 +42,12 @@ require_once INSTALLDIR.'/lib/apibareauth.php'; * * @category API * @package StatusNet + * @author Dan Moore + * @author Evan Prodromou * @author Zach Copley * @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; @@ -58,9 +61,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -80,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; } @@ -98,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 trying to handle an unknown API method. + $this->clientError(_('API method not found.'), $code = 404); return; } @@ -124,7 +126,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return array Profiles */ - function getProfiles() { } @@ -136,7 +137,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -147,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)) { @@ -167,7 +166,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return string etag */ - function etag() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -177,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)) @@ -197,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, @@ -224,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; } @@ -235,7 +236,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return void */ - function showIds() { switch ($this->format) { @@ -254,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; } } - }