summaryrefslogtreecommitdiff
path: root/actions/twitapifavorites.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/twitapifavorites.php
parentdec2f29c6a77dd97383ebdbabdc0bff8e524bfa4 (diff)
Twitter-compatible API - cleaned up sloppy control flow: exit() statements everywhere
darcs-hash:20081001025421-462f3-3bf666327de3a3c5ea506b2c387741dc3d0e82bf.gz
Diffstat (limited to 'actions/twitapifavorites.php')
-rw-r--r--actions/twitapifavorites.php17
1 files changed, 7 insertions, 10 deletions
diff --git a/actions/twitapifavorites.php b/actions/twitapifavorites.php
index d7d77907d..a327cddb4 100644
--- a/actions/twitapifavorites.php
+++ b/actions/twitapifavorites.php
@@ -66,7 +66,7 @@ class TwitapifavoritesAction extends TwitterapiAction {
if (!$profile) {
common_server_error(_('User has no profile.'));
- exit();
+ return;
}
$page = $this->arg('page');
@@ -83,7 +83,7 @@ class TwitapifavoritesAction extends TwitterapiAction {
if (!$notice) {
common_server_error(_('Could not retrieve favorite notices.'));
- exit();
+ return;
}
$sitename = common_config('site', 'name');
@@ -111,7 +111,6 @@ class TwitapifavoritesAction extends TwitterapiAction {
common_user_error(_('API method not found!'), $code = 404);
}
- exit();
}
function create($args, $apidata) {
@@ -119,14 +118,14 @@ class TwitapifavoritesAction extends TwitterapiAction {
if (!in_array($apidata['content-type'], array('xml', 'json'))) {
common_user_error(_('API method not found!'), $code = 404);
- exit;
+ return;
}
// Check for RESTfulness
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
// XXX: Twitter just prints the err msg, no XML / JSON.
$this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
- exit();
+ return;
}
$user = $apidata['user'];
@@ -135,13 +134,13 @@ class TwitapifavoritesAction extends TwitterapiAction {
if (!$notice) {
$this->client_error(_('No status found with that ID.'), 404, $apidata['content-type']);
- exit();
+ return;
}
// XXX: Twitter lets you fave things repeatedly via api.
if ($user->hasFave($notice)) {
$this->client_error(_('This notice is already a favorite!'), 403, $apidata['content-type']);
- exit();
+ return;
}
common_debug("notice: " . $apidata['api_arg']);
@@ -150,7 +149,7 @@ class TwitapifavoritesAction extends TwitterapiAction {
if (!$fave) {
common_server_error(_('Could not create favorite.'));
- exit();
+ return;
}
$this->notify($fave, $notice, $user);
@@ -162,13 +161,11 @@ class TwitapifavoritesAction extends TwitterapiAction {
$this->show_single_json_status($notice);
}
- exit();
}
function destroy($args, $apidata) {
parent::handle($args);
common_server_error(_('API method under construction.'), $code=501);
- exit();
}
// XXX: these two funcs swiped from faves. Maybe put in util.php, or some common base class?