From 8d587a0ea00616b5d4407291e8aa0980c4672ae9 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 17 Aug 2014 20:22:46 +0200 Subject: [PATCH] Disable download php-side --- php/access/Guest.php | 6 +++--- php/modules/Album.php | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/php/access/Guest.php b/php/access/Guest.php index 280f304..a1c9636 100644 --- a/php/access/Guest.php +++ b/php/access/Guest.php @@ -29,8 +29,8 @@ class Guest extends Access { case 'logout': $this->logout(); break; # $_GET functions - case 'getAlbumArchive': $this->getAlbumArchive(); break; - case 'getPhotoArchive': $this->getPhotoArchive(); break; + case 'getAlbumArchive': $this->getAlbumArchive(); break; + case 'getPhotoArchive': $this->getPhotoArchive(); break; # Error default: exit('Error: Function not found! Please check the spelling of the called function.'); @@ -136,7 +136,7 @@ class Guest extends Access { Module::dependencies(isset($_GET['albumID'], $_GET['password'])); $album = new Album($this->database, $this->plugins, $this->settings, $_GET['albumID']); - if ($album->getPublic()) { + if ($album->getPublic()&&$album->getDownloadable()) { # Album Public if ($album->checkPassword($_GET['password'])) $album->getArchive(); diff --git a/php/modules/Album.php b/php/modules/Album.php index 4301950..3e91786 100644 --- a/php/modules/Album.php +++ b/php/modules/Album.php @@ -441,6 +441,28 @@ class Album extends Module { } + public function getDownloadable() { + + # Check dependencies + self::dependencies(isset($this->database, $this->albumIDs)); + + # Call plugins + $this->plugins(__METHOD__, 0, func_get_args()); + + if ($this->albumIDs==='0'||$this->albumIDs==='s'||$this->albumIDs==='f') return false; + + # Execute query + $albums = $this->database->query("SELECT downloadable FROM lychee_albums WHERE id = '$this->albumIDs' LIMIT 1;"); + $album = $albums->fetch_object(); + + # Call plugins + $this->plugins(__METHOD__, 1, func_get_args()); + + if ($album->downloadable==1) return true; + return false; + + } + public function setPublic($password, $visible, $downloadable) { # Check dependencies