]> source.dussan.org Git - nextcloud-server.git/commitdiff
Gallery: Move login check to beginning of galleryOp.php
authorBart Visscher <bartv@thisnet.nl>
Mon, 13 Feb 2012 21:32:27 +0000 (22:32 +0100)
committerBart Visscher <bartv@thisnet.nl>
Mon, 13 Feb 2012 21:33:52 +0000 (22:33 +0100)
apps/gallery/ajax/galleryOp.php

index c0623c90d940ed8e2d769b5189ff1880e5c3810f..db6c79d6cdc2b4494ac16ec75004eef9a5c742f4 100644 (file)
 
 require_once('../../../lib/base.php');
 
+OC_JSON::checkLoggedIn();
 OC_JSON::checkAppEnabled('gallery');
 
 function handleRename($oldname, $newname) {
-  OC_JSON::checkLoggedIn();
   OC_Gallery_Album::rename($oldname, $newname, OC_User::getUser());
   OC_Gallery_Album::changeThumbnailPath($oldname, $newname);
 }
 
 function handleRemove($name) {
-  OC_JSON::checkLoggedIn();
   $album_id = OC_Gallery_Album::find(OC_User::getUser(), $name);
   $album_id = $album_id->fetchRow();
   $album_id = $album_id['album_id'];
@@ -41,7 +40,6 @@ function handleRemove($name) {
 }
 
 function handleGetThumbnails($albumname) {
-  OC_JSON::checkLoggedIn();
   $photo = new OC_Image();
   $photo->loadFromFile(OC::$CONFIG_DATADIRECTORY.'/../gallery/'.$albumname.'.png');
   $offset = 3600 * 24; // 24 hour
@@ -53,13 +51,11 @@ function handleGetThumbnails($albumname) {
 }
 
 function handleGalleryScanning() {
-  OC_JSON::checkLoggedIn();
   OC_Gallery_Scanner::cleanup();
   OC_JSON::success(array('albums' => OC_Gallery_Scanner::scan('/')));
 }
 
 function handleFilescan($cleanup) {
-  OC_JSON::checkLoggedIn();
   if ($cleanup) OC_Gallery_Album::cleanup();
   $root = OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', '').'/';
   $pathlist = OC_Gallery_Scanner::find_paths($root);
@@ -68,7 +64,6 @@ function handleFilescan($cleanup) {
 }
 
 function handlePartialCreate($path) {
-  OC_JSON::checkLoggedIn();
   if (empty($path)) OC_JSON::error(array('cause' => 'No path specified'));
   if (!OC_Filesystem::is_dir($path)) OC_JSON::error(array('cause' => 'Invalid path given'));
 
@@ -79,7 +74,6 @@ function handlePartialCreate($path) {
 }
 
 function handleStoreSettings($root, $order) {
-  OC_JSON::checkLoggedIn();
   if (!OC_Filesystem::file_exists($root)) {
     OC_JSON::error(array('cause' => 'No such file or directory'));
     return;