Disable download php-side

This commit is contained in:
Tobias Reich 2014-08-17 20:22:46 +02:00
parent 0cf8e97190
commit 8d587a0ea0
2 changed files with 25 additions and 3 deletions

View File

@ -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();

View File

@ -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