Browse Source

Disable download php-side

Tobias Reich 10 years ago
parent
commit
8d587a0ea0
2 changed files with 25 additions and 3 deletions
  1. 3 3
      php/access/Guest.php
  2. 22 0
      php/modules/Album.php

+ 3 - 3
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();

+ 22 - 0
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