X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Ftwitapifriendships.php;h=3cc925c3690bcd2ef29c00961e70e93418b877fd;hb=adeb19f1f7a82b17cee85ade1ac06fcd48e0d4cb;hp=05c192ea6fc8bc46938c64d5a60b2dac2539a9bf;hpb=877eb138c4a793cb065e9575e4f31469caf86b36;p=quix0rs-gnu-social.git diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php index 05c192ea6f..3cc925c369 100644 --- a/actions/twitapifriendships.php +++ b/actions/twitapifriendships.php @@ -40,6 +40,11 @@ class TwitapifriendshipsAction extends TwitterapiAction { function create($args, $apidata) { parent::handle($args); + if ($_SERVER['REQUEST_METHOD'] != 'POST') { + $this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']); + exit(); + } + $id = $apidata['api_arg']; $other = $this->get_user($id); @@ -52,7 +57,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(); } @@ -67,7 +73,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(); } @@ -96,6 +103,12 @@ class TwitapifriendshipsAction extends TwitterapiAction { function destroy($args, $apidata) { parent::handle($args); + + if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) { + $this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']); + exit(); + } + $id = $apidata['api_arg']; # We can't subscribe to a remote person, but we can unsub