diff options
author | Brion Vibber <brion@pobox.com> | 2010-06-11 12:05:53 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-06-11 12:05:53 -0700 |
commit | 7f3b3620af2af88ced37da1d9f8913cfd1a31b90 (patch) | |
tree | 13f137c377c3dfebbb2e749866e958ede08c2d24 /actions/apistatusesdestroy.php | |
parent | e81f17e911f59c5ba68fddefd318ea6caf25924c (diff) | |
parent | 47665e845ae74e6ee5b9a39565fb45dd9a93f921 (diff) |
Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x
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 8d9469063..0dfeb4812 100644 --- a/actions/apistatusesdestroy.php +++ b/actions/apistatusesdestroy.php @@ -100,32 +100,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 + ); + } } /** |