Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2011-09-24 00:22:59 +0400
committerBart Visscher <bartv@thisnet.nl>2011-09-26 00:19:28 +0400
commit17e631bc5e327514596ce8761fe7f93d414a8717 (patch)
treea2e6bed923a493988028adafaaebcab5b9bfbd39 /apps/files_sharing
parentdbddec9160338818009ec7020cec5a2b298aae7e (diff)
Use OC_JSON for json responses
Create OC_JSON class, for single point of creating json responses. No real logic change, this just cleans up the code a bit.
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/ajax/getitem.php4
-rw-r--r--apps/files_sharing/ajax/userautocomplete.php8
2 files changed, 5 insertions, 7 deletions
diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php
index 249af6cfa31..e7bda0f6144 100644
--- a/apps/files_sharing/ajax/getitem.php
+++ b/apps/files_sharing/ajax/getitem.php
@@ -30,7 +30,7 @@ while ($source != "" && $source != "/" && $source != "." && $source != $userDire
$source = dirname($source);
}
if (!empty($users)) {
- echo json_encode($users);
+ OC_JSON::encodedPrint($users);
}
-?> \ No newline at end of file
+?>
diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php
index 6da7afb659c..a3158cf72d6 100644
--- a/apps/files_sharing/ajax/userautocomplete.php
+++ b/apps/files_sharing/ajax/userautocomplete.php
@@ -3,10 +3,8 @@ $RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
-if (!OC_User::isLoggedIn()) {
- echo json_encode(array("status" => "error", "data" => array("message" => "Authentication error")));
- exit();
-}
+OC_JSON::checkLoggedIn();
+
$users = array();
$ocusers = OC_User::getUsers();
$self = OC_User::getUser();
@@ -23,6 +21,6 @@ foreach ($groups as $group) {
$users[] = "<option value='".$group."'>".$group."</option>";
}
$users[] = "</optgroup>";
-echo json_encode($users);
+OC_JSON::encodedPrint($users);
?>