summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-09-15 12:59:32 -0700
committerZach Copley <zach@controlyourself.ca>2009-09-15 13:01:12 -0700
commit4081ed79b02fd06f7c347803478e1f835311c2ab (patch)
treedf8f6a8d927b6b439b1dbf3e089f170dcb204cff
parent5bad7040b14bf61d84cc33c8b4cf2af3b5861d3b (diff)
Make it impossible to delete self-subscriptions via the API
-rw-r--r--actions/twitapifriendships.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php
index f2ea46910..eea8945c3 100644
--- a/actions/twitapifriendships.php
+++ b/actions/twitapifriendships.php
@@ -99,6 +99,12 @@ class TwitapifriendshipsAction extends TwitterapiAction
$other = $this->get_profile($id);
$user = $apidata['user']; // Alwyas the auth user
+ if ($user->id == $other->id) {
+ $this->clientError(_("You cannot unfollow yourself!"),
+ 403, $apidata['content-type']);
+ return;
+ }
+
$sub = new Subscription();
$sub->subscriber = $user->id;
$sub->subscribed = $other->id;