From a331611049f6541cf37f993fa3c29535d387f972 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 21 Jul 2010 08:15:21 -0700 Subject: Partial fix for #1225. Create a json reply helper that sets the content type to application/json and then json encodes the reply. --- modules/gallery/helpers/json.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 modules/gallery/helpers/json.php (limited to 'modules/gallery/helpers/json.php') diff --git a/modules/gallery/helpers/json.php b/modules/gallery/helpers/json.php new file mode 100644 index 00000000..5fcdc268 --- /dev/null +++ b/modules/gallery/helpers/json.php @@ -0,0 +1,34 @@ + Date: Sun, 1 Aug 2010 08:57:22 -0700 Subject: Specify the charset on the content type header --- modules/gallery/helpers/json.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/helpers/json.php') diff --git a/modules/gallery/helpers/json.php b/modules/gallery/helpers/json.php index 5fcdc268..bbd835e9 100644 --- a/modules/gallery/helpers/json.php +++ b/modules/gallery/helpers/json.php @@ -27,7 +27,7 @@ class json_Core { */ static function reply($message) { if (!headers_sent()) { - header("Content-Type: application/json"); + header("Content-Type: application/json; charset=" . Kohana::CHARSET); } print json_encode($message); } -- cgit v1.2.3 From bf7115cf5a732cea2d498971ec94d2ade3b2fcdd Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 1 Aug 2010 10:19:36 -0700 Subject: Write appropriate PHPdoc for json::reply. --- modules/gallery/helpers/json.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'modules/gallery/helpers/json.php') diff --git a/modules/gallery/helpers/json.php b/modules/gallery/helpers/json.php index bbd835e9..a39db27a 100644 --- a/modules/gallery/helpers/json.php +++ b/modules/gallery/helpers/json.php @@ -19,11 +19,10 @@ */ class json_Core { /** - * Does the active user have this permission on this item? + * JSON Encode a reply to the browser and set the content type to specify that it's a JSON + * payload. * - * @param string $perm_name - * @param Item_Model $item - * @return boolean + * @param mixed $message string or object to json encode and print */ static function reply($message) { if (!headers_sent()) { -- cgit v1.2.3