diff --git a/actions/apifriendshipscreate.php b/actions/apifriendshipscreate.php index 873883c651..e7caf96869 100644 --- a/actions/apifriendshipscreate.php +++ b/actions/apifriendshipscreate.php @@ -29,9 +29,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * Allows the authenticating users to follow (subscribe) the user specified in @@ -90,7 +88,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction $this->clientError(_('Could not follow user: profile not found.'), 403); } - if ($this->user->isSubscribed($this->other)) { + if ($this->scoped->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. @@ -101,7 +99,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction } try { - Subscription::start($this->user->getProfile(), $this->other); + Subscription::start($this->scoped, $this->other); } catch (Exception $e) { $this->clientError($e->getMessage(), 403); } diff --git a/actions/apifriendshipsexists.php b/actions/apifriendshipsexists.php index 1f76e00b1a..4bb771292d 100644 --- a/actions/apifriendshipsexists.php +++ b/actions/apifriendshipsexists.php @@ -29,9 +29,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * Tests for the existence of friendship between two users. Will return true if @@ -57,7 +55,7 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction * * @return boolean success flag */ - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); @@ -72,22 +70,18 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction * * Check the format and show the user info * - * @param array $args $_REQUEST data (unused) - * * @return void */ - function handle($args) + protected function handle() { - parent::handle($args); + parent::handle(); if (empty($this->profile_a) || empty($this->profile_b)) { $this->clientError( // TRANS: Client error displayed when supplying invalid parameters to an API call checking if a friendship exists. _('Two valid IDs or nick names must be supplied.'), - 400, - $this->format + 400 ); - return; } $result = Subscription::exists($this->profile_a, $this->profile_b); diff --git a/actions/apifriendshipsshow.php b/actions/apifriendshipsshow.php index 5810e14874..c08e984b9a 100644 --- a/actions/apifriendshipsshow.php +++ b/actions/apifriendshipsshow.php @@ -29,9 +29,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * Outputs detailed information about the relationship between two users @@ -56,7 +54,7 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction * * @return boolean success flag */ - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); @@ -109,13 +107,11 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction * * Check the format and show the user info * - * @param array $args $_REQUEST data (unused) - * * @return void */ - function handle($args) + protected function handle() { - parent::handle($args); + parent::handle(); if (!in_array($this->format, array('xml', 'json'))) { // TRANS: Client error displayed when coming across a non-supported API method.