aboutsummaryrefslogtreecommitdiffstats
path: root/files/ajax/autocomplete.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2011-09-23 22:22:59 +0200
committerBart Visscher <bartv@thisnet.nl>2011-09-25 22:19:28 +0200
commit17e631bc5e327514596ce8761fe7f93d414a8717 (patch)
treea2e6bed923a493988028adafaaebcab5b9bfbd39 /files/ajax/autocomplete.php
parentdbddec9160338818009ec7020cec5a2b298aae7e (diff)
downloadnextcloud-server-17e631bc5e327514596ce8761fe7f93d414a8717.tar.gz
nextcloud-server-17e631bc5e327514596ce8761fe7f93d414a8717.zip
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 'files/ajax/autocomplete.php')
-rw-r--r--files/ajax/autocomplete.php11
1 files changed, 2 insertions, 9 deletions
diff --git a/files/ajax/autocomplete.php b/files/ajax/autocomplete.php
index 183ee86c788..8d7a5b482bd 100644
--- a/files/ajax/autocomplete.php
+++ b/files/ajax/autocomplete.php
@@ -5,14 +5,7 @@
// Init owncloud
require_once('../../lib/base.php');
-// We send json data
-// header( "Content-Type: application/jsonrequest" );
-
-// Check if we are a user
-if( !OC_User::isLoggedIn()){
- echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
- exit();
-}
+OC_JSON::checkLoggedIn();
// Get data
$query = $_GET['term'];
@@ -58,6 +51,6 @@ if(OC_Filesystem::file_exists($base) and OC_Filesystem::is_dir($base)){
}
}
}
-echo json_encode($files);
+OC_JSON::encodedPrint($files);
?>