X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapifriendshipsexists.php;h=43b1daf4fc62bd10975c5d002a052cdd870d9d0e;hb=d8d9edfc990a20f67421e40a7d3055a58697a002;hp=ca62b5f51420b81009d766bdebb30e6fd17d359d;hpb=84e7c7783c3a781b6dc12335371c984eca8e43d8;p=quix0rs-gnu-social.git diff --git a/actions/apifriendshipsexists.php b/actions/apifriendshipsexists.php index ca62b5f514..43b1daf4fc 100644 --- a/actions/apifriendshipsexists.php +++ b/actions/apifriendshipsexists.php @@ -24,7 +24,7 @@ * @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/ */ @@ -47,11 +47,10 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiFriendshipsExistsAction extends ApiPrivateAuthAction { - var $user_a = null; - var $user_b = null; + var $profile_a = null; + var $profile_b = null; /** * Take arguments for running @@ -59,18 +58,13 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); - $user_a_id = $this->trimmed('user_a'); - $user_b_id = $this->trimmed('user_b'); - - $this->user_a = $this->getTargetUser($user_a_id); - $this->user_b = $this->getTargetUser($user_b_id); + $this->profile_a = $this->getTargetProfile($this->trimmed('user_a')); + $this->profile_b = $this->getTargetProfile($this->trimmed('user_b')); return true; } @@ -84,21 +78,21 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); - if (empty($this->user_a) || empty($this->user_b)) { + if (empty($this->profile_a) || empty($this->profile_b)) { $this->clientError( - _('Two user ids or screen_names must be supplied.'), + // 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 ); return; } - $result = $this->user_a->isSubscribed($this->user_b); + $result = Subscription::exists($this->profile_a, $this->profile_b); switch ($this->format) { case 'xml': @@ -125,10 +119,8 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; } - }