diff options
author | Evan Prodromou <evan@status.net> | 2010-06-03 14:50:52 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-06-03 14:50:52 -0400 |
commit | 135b398d4bfd1d680c5ea3600337f79c113ed681 (patch) | |
tree | c3a253361491d0df0ee1854adda63acb104fb382 /actions | |
parent | a5de2152672f49ad95f114033ef6bf00ece9a0ab (diff) | |
parent | 4bbb259baf93780556db398f50a22b6f245071e4 (diff) |
Merge branch 'master' of gitorious.org:statusnet/mainline
Diffstat (limited to 'actions')
-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 + ); + } } /** |