From cab7ea5faaa2f3510c8488e7d19d083fc05ac6ca Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Wed, 18 Sep 2013 04:17:27 -0400
Subject: [PATCH] - Fixed missing global $app in new _decode function

---
 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