summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2013-08-29 18:01:24 +0200
committerFlorian Pritz <bluewind@xinu.at>2013-09-02 22:02:27 +0200
commit752c59413b4899b295a9359eaef98dc9efb01533 (patch)
tree6bffee4e0c90c18b02a6a5ef002c0ccdf957bf45 /application
parent5638bcbd816540ba1f20b75ccc1220f98028bbc3 (diff)
Add GET parameter for json output
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/core/MY_Controller.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php
index 09b813b71..4c0fa278c 100644
--- a/application/core/MY_Controller.php
+++ b/application/core/MY_Controller.php
@@ -32,12 +32,18 @@ class MY_Controller extends CI_Controller {
mb_internal_encoding('UTF-8');
$this->load->helper(array('form', 'filebin'));
+ // TODO: proper accept header handling or is this enough?
if (isset($_SERVER["HTTP_ACCEPT"])) {
if ($_SERVER["HTTP_ACCEPT"] == "application/json") {
request_type("json");
}
}
+ // Allow for easier testing in browser
+ if ($this->input->get("json") !== false) {
+ request_type("json");
+ }
+
if (request_type() == "json" && ! in_array($this->uri->rsegment(2), $this->json_enabled_functions)) {
show_error("Function not JSON enabled");
}