From cade8e25e767a8fb2b4581badada0f24a505215a Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 27 Aug 2013 10:40:50 +0200 Subject: user_logged_in(): always load muser Signed-off-by: Florian Pritz --- application/helpers/filebin_helper.php | 1 + 1 file changed, 1 insertion(+) (limited to 'application/helpers/filebin_helper.php') diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php index 4af106a14..57f7bdc65 100644 --- a/application/helpers/filebin_helper.php +++ b/application/helpers/filebin_helper.php @@ -326,6 +326,7 @@ function auth_driver_function_implemented($function) function user_logged_in() { $CI =& get_instance(); + $CI->load->model("muser"); return $CI->muser->logged_in(); } -- cgit v1.2.3-24-g4f1b From 84ce2c6ce0eb1b4f2f32c4ae0d7e08f3571f5018 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 14 Aug 2013 17:06:07 +0200 Subject: Provide json output for api functions Signed-off-by: Florian Pritz --- application/helpers/filebin_helper.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'application/helpers/filebin_helper.php') diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php index 57f7bdc65..9b124506f 100644 --- a/application/helpers/filebin_helper.php +++ b/application/helpers/filebin_helper.php @@ -330,11 +330,26 @@ function user_logged_in() return $CI->muser->logged_in(); } -function send_json_reply($array) +function send_json_reply($array, $status = "success") { + $reply = array(); + $reply["status"] = $status; + $reply["data"] = $array; + $CI =& get_instance(); $CI->output->set_content_type('application/json'); - $CI->output->set_output(json_encode($array)); + $CI->output->set_output(json_encode($reply)); +} + +function request_type($set_type = null) +{ + static $type = null; + + if ($set_type !== null) { + $type = $set_type; + } + + return $type; } # vim: set noet: -- cgit v1.2.3-24-g4f1b