summaryrefslogtreecommitdiffstats
path: root/apps/gallery/ajax/getAlbums.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gallery/ajax/getAlbums.php')
-rw-r--r--apps/gallery/ajax/getAlbums.php9
1 files changed, 3 insertions, 6 deletions
diff --git a/apps/gallery/ajax/getAlbums.php b/apps/gallery/ajax/getAlbums.php
index 2829dae81f3..38bea74636f 100644
--- a/apps/gallery/ajax/getAlbums.php
+++ b/apps/gallery/ajax/getAlbums.php
@@ -1,10 +1,7 @@
<?php
require_once('../../../lib/base.php');
-
-if (!OC_User::IsLoggedIn()) {
- echo json_encode(array('status' => 'error', 'message' => 'You need to log in'));
- exit();
-}
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
$a = array();
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ?');
@@ -17,6 +14,6 @@ while ($r = $result->fetchRow()) {
$a[] = array('name' => $album_name, 'numOfItems' => min($tmp_res->numRows(), 10));
}
-echo json_encode(array('status'=>'success', 'albums'=>$a));
+OC_JSON::success(array('albums'=>$a));
?>