. * */ require_once('../../../lib/base.php'); require_once(OC::$CLASSPATH['OC_Gallery_Album']); require_once(OC::$CLASSPATH['OC_Gallery_Scanner']); OC_JSON::checkAppEnabled('gallery'); function handleRename($oldname, $newname) { OC_JSON::checkLoggedIn(); OC_Gallery_Album::rename($oldname, $newname, OC_User::getUser()); } function handleRemove($name) { OC_JSON::checkLoggedIn(); OC_Gallery_Album::remove(OC_User::getUser(), $name); } function handleGetThumbnails($albumname) { OC_JSON::checkLoggedIn(); $photo = new OC_Image(); $photo->loadFromFile(OC::$CONFIG_DATADIRECTORY.'/../gallery/'.$albumname.'.png'); $photo->show(); } function handleGalleryScanning() { OC_JSON::checkLoggedIn(); OC_Gallery_Scanner::cleanup(); OC_JSON::success(array('albums' => OC_Gallery_Scanner::scan('/'))); } if ($_GET['operation']) { switch($_GET['operation']) { case "rename": handleRename($_GET['oldname'], $_GET['newname']); OC_JSON::success(array('newname' => $_GET['newname'])); break; case "remove": handleRemove($_GET['name']); OC_JSON::success(); break; case "get_covers": handleGetThumbnails($_GET['albumname']); break; case "scan": handleGalleryScanning(); break; default: OC_JSON::error(array('cause' => "Unknown operation")); } } ?>