Browse Source

Added direct access protection to database updates

Tobias Reich 9 years ago
parent
commit
0c97151f4f

+ 2 - 0
php/database/update_020100.php

@@ -5,6 +5,8 @@
 # @copyright	2015 by Tobias Reich
 ###
 
+if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
+
 $query = Database::prepare($database, "SELECT `tags` FROM `?` LIMIT 1", array(LYCHEE_TABLE_PHOTOS));
 if(!$database->query($query)) {
 	$query = Database::prepare($database, "ALTER TABLE `?` ADD `tags` VARCHAR( 1000 ) NULL DEFAULT ''", array(LYCHEE_TABLE_PHOTOS));

+ 2 - 0
php/database/update_020101.php

@@ -5,6 +5,8 @@
 # @copyright	2015 by Tobias Reich
 ###
 
+if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
+
 $query	= Database::prepare($database, "ALTER TABLE `?` CHANGE `value` `value` VARCHAR( 200 ) NULL DEFAULT ''", array(LYCHEE_TABLE_SETTINGS));
 $result	= $database->query($query);
 if (!$result) {

+ 2 - 0
php/database/update_020200.php

@@ -5,6 +5,8 @@
 # @copyright	2015 by Tobias Reich
 ###
 
+if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
+
 $query = Database::prepare($database, "SELECT `visible` FROM `?` LIMIT 1", array(LYCHEE_TABLE_ALBUMS));
 if (!$database->query($query)) {
 	$query	= Database::prepare($database, "ALTER TABLE `?` ADD `visible` TINYINT(1) NOT NULL DEFAULT 1", array(LYCHEE_TABLE_ALBUMS));

+ 2 - 0
php/database/update_020500.php

@@ -5,6 +5,8 @@
 # @copyright	2015 by Tobias Reich
 ###
 
+if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
+
 # Add `plugins`
 $query	= Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'plugins' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
 $result	= $database->query($query);

+ 2 - 0
php/database/update_020505.php

@@ -5,6 +5,8 @@
 # @copyright	2015 by Tobias Reich
 ###
 
+if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
+
 # Add `checksum`
 $query = Database::prepare($database, "SELECT `checksum` FROM `?` LIMIT 1", array(LYCHEE_TABLE_PHOTOS));
 if (!$database->query($query)) {

+ 2 - 0
php/database/update_020601.php

@@ -5,6 +5,8 @@
 # @copyright	2015 by Tobias Reich
 ###
 
+if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
+
 # Add `downloadable`
 $query = Database::prepare($database, "SELECT `downloadable` FROM `?` LIMIT 1", array(LYCHEE_TABLE_ALBUMS));
 if (!$database->query($query)) {

+ 2 - 0
php/database/update_020602.php

@@ -5,6 +5,8 @@
 # @copyright	2015 by Tobias Reich
 ###
 
+if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
+
 # Add a checksum
 $query	= Database::prepare($database, "SELECT `id`, `url` FROM `?` WHERE `checksum` IS NULL", array(LYCHEE_TABLE_PHOTOS));
 $result	= $database->query($query);

+ 2 - 0
php/database/update_020700.php

@@ -5,6 +5,8 @@
 # @copyright	2015 by Tobias Reich
 ###
 
+if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
+
 # Add medium to photos
 $query = Database::prepare($database, "SELECT `medium` FROM `?` LIMIT 1", array(LYCHEE_TABLE_PHOTOS));
 if (!$database->query($query)) {