diff options
| author | Jozef Selesi <jozefs@users.sourceforge.net> | 2008-11-20 01:25:29 +0000 |
|---|---|---|
| committer | Jozef Selesi <jozefs@users.sourceforge.net> | 2008-11-20 01:25:29 +0000 |
| commit | c3fc1cb7ec91783a7953486c8a83aa8008dd5406 (patch) | |
| tree | 15aec3f9705edbe2c33db5d3a0b78c50860b0160 /modules/comment/controllers/comments.php | |
| parent | bd76b2e89f0caa2773e62192ef5d3b769c8ed6f8 (diff) | |
* Added HTTP status constants and helper functions to REST helper.
* HTTP header setting in comment module now going through REST helper API.
* Fixed items controller test.
* Fixed user installer test.
* Fixed _create() handling in the REST controller.
* Fixed routing for edit and add forms.
* Added some tests for the REST controller.
* Set svn:eol-style to LF on a bunch of files.
* Added preamble to MY_Forge.php.
Diffstat (limited to 'modules/comment/controllers/comments.php')
| -rw-r--r-- | modules/comment/controllers/comments.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/comment/controllers/comments.php b/modules/comment/controllers/comments.php index 11a9c2a1..511a8eda 100644 --- a/modules/comment/controllers/comments.php +++ b/modules/comment/controllers/comments.php @@ -29,7 +29,7 @@ class Comments_Controller extends REST_Controller { if (empty($item_id)) { /* We currently do not support getting all comments from the entire gallery. */ - header("HTTP/1.1 400 Bad Request"); + rest::http_status(rest::BAD_REQUEST); return; } print comment::get_comments($item_id); @@ -49,8 +49,8 @@ class Comments_Controller extends REST_Controller { $comment->item_id = $this->input->post('item_id'); $comment->save(); - header("HTTP/1.1 201 Created"); - header("Location: " . url::site("comments/{$comment->id}")); + rest::http_status(rest::CREATED); + rest::http_location(url::site("comments/{$comment->id}")); } // @todo Return appropriate HTTP status code indicating error. print $form; @@ -65,12 +65,12 @@ class Comments_Controller extends REST_Controller { $output_format = rest::output_format(); switch ($output_format) { case "xml": - header("Content-Type: application/xml"); + rest::http_content_type(rest::XML); print xml::to_xml($comment->as_array(), array("comment")); break; case "json": - header("Content-Type: application/json"); + rest::http_content_type(rest::JSON); print json_encode($comment->as_array()); break; @@ -103,7 +103,7 @@ class Comments_Controller extends REST_Controller { * @see Rest_Controller::_delete($resource) */ public function _delete($comment) { - throw new Exception("@todo Comment_Controller::_delete NOT IMPLEMENTED"); + rest::http_status(rest::METHOD_NOT_ALLOWED); } /** |
