X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=actions%2Fapifriendshipscreate.php;h=9c410f379a08f648beb098ceb7e88564b0418989;hb=4cfd0d24c109f6485df05d8687aeb80f0bf8834b;hp=89557f8392f6ce1065dab16145c0461a099826bf;hpb=e36399974e6ccd1ee3e53bfffa3c34edaf8bd488;p=quix0rs-gnu-social.git diff --git a/actions/apifriendshipscreate.php b/actions/apifriendshipscreate.php index 89557f8392..9c410f379a 100644 --- a/actions/apifriendshipscreate.php +++ b/actions/apifriendshipscreate.php @@ -33,8 +33,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/apiauth.php'; - /** * Allows the authenticating users to follow (subscribe) the user specified in * the ID parameter. Returns the befriended user in the requested format when @@ -95,7 +93,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( - // TRANS: Client error displayed when trying to handle an unknown API method. + // TRANS: Client error displayed when coming across a non-supported API method. _('API method not found.'), 404, $this->format @@ -124,11 +122,10 @@ class ApiFriendshipsCreateAction extends ApiAuthAction return; } - $result = subs_subscribe_to($this->user, $this->other); - - if (is_string($result)) { - $this->clientError($result, 403, $this->format); - return; + try { + Subscription::start($this->user->getProfile(), $this->other); + } catch (Exception $e) { + $this->clientError($e->getMessage(), 403, $this->format); } $this->initDocument($this->format);