summaryrefslogtreecommitdiff
path: root/actions/twitapifriendships.php
diff options
context:
space:
mode:
authorzach <zach@controlyourself.ca>2008-09-30 22:54:21 -0400
committerzach <zach@controlyourself.ca>2008-09-30 22:54:21 -0400
commit6beddfdbb926aaa5af42e68ff459f11e0e5f6b5f (patch)
tree9dfa00b3fa201ff6e0848f97a80ebb7bb02a7e0d /actions/twitapifriendships.php
parentdec2f29c6a77dd97383ebdbabdc0bff8e524bfa4 (diff)
Twitter-compatible API - cleaned up sloppy control flow: exit() statements everywhere
darcs-hash:20081001025421-462f3-3bf666327de3a3c5ea506b2c387741dc3d0e82bf.gz
Diffstat (limited to 'actions/twitapifriendships.php')
-rw-r--r--actions/twitapifriendships.php21
1 files changed, 10 insertions, 11 deletions
diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php
index f9ff251d6..01aa5fa36 100644
--- a/actions/twitapifriendships.php
+++ b/actions/twitapifriendships.php
@@ -42,7 +42,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
- exit();
+ return;
}
$id = $apidata['api_arg'];
@@ -51,7 +51,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
if (!$other) {
$this->client_error(_('Could not follow user: User not found.'), 403, $apidata['content-type']);
- exit();
+ return;
}
$user = $apidata['user'];
@@ -59,7 +59,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
if ($user->isSubscribed($other)) {
$errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
$this->client_error($errmsg, 403, $apidata['content-type']);
- exit();
+ return;
}
$sub = new Subscription();
@@ -75,7 +75,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
if (!$result) {
$errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
$this->client_error($errmsg, 400, $apidata['content-type']);
- exit();
+ return;
}
$sub->query('COMMIT');
@@ -86,7 +86,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
$this->init_document($type);
$this->show_profile($other, $type);
$this->end_document($type);
- exit();
+
}
//destroy
@@ -106,7 +106,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
$this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
- exit();
+ return;
}
$id = $apidata['api_arg'];
@@ -126,14 +126,14 @@ class TwitapifriendshipsAction extends TwitterapiAction {
$sub->query('COMMIT');
} else {
$this->client_error(_('You are not friends with the specified user.'), 403, $apidata['content-type']);
- exit();
+ return;
}
$type = $apidata['content-type'];
$this->init_document($type);
$this->show_profile($other, $type);
$this->end_document($type);
- exit();
+
}
// Tests if a friendship exists between two users.
@@ -154,7 +154,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
if (!in_array($apidata['content-type'], array('xml', 'json'))) {
common_user_error(_('API method not found!'), $code = 404);
- exit;
+ return;
}
$user_a_id = $this->trimmed('user_a');
@@ -165,7 +165,7 @@ class TwitapifriendshipsAction extends TwitterapiAction {
if (!$user_a || !$user_b) {
$this->client_error(_('Two user ids or screen_names must be supplied.'), 400, $apidata['content-type']);
- exit();
+ return;
}
if ($user_a->isSubscribed($user_b)) {
@@ -189,7 +189,6 @@ class TwitapifriendshipsAction extends TwitterapiAction {
break;
}
- exit();
}
} \ No newline at end of file