diff options
author | Florian Pritz <bluewind@xinu.at> | 2015-02-15 11:11:49 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-02-15 11:11:49 +0100 |
commit | 45c16c802720faf9de6c3028ba41753c5edba974 (patch) | |
tree | e20148091cf0f9b6ff11efe65a76cfe1d1bad24c /application/helpers | |
parent | 9535ede862e01d834ebdd553184b1f6544b06d2c (diff) | |
parent | 01226a9afd760a920e9cb3377913ee296f0ab2ca (diff) |
Merge branch 'api-rework' into working
Diffstat (limited to 'application/helpers')
-rw-r--r-- | application/helpers/filebin_helper.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php index e5637ce94..a1b540b1d 100644 --- a/application/helpers/filebin_helper.php +++ b/application/helpers/filebin_helper.php @@ -235,6 +235,23 @@ function send_json_reply($array, $status = "success") $CI->output->set_output(json_encode($reply)); } +function send_json_error_reply($error_id, $message, $array = null, $status_code = 400) +{ + $reply = array(); + $reply["status"] = "error"; + $reply["error_id"] = $error_id; + $reply["message"] = $message; + + if ($array !== null) { + $reply["data"] = $array; + } + + $CI =& get_instance(); + $CI->output->set_status_header($status_code); + $CI->output->set_content_type('application/json'); + $CI->output->set_output(json_encode($reply)); +} + function static_storage($key, $value = null) { static $storage = array(); |