diff options
-rw-r--r-- | application/controllers/file.php | 4 | ||||
-rw-r--r-- | application/helpers/filebin_helper.php | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php index 2ff774c8a..630e550de 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -415,6 +415,10 @@ class File extends CI_Controller { ORDER BY date $order ", array($user))->result_array(); + if ($this->input->get("json") !== false) { + return send_json_reply($query); + } + foreach($query as $key => $item) { $query[$key]["filesize"] = format_bytes($item["filesize"]); if (is_cli_client()) { diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php index 394d55ba5..88bb290c4 100644 --- a/application/helpers/filebin_helper.php +++ b/application/helpers/filebin_helper.php @@ -323,4 +323,11 @@ function auth_driver_function_implemented($function) return $result[$function]; } +function send_json_reply($array) +{ + $CI =& get_instance(); + $CI->output->set_content_type('application/json'); + $CI->output->set_output(json_encode($array)); +} + # vim: set noet: |