From e372dd6925058eddf34e5b2b5ca59a5707befb37 Mon Sep 17 00:00:00 2001 From: mcramer <m.cramer@pixcept.de> Date: Fri, 11 Oct 2013 02:58:52 -0400 Subject: [PATCH] Implemented: - javascript hooks prepared (onAfterContentLoad is first available hook) - new abstract class for GET and POST requests - new js.d directory that is included into main template --- interface/lib/classes/json_handler.inc.php | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/interface/lib/classes/json_handler.inc.php b/interface/lib/classes/json_handler.inc.php index d2acb22..9f34522 100644 --- a/interface/lib/classes/json_handler.inc.php +++ b/interface/lib/classes/json_handler.inc.php @@ -74,14 +74,19 @@ $ret->code = $code; $ret->message = $message; $ret->response = $data; - header('Content-Type: application/x-json; charset="utf-8"'); + + header('Content-Type: application/json; charset="utf-8"'); print json_encode($ret); exit; } public function run() { - $method = reset(array_keys($_GET)); + if(!isset($_GET) || !is_array($_GET) || count($_GET) < 1) { + $this->_return_json('invalid_method', 'Method not provided in json call'); + } + $keys = array_keys($_GET); + $method = reset($keys); $params = array(); if(is_array($_POST)) { -- Gitblit v1.9.1