X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapifriendshipscreate.php;h=89557f8392f6ce1065dab16145c0461a099826bf;hb=26afe79ed9ec8d17de829ee724e2c5b33f44a658;hp=85eaf3a29659d56d400b06e0809cb9620ce4b9c5;hpb=743c844084bae75db02570d76694f4e9b79a9aa9;p=quix0rs-gnu-social.git diff --git a/actions/apifriendshipscreate.php b/actions/apifriendshipscreate.php index 85eaf3a296..89557f8392 100644 --- a/actions/apifriendshipscreate.php +++ b/actions/apifriendshipscreate.php @@ -21,8 +21,10 @@ * * @category API * @package StatusNet + * @author Dan Moore + * @author Evan Prodromou * @author Zach Copley - * @copyright 2009 StatusNet, Inc. + * @copyright 2009-2010 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/ */ @@ -31,7 +33,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/apiauth.php'; +require_once INSTALLDIR . '/lib/apiauth.php'; /** * Allows the authenticating users to follow (subscribe) the user specified in @@ -40,14 +42,14 @@ require_once INSTALLDIR.'/lib/apiauth.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 ApiFriendshipsCreateAction extends ApiAuthAction { - var $user = null; var $other = null; /** @@ -58,13 +60,12 @@ class ApiFriendshipsCreateAction extends ApiAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); $this->user = $this->auth_user; - $this->other = $this->getTargetUser($id); + $this->other = $this->getTargetProfile($this->arg('id')); return true; } @@ -78,13 +79,13 @@ class ApiFriendshipsCreateAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( + // TRANS: Client error. POST is a HTTP command. It should not be translated. _('This method requires a POST.'), 400, $this->format @@ -94,7 +95,8 @@ class ApiFriendshipsCreateAction extends ApiAuthAction if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( - _('API method not found!'), + // TRANS: Client error displayed when trying to handle an unknown API method. + _('API method not found.'), 404, $this->format ); @@ -103,7 +105,8 @@ class ApiFriendshipsCreateAction extends ApiAuthAction if (empty($this->other)) { $this->clientError( - _('Could not follow user: User not found.'), + // TRANS: Client error displayed when trying follow who's profile could not be found. + _('Could not follow user: profile not found.'), 403, $this->format ); @@ -112,6 +115,8 @@ class ApiFriendshipsCreateAction extends ApiAuthAction if ($this->user->isSubscribed($this->other)) { $errmsg = sprintf( + // TRANS: Client error displayed when trying to follow a user that's already being followed. + // TRANS: %s is the nickname of the user that is already being followed. _('Could not follow user: %s is already on your list.'), $this->other->nickname ); @@ -126,9 +131,8 @@ class ApiFriendshipsCreateAction extends ApiAuthAction return; } - $this->init_document($this->format); - $this->show_profile($this->other, $this->format); - $this->end_document($this->format); + $this->initDocument($this->format); + $this->showProfile($this->other, $this->format); + $this->endDocument($this->format); } - }