diff options
author | Brion Vibber <brion@pobox.com> | 2010-06-07 10:34:00 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-06-07 10:34:00 -0700 |
commit | 5a96b9e8052361f8eddecc56decd68d4611ccc19 (patch) | |
tree | f4c312f25151ed824c78e5b70e0ffcfed5bb4ee2 /actions/apistatusesdestroy.php | |
parent | 41e9dba7297d43b7de0cb7665901869910d1047a (diff) | |
parent | 02c68ff5230e505dcfbb1dbd764415db8b8379ee (diff) |
Merge branch 'master' of gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'actions/apistatusesdestroy.php')
-rw-r--r-- | actions/apistatusesdestroy.php | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/actions/apistatusesdestroy.php b/actions/apistatusesdestroy.php index 0bfcdd060..749f72e68 100644 --- a/actions/apistatusesdestroy.php +++ b/actions/apistatusesdestroy.php @@ -99,32 +99,43 @@ class ApiStatusesDestroyAction extends ApiAuthAction parent::handle($args); if (!in_array($this->format, array('xml', 'json'))) { - $this->clientError(_('API method not found.'), $code = 404); - return; + $this->clientError( + _('API method not found.'), + 404 + ); + return; } - if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) { - $this->clientError(_('This method requires a POST or DELETE.'), - 400, $this->format); - return; - } - - if (empty($this->notice)) { - $this->clientError(_('No status found with that ID.'), - 404, $this->format); - return; - } - - if ($this->user->id == $this->notice->profile_id) { - $replies = new Reply; - $replies->get('notice_id', $this->notice_id); - $replies->delete(); - $this->notice->delete(); - $this->showNotice(); - } else { - $this->clientError(_('You may not delete another user\'s status.'), - 403, $this->format); - } + if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) { + $this->clientError( + _('This method requires a POST or DELETE.'), + 400, + $this->format + ); + return; + } + + if (empty($this->notice)) { + $this->clientError( + _('No status found with that ID.'), + 404, $this->format + ); + return; + } + + if ($this->user->id == $this->notice->profile_id) { + $replies = new Reply; + $replies->get('notice_id', $this->notice_id); + $replies->delete(); + $this->notice->delete(); + $this->showNotice(); + } else { + $this->clientError( + _('You may not delete another user\'s status.'), + 403, + $this->format + ); + } } /** |