diff options
Diffstat (limited to 'application/core')
-rw-r--r-- | application/core/MY_Controller.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php index 278768ad2..3ee63424a 100644 --- a/application/core/MY_Controller.php +++ b/application/core/MY_Controller.php @@ -11,7 +11,7 @@ class MY_Controller extends CI_Controller { public $data = array(); public $var; - private $json_enabled_functions = array( + protected $json_enabled_functions = array( ); function __construct() @@ -31,6 +31,16 @@ class MY_Controller extends CI_Controller { mb_internal_encoding('UTF-8'); $this->load->helper(array('form', 'filebin')); + if (isset($_SERVER["HTTP_ACCEPT"])) { + if ($_SERVER["HTTP_ACCEPT"] == "application/json") { + request_type("json"); + } + } + + if (request_type() == "json" && ! in_array($this->uri->rsegment(2), $this->json_enabled_functions)) { + show_error("Function not JSON enabled"); + } + $this->data['title'] = "FileBin"; } } |