summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-02-03 11:12:01 +0100
committerFlorian Pritz <bluewind@xinu.at>2015-02-03 11:12:01 +0100
commit6816970229c6d0bd46ba46ecd70199c0687952da (patch)
tree93b24ece3ef8307070a16052cb7b24350696cd81
parente2c2740365b1f25beca1e174c8c5bda2950b7466 (diff)
api: handle json reply in api controller
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--application/controllers/api.php2
-rw-r--r--application/controllers/api/v1/file.php10
-rw-r--r--application/controllers/api/v1/user.php6
3 files changed, 9 insertions, 9 deletions
diff --git a/application/controllers/api.php b/application/controllers/api.php
index 490f59c2c..dc31f47d2 100644
--- a/application/controllers/api.php
+++ b/application/controllers/api.php
@@ -48,7 +48,7 @@ class Api extends MY_Controller {
if (!method_exists($c, $function)) {
throw new \exceptions\PublicApiException("api/unknown-function", "Unknown function requested");
}
- return $c->$function();
+ return send_json_reply($c->$function());
} catch (\exceptions\PublicApiException $e) {
return send_json_error_reply($e->get_error_id(), $e->getMessage(), $e->get_data());
}
diff --git a/application/controllers/api/v1/file.php b/application/controllers/api/v1/file.php
index 82060e420..3aafd4732 100644
--- a/application/controllers/api/v1/file.php
+++ b/application/controllers/api/v1/file.php
@@ -39,26 +39,26 @@ class file extends \controllers\api\api_controller {
$urls[] = site_url($id).'/';
}
- return send_json_reply(array(
+ return array(
"ids" => $ids,
"urls" => $urls,
- ));
+ );
}
public function get_config()
{
// TODO: return more fields?
- return send_json_reply(array(
+ return array(
"upload_max_size" => $this->config->item("upload_max_size"),
"max_files_per_request" => intval(ini_get("max_file_uploads")),
- ));
+ );
}
public function history()
{
$this->muser->require_access("apikey");
$history = \service\files::history($this->muser->get_userid());
- return send_json_reply($history);
+ return $history;
}
public function delete()
diff --git a/application/controllers/api/v1/user.php b/application/controllers/api/v1/user.php
index 39c833d86..e49b7c657 100644
--- a/application/controllers/api/v1/user.php
+++ b/application/controllers/api/v1/user.php
@@ -19,7 +19,7 @@ class user extends \controllers\api\api_controller {
public function apikeys()
{
$this->muser->require_access("full");
- return send_json_reply(\service\user::apikeys($this->muser->get_userid()));
+ return \service\user::apikeys($this->muser->get_userid());
}
public function create_apikey()
@@ -32,8 +32,8 @@ class user extends \controllers\api\api_controller {
$key = \service\user::create_apikey($userid, $comment, $access_level);
- return send_json_reply(array(
+ return array(
"new_key" => $key,
- ));
+ );
}
}