X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapifriendshipscreate.php;h=1de2cc32e0ba906362e8f5832fa9497910649d5d;hb=2600ad9643cf4bcca291998379b1668f695f9a88;hp=d691b5b4f85666714dd872929b5b643c29eb5673;hpb=4ed8055f86d3e3c517a9e367607f60d595b77f37;p=quix0rs-gnu-social.git diff --git a/actions/apifriendshipscreate.php b/actions/apifriendshipscreate.php index d691b5b4f8..1de2cc32e0 100644 --- a/actions/apifriendshipscreate.php +++ b/actions/apifriendshipscreate.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/apiauth.php'; +require_once INSTALLDIR . '/lib/apiauth.php'; /** * Allows the authenticating users to follow (subscribe) the user specified in @@ -40,6 +42,8 @@ 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/ @@ -47,9 +51,6 @@ require_once INSTALLDIR.'/lib/apiauth.php'; class ApiFriendshipsCreateAction extends ApiAuthAction { - - var $format = null; - var $user = null; var $other = null; /** @@ -65,13 +66,6 @@ class ApiFriendshipsCreateAction extends ApiAuthAction { parent::prepare($args); - if ($this->requiresAuth()) { - if ($this->checkBasicAuthUser() == false) { - return; - } - } - - $this->format = $this->arg('format'); $this->user = $this->auth_user; $this->other = $this->getTargetUser($id); @@ -101,6 +95,15 @@ class ApiFriendshipsCreateAction extends ApiAuthAction return; } + if (!in_array($this->format, array('xml', 'json'))) { + $this->clientError( + _('API method not found.'), + 404, + $this->format + ); + return; + } + if (empty($this->other)) { $this->clientError( _('Could not follow user: User not found.'), @@ -126,9 +129,9 @@ 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); } }