From 91a2c04a24c320df37ea980f11245eb4e086879e Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 21 Jul 2010 21:30:13 -0700 Subject: More patches as part of #1225. Change the 'core' modules to use the json::reply method to set the content type header and encode the response as a json object --- modules/comment/controllers/admin_manage_comments.php | 8 ++++---- modules/comment/controllers/comments.php | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'modules/comment/controllers') diff --git a/modules/comment/controllers/admin_manage_comments.php b/modules/comment/controllers/admin_manage_comments.php index bc1c9e64..e451791f 100644 --- a/modules/comment/controllers/admin_manage_comments.php +++ b/modules/comment/controllers/admin_manage_comments.php @@ -34,10 +34,10 @@ class Admin_Manage_Comments_Controller extends Admin_Controller { public function menu_labels() { $menu = $this->_menu($this->_counts()); - print json_encode(array((string) $menu->get("unpublished")->label, - (string) $menu->get("published")->label, - (string) $menu->get("spam")->label, - (string) $menu->get("deleted")->label)); + json::reply(array((string) $menu->get("unpublished")->label, + (string) $menu->get("published")->label, + (string) $menu->get("spam")->label, + (string) $menu->get("deleted")->label)); } public function queue($state) { diff --git a/modules/comment/controllers/comments.php b/modules/comment/controllers/comments.php index c42ad24e..8826469d 100644 --- a/modules/comment/controllers/comments.php +++ b/modules/comment/controllers/comments.php @@ -56,13 +56,12 @@ class Comments_Controller extends Controller { $view = new Theme_View("comment.html", "other", "comment-fragment"); $view->comment = $comment; - print json_encode( - array("result" => "success", - "view" => (string) $view, - "form" => (string) comment::get_add_form($item))); + json::reply(array("result" => "success", + "view" => (string) $view, + "form" => (string) comment::get_add_form($item))); } else { $form = comment::prefill_add_form($form); - print json_encode(array("result" => "error", "form" => (string) $form)); + json::reply(array("result" => "error", "form" => (string) $form)); } } -- cgit v1.2.3