X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Ftwitapifriendships.php;h=ae15d171e7c95e0233b2f26a0bc5484f477934b8;hb=e440b9cea02549032ba4f79c43964219dea23d82;hp=19617a071bf07f96a5ec420dc53bc6324d96ee81;hpb=93ac0bcae3a600733045ad7a5bafabcdfd49d9e5;p=quix0rs-gnu-social.git diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php index 19617a071b..ae15d171e7 100644 --- a/actions/twitapifriendships.php +++ b/actions/twitapifriendships.php @@ -23,6 +23,20 @@ require_once(INSTALLDIR.'/lib/twitterapi.php'); class TwitapifriendshipsAction extends TwitterapiAction { + function is_readonly() { + + static $write_methods = array( 'create', + 'destroy'); + + $cmdtext = explode('.', $this->arg('method')); + + if (in_array($cmdtext[0], $write_methods)) { + return false; + } + + return true; + } + function create($args, $apidata) { parent::handle($args); @@ -38,7 +52,8 @@ class TwitapifriendshipsAction extends TwitterapiAction { $user = $apidata['user']; if ($user->isSubscribed($other)) { - $this->client_error("Could not follow user: $other->nickname is already on your list.", 403, $apidata['content-type']); + $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname); + $this->client_error($errmsg, 403, $apidata['content-type']); exit(); } @@ -53,7 +68,8 @@ class TwitapifriendshipsAction extends TwitterapiAction { $result = $sub->insert(); if (!$result) { - $this->client_error("Could not follow user: $other->nickname.", 400, $apidata['content-type']); + $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname); + $this->client_error($errmsg, 400, $apidata['content-type']); exit(); } @@ -129,8 +145,8 @@ class TwitapifriendshipsAction extends TwitterapiAction { $user_a_id = $this->trimmed('user_a'); $user_b_id = $this->trimmed('user_b'); - $user_a = $this->get_profile($user_a_id); - $user_b = $this->get_profile($user_b_id); + $user_a = $this->get_user($user_a_id); + $user_b = $this->get_user($user_b_id); if (!$user_a || !$user_b) { $this->client_error(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']);