summaryrefslogtreecommitdiffstats
path: root/apps/gallery/ajax
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2012-05-03 12:23:29 +0200
committerFrank Karlitschek <frank@owncloud.org>2012-05-03 12:23:29 +0200
commit43caa3b3b9cc9dbbf73ab2f6695a801a07a1dba5 (patch)
treef4b191f0d039cb7de942554ea23df3fff9de7ad6 /apps/gallery/ajax
parent375ba986452b190745b9388be92737d7e5771673 (diff)
downloadnextcloud-server-43caa3b3b9cc9dbbf73ab2f6695a801a07a1dba5.tar.gz
nextcloud-server-43caa3b3b9cc9dbbf73ab2f6695a801a07a1dba5.zip
ported oc_json
Diffstat (limited to 'apps/gallery/ajax')
-rwxr-xr-xapps/gallery/ajax/createAlbum.php6
-rwxr-xr-xapps/gallery/ajax/galleryOp.php28
-rwxr-xr-xapps/gallery/ajax/sharing.php6
-rwxr-xr-xapps/gallery/ajax/thumbnail.php4
4 files changed, 22 insertions, 22 deletions
diff --git a/apps/gallery/ajax/createAlbum.php b/apps/gallery/ajax/createAlbum.php
index eaf5c296de9..61e2e9ae2e9 100755
--- a/apps/gallery/ajax/createAlbum.php
+++ b/apps/gallery/ajax/createAlbum.php
@@ -22,11 +22,11 @@
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('gallery');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('gallery');
OC_Gallery_Album::create(OCP\USER::getUser(), $_GET['album_name']);
-OC_JSON::success(array('name' => $_GET['album_name']));
+OCP\JSON::success(array('name' => $_GET['album_name']));
?>
diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
index c302a3a734c..b9ca31901c3 100755
--- a/apps/gallery/ajax/galleryOp.php
+++ b/apps/gallery/ajax/galleryOp.php
@@ -24,8 +24,8 @@
header('Content-type: text/html; charset=UTF-8') ;
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('gallery');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('gallery');
function handleRename($oldname, $newname) {
OC_Gallery_Album::rename($oldname, $newname, OCP\USER::getUser());
@@ -61,16 +61,16 @@ function handleFilescan($cleanup) {
if ($cleanup) OC_Gallery_Album::cleanup();
$pathlist = OC_Gallery_Scanner::find_paths();
sort($pathlist);
- OC_JSON::success(array('paths' => $pathlist));
+ OCP\JSON::success(array('paths' => $pathlist));
}
function handleStoreSettings($root, $order) {
if (!OC_Filesystem::file_exists($root)) {
- OC_JSON::error(array('cause' => 'No such file or directory'));
+ OCP\JSON::error(array('cause' => 'No such file or directory'));
return;
}
if (!OC_Filesystem::is_dir($root)) {
- OC_JSON::error(array('cause' => $root . ' is not a directory'));
+ OCP\JSON::error(array('cause' => $root . ' is not a directory'));
return;
}
@@ -80,7 +80,7 @@ function handleStoreSettings($root, $order) {
$rescan = $current_root==$root?'no':'yes';
OCP\Config::setUserValue(OCP\USER::getUser(), 'gallery', 'root', $root);
OCP\Config::setUserValue(OCP\USER::getUser(), 'gallery', 'order', $order);
- OC_JSON::success(array('rescan' => $rescan));
+ OCP\JSON::success(array('rescan' => $rescan));
}
function handleGetGallery($path) {
@@ -121,7 +121,7 @@ function handleGetGallery($path) {
$token = $row['token'];
}
- OC_JSON::success(array('albums'=>$a, 'photos'=>$p, 'shared' => $shared, 'recursive' => $recursive, 'token' => $token));
+ OCP\JSON::success(array('albums'=>$a, 'photos'=>$p, 'shared' => $shared, 'recursive' => $recursive, 'token' => $token));
}
function handleShare($path, $share, $recursive) {
@@ -134,23 +134,23 @@ function handleShare($path, $share, $recursive) {
if ($row = $r->fetchRow()) {
$albumId = $row['album_id'];
} else {
- OC_JSON::error(array('cause' => 'Couldn\'t find requested gallery'));
+ OCP\JSON::error(array('cause' => 'Couldn\'t find requested gallery'));
exit;
}
if ($share == false) {
OC_Gallery_Sharing::remove($albumId);
- OC_JSON::success(array('sharing' => false));
+ OCP\JSON::success(array('sharing' => false));
} else { // share, yeah \o/
$r = OC_Gallery_Sharing::getEntryByAlbumId($albumId);
if (($row = $r->fetchRow())) { // update entry
OC_Gallery_Sharing::updateSharingByToken($row['token'], $recursive);
- OC_JSON::success(array('sharing' => true, 'token' => $row['token'], 'recursive' => $recursive == 1 ? true : false ));
+ OCP\JSON::success(array('sharing' => true, 'token' => $row['token'], 'recursive' => $recursive == 1 ? true : false ));
} else { // and new sharing entry
$date = new DateTime();
$token = md5($owner . $date->getTimestamp());
OC_Gallery_Sharing::addShared($token, intval($albumId), $recursive);
- OC_JSON::success(array('sharing' => true, 'token' => $token, 'recursive' => $recursive == 1 ? true : false ));
+ OCP\JSON::success(array('sharing' => true, 'token' => $token, 'recursive' => $recursive == 1 ? true : false ));
}
}
}
@@ -160,11 +160,11 @@ if ($_GET['operation']) {
switch($_GET['operation']) {
case 'rename':
handleRename($_GET['oldname'], $_GET['newname']);
- OC_JSON::success(array('newname' => $_GET['newname']));
+ OCP\JSON::success(array('newname' => $_GET['newname']));
break;
case 'remove':
handleRemove($_GET['name']);
- OC_JSON::success();
+ OCP\JSON::success();
break;
case 'get_covers':
handleGetThumbnails(urldecode($_GET['albumname']));
@@ -182,7 +182,7 @@ if ($_GET['operation']) {
handleShare($_GET['path'], $_GET['share'] == 'true' ? true : false, $_GET['recursive']);
break;
default:
- OC_JSON::error(array('cause' => 'Unknown operation'));
+ OCP\JSON::error(array('cause' => 'Unknown operation'));
}
}
?>
diff --git a/apps/gallery/ajax/sharing.php b/apps/gallery/ajax/sharing.php
index a1af75ad461..1223320120b 100755
--- a/apps/gallery/ajax/sharing.php
+++ b/apps/gallery/ajax/sharing.php
@@ -24,7 +24,7 @@
if (!isset($_GET['token']) || !isset($_GET['operation'])) {
- OC_JSON::error(array('cause' => 'Not enought arguments'));
+ OCP\JSON::error(array('cause' => 'Not enought arguments'));
exit;
}
@@ -32,7 +32,7 @@ $operation = $_GET['operation'];
$token = $_GET['token'];
if (!OC_Gallery_Sharing::isTokenValid($token)) {
- OC_JSON::error(array('cause' => 'Given token is not valid'));
+ OCP\JSON::error(array('cause' => 'Given token is not valid'));
exit;
}
@@ -65,7 +65,7 @@ function handleGetGallery($token, $path) {
$photos[] = $row['file_path'];
}
- OC_JSON::success(array('albums' => $albums, 'photos' => $photos));
+ OCP\JSON::success(array('albums' => $albums, 'photos' => $photos));
}
function handleGetThumbnail($token, $imgpath) {
diff --git a/apps/gallery/ajax/thumbnail.php b/apps/gallery/ajax/thumbnail.php
index 92e9fd4269e..ff0cb44022c 100755
--- a/apps/gallery/ajax/thumbnail.php
+++ b/apps/gallery/ajax/thumbnail.php
@@ -22,8 +22,8 @@
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('gallery');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('gallery');
$img = $_GET['img'];