Replaced new array syntax with old one to support older php versions
This commit is contained in:
parent
2d1d8a5499
commit
13dea68c88
@ -6,9 +6,9 @@
|
|||||||
# @copyright 2014 by Tobias Reich
|
# @copyright 2014 by Tobias Reich
|
||||||
###
|
###
|
||||||
|
|
||||||
$query = Database::prepare($database, "SELECT `tags` FROM `?` LIMIT 1", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "SELECT `tags` FROM `?` LIMIT 1", array(LYCHEE_TABLE_PHOTOS));
|
||||||
if(!$database->query($query)) {
|
if(!$database->query($query)) {
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` ADD `tags` VARCHAR( 1000 ) NULL DEFAULT ''", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` ADD `tags` VARCHAR( 1000 ) NULL DEFAULT ''", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -16,10 +16,10 @@ if(!$database->query($query)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'dropboxKey' LIMIT 1", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'dropboxKey' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if ($result->num_rows===0) {
|
if ($result->num_rows===0) {
|
||||||
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('dropboxKey', '')", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('dropboxKey', '')", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -27,17 +27,17 @@ if ($result->num_rows===0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'version' LIMIT 1", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'version' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if ($result->num_rows===0) {
|
if ($result->num_rows===0) {
|
||||||
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('version', '020100')", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('version', '020100')", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$query = Database::prepare($database, "UPDATE ? SET value = '020100' WHERE `key` = 'version'", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "UPDATE ? SET value = '020100' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
# @copyright 2014 by Tobias Reich
|
# @copyright 2014 by Tobias Reich
|
||||||
###
|
###
|
||||||
|
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` CHANGE `value` `value` VARCHAR( 200 ) NULL DEFAULT ''", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` CHANGE `value` `value` VARCHAR( 200 ) NULL DEFAULT ''", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020101', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020101', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = Database::prepare($database, "UPDATE ? SET value = '020101' WHERE `key` = 'version'", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "UPDATE ? SET value = '020101' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020101', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020101', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
# @copyright 2014 by Tobias Reich
|
# @copyright 2014 by Tobias Reich
|
||||||
###
|
###
|
||||||
|
|
||||||
$query = Database::prepare($database, "SELECT `visible` FROM `?` LIMIT 1", [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, "SELECT `visible` FROM `?` LIMIT 1", array(LYCHEE_TABLE_ALBUMS));
|
||||||
if (!$database->query($query)) {
|
if (!$database->query($query)) {
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` ADD `visible` TINYINT(1) NOT NULL DEFAULT 1", [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` ADD `visible` TINYINT(1) NOT NULL DEFAULT 1", array(LYCHEE_TABLE_ALBUMS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020200', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020200', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -16,7 +16,7 @@ if (!$database->query($query)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = Database::prepare($database, "UPDATE ? SET value = '020200' WHERE `key` = 'version'", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "UPDATE ? SET value = '020200' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020200', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020200', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
###
|
###
|
||||||
|
|
||||||
# Add `plugins`
|
# Add `plugins`
|
||||||
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'plugins' LIMIT 1", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'plugins' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if ($result->num_rows===0) {
|
if ($result->num_rows===0) {
|
||||||
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('plugins', '')", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('plugins', '')", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -19,9 +19,9 @@ if ($result->num_rows===0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Add `takestamp`
|
# Add `takestamp`
|
||||||
$query = Database::prepare($database, "SELECT `takestamp` FROM `?` LIMIT 1;", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "SELECT `takestamp` FROM `?` LIMIT 1;", array(LYCHEE_TABLE_PHOTOS));
|
||||||
if (!$database->query($query)) {
|
if (!$database->query($query)) {
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` ADD `takestamp` INT(11) DEFAULT NULL", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` ADD `takestamp` INT(11) DEFAULT NULL", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -30,9 +30,9 @@ if (!$database->query($query)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Convert to `takestamp`
|
# Convert to `takestamp`
|
||||||
$query = Database::prepare($database, "SELECT `takedate`, `taketime` FROM `?` LIMIT 1;", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "SELECT `takedate`, `taketime` FROM `?` LIMIT 1;", array(LYCHEE_TABLE_PHOTOS));
|
||||||
if ($database->query($query)) {
|
if ($database->query($query)) {
|
||||||
$query = Database::prepare($database, "SELECT `id`, `takedate`, `taketime` FROM `?` WHERE `takedate` <> '' AND `taketime` <> ''", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "SELECT `id`, `takedate`, `taketime` FROM `?` WHERE `takedate` <> '' AND `taketime` <> ''", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -40,35 +40,35 @@ if ($database->query($query)) {
|
|||||||
}
|
}
|
||||||
while ($photo = $result->fetch_object()) {
|
while ($photo = $result->fetch_object()) {
|
||||||
$takestamp = strtotime($photo->takedate . $photo->taketime);
|
$takestamp = strtotime($photo->takedate . $photo->taketime);
|
||||||
$query = Database::prepare($database, "UPDATE `?` SET `takestamp` = '?' WHERE `id` = '?'", [LYCHEE_TABLE_PHOTOS, $takestamp, $photo->id]);
|
$query = Database::prepare($database, "UPDATE `?` SET `takestamp` = '?' WHERE `id` = '?'", array(LYCHEE_TABLE_PHOTOS, $takestamp, $photo->id));
|
||||||
$database->query($query);
|
$database->query($query);
|
||||||
}
|
}
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `takedate`;", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `takedate`;", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `taketime`", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `taketime`", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove `import_name`
|
# Remove `import_name`
|
||||||
$query = Database::prepare($database, "SELECT `import_name` FROM `?` LIMIT 1", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "SELECT `import_name` FROM `?` LIMIT 1", array(LYCHEE_TABLE_PHOTOS));
|
||||||
if ($database->query($query)) {
|
if ($database->query($query)) {
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `import_name`", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `import_name`", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove `sysdate` and `systime`
|
# Remove `sysdate` and `systime`
|
||||||
$query = Database::prepare($database, "SELECT `sysdate`, `systime` FROM `?` LIMIT 1", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "SELECT `sysdate`, `systime` FROM `?` LIMIT 1", array(LYCHEE_TABLE_PHOTOS));
|
||||||
if ($database->query($query)) {
|
if ($database->query($query)) {
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `sysdate`", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `sysdate`", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `systime`", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `systime`", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add `sysstamp`
|
# Add `sysstamp`
|
||||||
$query = Database::prepare($database, "SELECT `sysstamp` FROM `?` LIMIT 1", [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, "SELECT `sysstamp` FROM `?` LIMIT 1", array(LYCHEE_TABLE_ALBUMS));
|
||||||
if (!$database->query($query)) {
|
if (!$database->query($query)) {
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` ADD `sysstamp` INT(11) DEFAULT NULL", [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` ADD `sysstamp` INT(11) DEFAULT NULL", array(LYCHEE_TABLE_ALBUMS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -77,9 +77,9 @@ if (!$database->query($query)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Convert to `sysstamp`
|
# Convert to `sysstamp`
|
||||||
$query = Database::prepare($database, "SELECT `sysdate` FROM `?` LIMIT 1", [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, "SELECT `sysdate` FROM `?` LIMIT 1", array(LYCHEE_TABLE_ALBUMS));
|
||||||
if ($database->query($query)) {
|
if ($database->query($query)) {
|
||||||
$query = Database::prepare($database, "SELECT `id`, `sysdate` FROM `?`", [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, "SELECT `id`, `sysdate` FROM `?`", array(LYCHEE_TABLE_ALBUMS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -87,10 +87,10 @@ if ($database->query($query)) {
|
|||||||
}
|
}
|
||||||
while ($album = $result->fetch_object()) {
|
while ($album = $result->fetch_object()) {
|
||||||
$sysstamp = strtotime($album->sysdate);
|
$sysstamp = strtotime($album->sysdate);
|
||||||
$query = Database::prepare($database, "UPDATE `?` SET `sysstamp` = '?' WHERE `id` = '?'", [LYCHEE_TABLE_ALBUMS, $sysstamp, $album->id]);
|
$query = Database::prepare($database, "UPDATE `?` SET `sysstamp` = '?' WHERE `id` = '?'", array(LYCHEE_TABLE_ALBUMS, $sysstamp, $album->id));
|
||||||
$database->query($query);
|
$database->query($query);
|
||||||
}
|
}
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `sysdate`", [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` DROP COLUMN `sysdate`", array(LYCHEE_TABLE_ALBUMS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ if (!$result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set character
|
# Set character
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci", [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci", array(LYCHEE_TABLE_ALBUMS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -110,7 +110,7 @@ if (!$result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set character
|
# Set character
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -118,7 +118,7 @@ if (!$result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set character
|
# Set character
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -126,7 +126,7 @@ if (!$result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set album password length to 100 (for longer hashes)
|
# Set album password length to 100 (for longer hashes)
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` CHANGE `password` `password` VARCHAR(100)", [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` CHANGE `password` `password` VARCHAR(100)", array(LYCHEE_TABLE_ALBUMS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -134,7 +134,7 @@ if (!$result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set make length to 50
|
# Set make length to 50
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` CHANGE `make` `make` VARCHAR(50)", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` CHANGE `make` `make` VARCHAR(50)", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -142,7 +142,7 @@ if (!$result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Reset sorting
|
# Reset sorting
|
||||||
$query = Database::prepare($database, "UPDATE ? SET value = 'ORDER BY takestamp DESC' WHERE `key` = 'sorting' AND `value` LIKE '%UNIX_TIMESTAMP%'", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "UPDATE ? SET value = 'ORDER BY takestamp DESC' WHERE `key` = 'sorting' AND `value` LIKE '%UNIX_TIMESTAMP%'", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -150,7 +150,7 @@ if (!$result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set version
|
# Set version
|
||||||
$query = Database::prepare($database, "UPDATE ? SET value = '020500' WHERE `key` = 'version'", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "UPDATE ? SET value = '020500' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
###
|
###
|
||||||
|
|
||||||
# Add `checksum`
|
# Add `checksum`
|
||||||
$query = Database::prepare($database, "SELECT `checksum` FROM `?` LIMIT 1", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "SELECT `checksum` FROM `?` LIMIT 1", array(LYCHEE_TABLE_PHOTOS));
|
||||||
if (!$database->query($query)) {
|
if (!$database->query($query)) {
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` ADD `checksum` VARCHAR(100) DEFAULT NULL", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` ADD `checksum` VARCHAR(100) DEFAULT NULL", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020505', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020505', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -18,7 +18,7 @@ if (!$database->query($query)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set version
|
# Set version
|
||||||
$query = Database::prepare($database, "UPDATE ? SET value = '020505' WHERE `key` = 'version'", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "UPDATE ? SET value = '020505' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020505', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020505', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
###
|
###
|
||||||
|
|
||||||
# Add `downloadable`
|
# Add `downloadable`
|
||||||
$query = Database::prepare($database, "SELECT `downloadable` FROM `?` LIMIT 1", [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, "SELECT `downloadable` FROM `?` LIMIT 1", array(LYCHEE_TABLE_ALBUMS));
|
||||||
if (!$database->query($query)) {
|
if (!$database->query($query)) {
|
||||||
$query = Database::prepare($database, "ALTER TABLE `?` ADD `downloadable` TINYINT(1) NOT NULL DEFAULT 1", [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, "ALTER TABLE `?` ADD `downloadable` TINYINT(1) NOT NULL DEFAULT 1", array(LYCHEE_TABLE_ALBUMS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020601', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020601', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -18,7 +18,7 @@ if (!$database->query($query)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set version
|
# Set version
|
||||||
$query = Database::prepare($database, "UPDATE ? SET value = '020601' WHERE `key` = 'version'", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "UPDATE ? SET value = '020601' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020601', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020601', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
###
|
###
|
||||||
|
|
||||||
# Add a checksum
|
# Add a checksum
|
||||||
$query = Database::prepare($database, "SELECT `id`, `url` FROM `?` WHERE `checksum` IS NULL", [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, "SELECT `id`, `url` FROM `?` WHERE `checksum` IS NULL", array(LYCHEE_TABLE_PHOTOS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020602', __LINE__, 'Could not find photos without checksum (' . $database->error . ')');
|
Log::error($database, 'update_020602', __LINE__, 'Could not find photos without checksum (' . $database->error . ')');
|
||||||
@ -16,7 +16,7 @@ if (!$result) {
|
|||||||
while ($photo = $result->fetch_object()) {
|
while ($photo = $result->fetch_object()) {
|
||||||
$checksum = sha1_file(LYCHEE_UPLOADS_BIG . $photo->url);
|
$checksum = sha1_file(LYCHEE_UPLOADS_BIG . $photo->url);
|
||||||
if ($checksum!==false) {
|
if ($checksum!==false) {
|
||||||
$query = Database::prepare($database, "UPDATE `?` SET `checksum` = '?' WHERE `id` = '?'", [LYCHEE_TABLE_PHOTOS, $checksum, $photo->id]);
|
$query = Database::prepare($database, "UPDATE `?` SET `checksum` = '?' WHERE `id` = '?'", array(LYCHEE_TABLE_PHOTOS, $checksum, $photo->id));
|
||||||
$setChecksum = $database->query($query);
|
$setChecksum = $database->query($query);
|
||||||
if (!$setChecksum) {
|
if (!$setChecksum) {
|
||||||
Log::error($database, 'update_020602', __LINE__, 'Could not update checksum (' . $database->error . ')');
|
Log::error($database, 'update_020602', __LINE__, 'Could not update checksum (' . $database->error . ')');
|
||||||
@ -29,10 +29,10 @@ while ($photo = $result->fetch_object()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Add Imagick
|
# Add Imagick
|
||||||
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'imagick' LIMIT 1", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'imagick' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if ($result->num_rows===0) {
|
if ($result->num_rows===0) {
|
||||||
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('imagick', '1')", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('imagick', '1')", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
@ -41,7 +41,7 @@ if ($result->num_rows===0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set version
|
# Set version
|
||||||
$query = Database::prepare($database, "UPDATE ? SET value = '020602' WHERE `key` = 'version'", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, "UPDATE ? SET value = '020602' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($database, 'update_020602', __LINE__, 'Could not update database (' . $database->error . ')');
|
Log::error($database, 'update_020602', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||||
|
@ -39,7 +39,7 @@ class Album extends Module {
|
|||||||
|
|
||||||
# Database
|
# Database
|
||||||
$sysstamp = time();
|
$sysstamp = time();
|
||||||
$query = Database::prepare($this->database, "INSERT INTO ? (title, sysstamp, public, visible) VALUES ('?', '?', '?', '?')", [LYCHEE_TABLE_ALBUMS, $title, $sysstamp, $public, $visible]);
|
$query = Database::prepare($this->database, "INSERT INTO ? (title, sysstamp, public, visible) VALUES ('?', '?', '?', '?')", array(LYCHEE_TABLE_ALBUMS, $title, $sysstamp, $public, $visible));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
# Call plugins
|
# Call plugins
|
||||||
@ -65,27 +65,27 @@ class Album extends Module {
|
|||||||
switch ($this->albumIDs) {
|
switch ($this->albumIDs) {
|
||||||
|
|
||||||
case 'f': $return['public'] = false;
|
case 'f': $return['public'] = false;
|
||||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM ? WHERE star = 1 " . $this->settings['sorting'], [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM ? WHERE star = 1 " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's': $return['public'] = false;
|
case 's': $return['public'] = false;
|
||||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM ? WHERE public = 1 " . $this->settings['sorting'], [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM ? WHERE public = 1 " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r': $return['public'] = false;
|
case 'r': $return['public'] = false;
|
||||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) " . $this->settings['sorting'], [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '0': $return['public'] = false;
|
case '0': $return['public'] = false;
|
||||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM ? WHERE album = 0 " . $this->settings['sorting'], [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM ? WHERE album = 0 " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: $query = Database::prepare($this->database, "SELECT * FROM ? WHERE id = '?' LIMIT 1", [LYCHEE_TABLE_ALBUMS, $this->albumIDs]);
|
default: $query = Database::prepare($this->database, "SELECT * FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
|
||||||
$albums = $this->database->query($query);
|
$albums = $this->database->query($query);
|
||||||
$return = $albums->fetch_assoc();
|
$return = $albums->fetch_assoc();
|
||||||
$return['sysdate'] = date('d M. Y', $return['sysstamp']);
|
$return['sysdate'] = date('d M. Y', $return['sysstamp']);
|
||||||
$return['password'] = ($return['password']=='' ? false : true);
|
$return['password'] = ($return['password']=='' ? false : true);
|
||||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM ? WHERE album = '?' " . $this->settings['sorting'], [LYCHEE_TABLE_PHOTOS, $this->albumIDs]);
|
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp FROM ? WHERE album = '?' " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -156,8 +156,8 @@ class Album extends Module {
|
|||||||
if ($public===false) $return = $this->getSmartInfo();
|
if ($public===false) $return = $this->getSmartInfo();
|
||||||
|
|
||||||
# Albums query
|
# Albums query
|
||||||
$query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ? WHERE public = 1 AND visible <> 0', [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ? WHERE public = 1 AND visible <> 0', array(LYCHEE_TABLE_ALBUMS));
|
||||||
if ($public===false) $query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ?', [LYCHEE_TABLE_ALBUMS]);
|
if ($public===false) $query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ?', array(LYCHEE_TABLE_ALBUMS));
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$albums = $this->database->query($query);
|
$albums = $this->database->query($query);
|
||||||
@ -177,7 +177,7 @@ class Album extends Module {
|
|||||||
if (($public===true&&$album['password']===false)||($public===false)) {
|
if (($public===true&&$album['password']===false)||($public===false)) {
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$query = Database::prepare($this->database, "SELECT thumbUrl FROM ? WHERE album = '?' ORDER BY star DESC, " . substr($this->settings['sorting'], 9) . " LIMIT 3", [LYCHEE_TABLE_PHOTOS, $album['id']]);
|
$query = Database::prepare($this->database, "SELECT thumbUrl FROM ? WHERE album = '?' ORDER BY star DESC, " . substr($this->settings['sorting'], 9) . " LIMIT 3", array(LYCHEE_TABLE_PHOTOS, $album['id']));
|
||||||
$thumbs = $this->database->query($query);
|
$thumbs = $this->database->query($query);
|
||||||
|
|
||||||
# For each thumb
|
# For each thumb
|
||||||
@ -210,7 +210,7 @@ class Album extends Module {
|
|||||||
self::dependencies(isset($this->database, $this->settings));
|
self::dependencies(isset($this->database, $this->settings));
|
||||||
|
|
||||||
# Unsorted
|
# Unsorted
|
||||||
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE album = 0 ' . $this->settings['sorting'], [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE album = 0 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||||
$unsorted = $this->database->query($query);
|
$unsorted = $this->database->query($query);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($row = $unsorted->fetch_object()) {
|
while($row = $unsorted->fetch_object()) {
|
||||||
@ -222,7 +222,7 @@ class Album extends Module {
|
|||||||
$return['unsortedNum'] = $unsorted->num_rows;
|
$return['unsortedNum'] = $unsorted->num_rows;
|
||||||
|
|
||||||
# Public
|
# Public
|
||||||
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE public = 1 ' . $this->settings['sorting'], [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE public = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||||
$public = $this->database->query($query);
|
$public = $this->database->query($query);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($row2 = $public->fetch_object()) {
|
while($row2 = $public->fetch_object()) {
|
||||||
@ -234,7 +234,7 @@ class Album extends Module {
|
|||||||
$return['publicNum'] = $public->num_rows;
|
$return['publicNum'] = $public->num_rows;
|
||||||
|
|
||||||
# Starred
|
# Starred
|
||||||
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE star = 1 ' . $this->settings['sorting'], [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE star = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||||
$starred = $this->database->query($query);
|
$starred = $this->database->query($query);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($row3 = $starred->fetch_object()) {
|
while($row3 = $starred->fetch_object()) {
|
||||||
@ -246,7 +246,7 @@ class Album extends Module {
|
|||||||
$return['starredNum'] = $starred->num_rows;
|
$return['starredNum'] = $starred->num_rows;
|
||||||
|
|
||||||
# Recent
|
# Recent
|
||||||
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) ' . $this->settings['sorting'], [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||||
$recent = $this->database->query($query);
|
$recent = $this->database->query($query);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($row3 = $recent->fetch_object()) {
|
while($row3 = $recent->fetch_object()) {
|
||||||
@ -278,25 +278,25 @@ class Album extends Module {
|
|||||||
# Photos query
|
# Photos query
|
||||||
switch($this->albumIDs) {
|
switch($this->albumIDs) {
|
||||||
case 's':
|
case 's':
|
||||||
$photos = Database::prepare($this->database, 'SELECT title, url FROM ? WHERE public = 1', [LYCHEE_TABLE_PHOTOS]);
|
$photos = Database::prepare($this->database, 'SELECT title, url FROM ? WHERE public = 1', array(LYCHEE_TABLE_PHOTOS));
|
||||||
$zipTitle = 'Public';
|
$zipTitle = 'Public';
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
$photos = Database::prepare($this->database, 'SELECT title, url FROM ? WHERE star = 1', [LYCHEE_TABLE_PHOTOS]);
|
$photos = Database::prepare($this->database, 'SELECT title, url FROM ? WHERE star = 1', array(LYCHEE_TABLE_PHOTOS));
|
||||||
$zipTitle = 'Starred';
|
$zipTitle = 'Starred';
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
$photos = Database::prepare($this->database, 'SELECT title, url FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) GROUP BY checksum', [LYCHEE_TABLE_PHOTOS]);
|
$photos = Database::prepare($this->database, 'SELECT title, url FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) GROUP BY checksum', array(LYCHEE_TABLE_PHOTOS));
|
||||||
$zipTitle = 'Recent';
|
$zipTitle = 'Recent';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$photos = Database::prepare($this->database, "SELECT title, url FROM ? WHERE album = '?'", [LYCHEE_TABLE_PHOTOS, $this->albumIDs]);
|
$photos = Database::prepare($this->database, "SELECT title, url FROM ? WHERE album = '?'", array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
|
||||||
$zipTitle = 'Unsorted';
|
$zipTitle = 'Unsorted';
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set title
|
# Set title
|
||||||
if ($this->albumIDs!=0&&is_numeric($this->albumIDs)) {
|
if ($this->albumIDs!=0&&is_numeric($this->albumIDs)) {
|
||||||
$query = Database::prepare($this->database, "SELECT title FROM ? WHERE id = '?' LIMIT 1", [LYCHEE_TABLE_ALBUMS, $this->albumIDs]);
|
$query = Database::prepare($this->database, "SELECT title FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
|
||||||
$album = $this->database->query($query);
|
$album = $this->database->query($query);
|
||||||
$zipTitle = $album->fetch_object()->title;
|
$zipTitle = $album->fetch_object()->title;
|
||||||
}
|
}
|
||||||
@ -394,7 +394,7 @@ class Album extends Module {
|
|||||||
if (strlen($title)>50) $title = substr($title, 0, 50);
|
if (strlen($title)>50) $title = substr($title, 0, 50);
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET title = '?' WHERE id IN (?)", [LYCHEE_TABLE_ALBUMS, $title, $this->albumIDs]);
|
$query = Database::prepare($this->database, "UPDATE ? SET title = '?' WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $title, $this->albumIDs));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
# Call plugins
|
# Call plugins
|
||||||
@ -421,7 +421,7 @@ class Album extends Module {
|
|||||||
if (strlen($description)>1000) $description = substr($description, 0, 1000);
|
if (strlen($description)>1000) $description = substr($description, 0, 1000);
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET description = '?' WHERE id IN (?)", [LYCHEE_TABLE_ALBUMS, $description, $this->albumIDs]);
|
$query = Database::prepare($this->database, "UPDATE ? SET description = '?' WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $description, $this->albumIDs));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
# Call plugins
|
# Call plugins
|
||||||
@ -446,7 +446,7 @@ class Album extends Module {
|
|||||||
if ($this->albumIDs==='0'||$this->albumIDs==='s'||$this->albumIDs==='f') return false;
|
if ($this->albumIDs==='0'||$this->albumIDs==='s'||$this->albumIDs==='f') return false;
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$query = Database::prepare($this->database, "SELECT public FROM ? WHERE id = '?' LIMIT 1", [LYCHEE_TABLE_ALBUMS, $this->albumIDs]);
|
$query = Database::prepare($this->database, "SELECT public FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
|
||||||
$albums = $this->database->query($query);
|
$albums = $this->database->query($query);
|
||||||
$album = $albums->fetch_object();
|
$album = $albums->fetch_object();
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ class Album extends Module {
|
|||||||
if ($this->albumIDs==='0'||$this->albumIDs==='s'||$this->albumIDs==='f'||$this->albumIDs==='r') return false;
|
if ($this->albumIDs==='0'||$this->albumIDs==='s'||$this->albumIDs==='f'||$this->albumIDs==='r') return false;
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$query = Database::prepare($this->database, "SELECT downloadable FROM ? WHERE id = '?' LIMIT 1", [LYCHEE_TABLE_ALBUMS, $this->albumIDs]);
|
$query = Database::prepare($this->database, "SELECT downloadable FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
|
||||||
$albums = $this->database->query($query);
|
$albums = $this->database->query($query);
|
||||||
$album = $albums->fetch_object();
|
$album = $albums->fetch_object();
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ class Album extends Module {
|
|||||||
$this->plugins(__METHOD__, 0, func_get_args());
|
$this->plugins(__METHOD__, 0, func_get_args());
|
||||||
|
|
||||||
# Get public
|
# Get public
|
||||||
$query = Database::prepare($this->database, "SELECT id, public FROM ? WHERE id IN (?)", [LYCHEE_TABLE_ALBUMS, $this->albumIDs]);
|
$query = Database::prepare($this->database, "SELECT id, public FROM ? WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
|
||||||
$albums = $this->database->query($query);
|
$albums = $this->database->query($query);
|
||||||
|
|
||||||
while ($album = $albums->fetch_object()) {
|
while ($album = $albums->fetch_object()) {
|
||||||
@ -505,7 +505,7 @@ class Album extends Module {
|
|||||||
$downloadable = ($downloadable==='true' ? 1 : 0);
|
$downloadable = ($downloadable==='true' ? 1 : 0);
|
||||||
|
|
||||||
# Set public
|
# Set public
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET public = '?', visible = '?', downloadable = '?', password = NULL WHERE id = '?'", [LYCHEE_TABLE_ALBUMS, $public, $visible, $downloadable, $album->id]);
|
$query = Database::prepare($this->database, "UPDATE ? SET public = '?', visible = '?', downloadable = '?', password = NULL WHERE id = '?'", array(LYCHEE_TABLE_ALBUMS, $public, $visible, $downloadable, $album->id));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
||||||
@ -514,7 +514,7 @@ class Album extends Module {
|
|||||||
|
|
||||||
# Reset permissions for photos
|
# Reset permissions for photos
|
||||||
if ($public===1) {
|
if ($public===1) {
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET public = 0 WHERE album = '?'", [LYCHEE_TABLE_PHOTOS, $album->id]);
|
$query = Database::prepare($this->database, "UPDATE ? SET public = 0 WHERE album = '?'", array(LYCHEE_TABLE_PHOTOS, $album->id));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
||||||
@ -550,13 +550,13 @@ class Album extends Module {
|
|||||||
# Set hashed password
|
# Set hashed password
|
||||||
# Do not prepare $password because it is hashed and save
|
# Do not prepare $password because it is hashed and save
|
||||||
# Preparing (escaping) the password would destroy the hash
|
# Preparing (escaping) the password would destroy the hash
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET password = '$password' WHERE id IN (?)", [LYCHEE_TABLE_ALBUMS, $this->albumIDs]);
|
$query = Database::prepare($this->database, "UPDATE ? SET password = '$password' WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
# Unset password
|
# Unset password
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET password = NULL WHERE id IN (?)", [LYCHEE_TABLE_ALBUMS, $this->albumIDs]);
|
$query = Database::prepare($this->database, "UPDATE ? SET password = NULL WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -581,7 +581,7 @@ class Album extends Module {
|
|||||||
$this->plugins(__METHOD__, 0, func_get_args());
|
$this->plugins(__METHOD__, 0, func_get_args());
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$query = Database::prepare($this->database, "SELECT password FROM ? WHERE id = '?' LIMIT 1", [LYCHEE_TABLE_ALBUMS, $this->albumIDs]);
|
$query = Database::prepare($this->database, "SELECT password FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
|
||||||
$albums = $this->database->query($query);
|
$albums = $this->database->query($query);
|
||||||
$album = $albums->fetch_object();
|
$album = $albums->fetch_object();
|
||||||
|
|
||||||
@ -606,7 +606,7 @@ class Album extends Module {
|
|||||||
$error = false;
|
$error = false;
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$query = Database::prepare($this->database, "SELECT id FROM ? WHERE album IN (?)", [LYCHEE_TABLE_PHOTOS, $this->albumIDs]);
|
$query = Database::prepare($this->database, "SELECT id FROM ? WHERE album IN (?)", array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
|
||||||
$photos = $this->database->query($query);
|
$photos = $this->database->query($query);
|
||||||
|
|
||||||
# For each album delete photo
|
# For each album delete photo
|
||||||
@ -618,7 +618,7 @@ class Album extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Delete albums
|
# Delete albums
|
||||||
$query = Database::prepare($this->database, "DELETE FROM ? WHERE id IN (?)", [LYCHEE_TABLE_ALBUMS, $this->albumIDs]);
|
$query = Database::prepare($this->database, "DELETE FROM ? WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
# Call plugins
|
# Call plugins
|
||||||
|
@ -29,7 +29,7 @@ class Database extends Module {
|
|||||||
if (!Database::createDatabase($database, $name)) exit('Error: Could not create database!');
|
if (!Database::createDatabase($database, $name)) exit('Error: Could not create database!');
|
||||||
|
|
||||||
# Check tables
|
# Check tables
|
||||||
$query = Database::prepare($database, 'SELECT * FROM ?, ?, ?, ? LIMIT 0', [LYCHEE_TABLE_PHOTOS, LYCHEE_TABLE_ALBUMS, LYCHEE_TABLE_SETTINGS, LYCHEE_TABLE_LOG]);
|
$query = Database::prepare($database, 'SELECT * FROM ?, ?, ?, ? LIMIT 0', array(LYCHEE_TABLE_PHOTOS, LYCHEE_TABLE_ALBUMS, LYCHEE_TABLE_SETTINGS, LYCHEE_TABLE_LOG));
|
||||||
if (!$database->query($query))
|
if (!$database->query($query))
|
||||||
if (!Database::createTables($database)) exit('Error: Could not create tables!');
|
if (!Database::createTables($database)) exit('Error: Could not create tables!');
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
Module::dependencies(isset($database));
|
Module::dependencies(isset($database));
|
||||||
|
|
||||||
# Create log
|
# Create log
|
||||||
$exist = Database::prepare($database, 'SELECT * FROM ? LIMIT 0', [LYCHEE_TABLE_LOG]);
|
$exist = Database::prepare($database, 'SELECT * FROM ? LIMIT 0', array(LYCHEE_TABLE_LOG));
|
||||||
if (!$database->query($exist)) {
|
if (!$database->query($exist)) {
|
||||||
|
|
||||||
# Read file
|
# Read file
|
||||||
@ -151,13 +151,13 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
if (!isset($query)||$query===false) return false;
|
if (!isset($query)||$query===false) return false;
|
||||||
|
|
||||||
# Create table
|
# Create table
|
||||||
$query = Database::prepare($database, $query, [LYCHEE_TABLE_LOG]);
|
$query = Database::prepare($database, $query, array(LYCHEE_TABLE_LOG));
|
||||||
if (!$database->query($query)) return false;
|
if (!$database->query($query)) return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create settings
|
# Create settings
|
||||||
$exist = Database::prepare($database, 'SELECT * FROM ? LIMIT 0', [LYCHEE_TABLE_SETTINGS]);
|
$exist = Database::prepare($database, 'SELECT * FROM ? LIMIT 0', array(LYCHEE_TABLE_SETTINGS));
|
||||||
if (!$database->query($exist)) {
|
if (!$database->query($exist)) {
|
||||||
|
|
||||||
# Read file
|
# Read file
|
||||||
@ -170,7 +170,7 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Create table
|
# Create table
|
||||||
$query = Database::prepare($database, $query, [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, $query, array(LYCHEE_TABLE_SETTINGS));
|
||||||
if (!$database->query($query)) {
|
if (!$database->query($query)) {
|
||||||
Log::error($database, __METHOD__, __LINE__, $database->error);
|
Log::error($database, __METHOD__, __LINE__, $database->error);
|
||||||
return false;
|
return false;
|
||||||
@ -186,7 +186,7 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Add content
|
# Add content
|
||||||
$query = Database::prepare($database, $query, [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($database, $query, array(LYCHEE_TABLE_SETTINGS));
|
||||||
if (!$database->query($query)) {
|
if (!$database->query($query)) {
|
||||||
Log::error($database, __METHOD__, __LINE__, $database->error);
|
Log::error($database, __METHOD__, __LINE__, $database->error);
|
||||||
return false;
|
return false;
|
||||||
@ -195,7 +195,7 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Create albums
|
# Create albums
|
||||||
$exist = Database::prepare($database, 'SELECT * FROM ? LIMIT 0', [LYCHEE_TABLE_ALBUMS]);
|
$exist = Database::prepare($database, 'SELECT * FROM ? LIMIT 0', array(LYCHEE_TABLE_ALBUMS));
|
||||||
if (!$database->query($exist)) {
|
if (!$database->query($exist)) {
|
||||||
|
|
||||||
# Read file
|
# Read file
|
||||||
@ -208,7 +208,7 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Create table
|
# Create table
|
||||||
$query = Database::prepare($database, $query, [LYCHEE_TABLE_ALBUMS]);
|
$query = Database::prepare($database, $query, array(LYCHEE_TABLE_ALBUMS));
|
||||||
if (!$database->query($query)) {
|
if (!$database->query($query)) {
|
||||||
Log::error($database, __METHOD__, __LINE__, $database->error);
|
Log::error($database, __METHOD__, __LINE__, $database->error);
|
||||||
return false;
|
return false;
|
||||||
@ -217,7 +217,7 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Create photos
|
# Create photos
|
||||||
$exist = Database::prepare($database, 'SELECT * FROM ? LIMIT 0', [LYCHEE_TABLE_PHOTOS]);
|
$exist = Database::prepare($database, 'SELECT * FROM ? LIMIT 0', array(LYCHEE_TABLE_PHOTOS));
|
||||||
if (!$database->query($exist)) {
|
if (!$database->query($exist)) {
|
||||||
|
|
||||||
# Read file
|
# Read file
|
||||||
@ -230,7 +230,7 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Create table
|
# Create table
|
||||||
$query = Database::prepare($database, $query, [LYCHEE_TABLE_PHOTOS]);
|
$query = Database::prepare($database, $query, array(LYCHEE_TABLE_PHOTOS));
|
||||||
if (!$database->query($query)) {
|
if (!$database->query($query)) {
|
||||||
Log::error($database, __METHOD__, __LINE__, $database->error);
|
Log::error($database, __METHOD__, __LINE__, $database->error);
|
||||||
return false;
|
return false;
|
||||||
|
@ -37,7 +37,7 @@ class Log extends Module {
|
|||||||
$sysstamp = time();
|
$sysstamp = time();
|
||||||
|
|
||||||
# Save in database
|
# Save in database
|
||||||
$query = Database::prepare($database, "INSERT INTO ? (time, type, function, line, text) VALUES ('?', '?', '?', '?', '?')", [LYCHEE_TABLE_LOG, $sysstamp, $type, $function, $line, $text]);
|
$query = Database::prepare($database, "INSERT INTO ? (time, type, function, line, text) VALUES ('?', '?', '?', '?', '?')", array(LYCHEE_TABLE_LOG, $sysstamp, $type, $function, $line, $text));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
|
|
||||||
if (!$result) return false;
|
if (!$result) return false;
|
||||||
|
@ -175,7 +175,7 @@ class Photo extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Save to DB
|
# Save to DB
|
||||||
$values = [LYCHEE_TABLE_PHOTOS, $id, $info['title'], $photo_name, $description, $tags, $info['type'], $info['width'], $info['height'], $info['size'], $info['iso'], $info['aperture'], $info['make'], $info['model'], $info['shutter'], $info['focal'], $info['takestamp'], $path_thumb, $albumID, $public, $star, $checksum];
|
$values = array(LYCHEE_TABLE_PHOTOS, $id, $info['title'], $photo_name, $description, $tags, $info['type'], $info['width'], $info['height'], $info['size'], $info['iso'], $info['aperture'], $info['make'], $info['model'], $info['shutter'], $info['focal'], $info['takestamp'], $path_thumb, $albumID, $public, $star, $checksum);
|
||||||
$query = Database::prepare($this->database, "INSERT INTO ? (id, title, url, description, tags, type, width, height, size, iso, aperture, make, model, shutter, focal, takestamp, thumbUrl, album, public, star, checksum) VALUES ('?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?')", $values);
|
$query = Database::prepare($this->database, "INSERT INTO ? (id, title, url, description, tags, type, width, height, size, iso, aperture, make, model, shutter, focal, takestamp, thumbUrl, album, public, star, checksum) VALUES ('?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?')", $values);
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
@ -199,8 +199,8 @@ class Photo extends Module {
|
|||||||
self::dependencies(isset($this->database, $checksum));
|
self::dependencies(isset($this->database, $checksum));
|
||||||
|
|
||||||
# Exclude $photoID from select when $photoID is set
|
# Exclude $photoID from select when $photoID is set
|
||||||
if (isset($photoID)) $query = Database::prepare($this->database, "SELECT id, url, thumbUrl FROM ? WHERE checksum = '?' AND id <> '?' LIMIT 1", [LYCHEE_TABLE_PHOTOS, $checksum, $photoID]);
|
if (isset($photoID)) $query = Database::prepare($this->database, "SELECT id, url, thumbUrl FROM ? WHERE checksum = '?' AND id <> '?' LIMIT 1", array(LYCHEE_TABLE_PHOTOS, $checksum, $photoID));
|
||||||
else $query = Database::prepare($this->database, "SELECT id, url, thumbUrl FROM ? WHERE checksum = '?' LIMIT 1", [LYCHEE_TABLE_PHOTOS, $checksum]);
|
else $query = Database::prepare($this->database, "SELECT id, url, thumbUrl FROM ? WHERE checksum = '?' LIMIT 1", array(LYCHEE_TABLE_PHOTOS, $checksum));
|
||||||
|
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ class Photo extends Module {
|
|||||||
$this->plugins(__METHOD__, 0, func_get_args());
|
$this->plugins(__METHOD__, 0, func_get_args());
|
||||||
|
|
||||||
# Get photo
|
# Get photo
|
||||||
$query = Database::prepare($this->database, "SELECT * FROM ? WHERE id = '?' LIMIT 1", [LYCHEE_TABLE_PHOTOS, $this->photoIDs]);
|
$query = Database::prepare($this->database, "SELECT * FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_PHOTOS, $this->photoIDs));
|
||||||
$photos = $this->database->query($query);
|
$photos = $this->database->query($query);
|
||||||
$photo = $photos->fetch_assoc();
|
$photo = $photos->fetch_assoc();
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ class Photo extends Module {
|
|||||||
if ($photo['album']!=0) {
|
if ($photo['album']!=0) {
|
||||||
|
|
||||||
# Get album
|
# Get album
|
||||||
$query = Database::prepare($this->database, "SELECT public FROM ? WHERE id = '?' LIMIT 1", [LYCHEE_TABLE_ALBUMS, $photo['album']]);
|
$query = Database::prepare($this->database, "SELECT public FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $photo['album']));
|
||||||
$albums = $this->database->query($query);
|
$albums = $this->database->query($query);
|
||||||
$album = $albums->fetch_assoc();
|
$album = $albums->fetch_assoc();
|
||||||
|
|
||||||
@ -577,7 +577,7 @@ class Photo extends Module {
|
|||||||
$this->plugins(__METHOD__, 0, func_get_args());
|
$this->plugins(__METHOD__, 0, func_get_args());
|
||||||
|
|
||||||
# Get photo
|
# Get photo
|
||||||
$query = Database::prepare($this->database, "SELECT title, url FROM ? WHERE id = '?' LIMIT 1", [LYCHEE_TABLE_PHOTOS, $this->photoIDs]);
|
$query = Database::prepare($this->database, "SELECT title, url FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_PHOTOS, $this->photoIDs));
|
||||||
$photos = $this->database->query($query);
|
$photos = $this->database->query($query);
|
||||||
$photo = $photos->fetch_object();
|
$photo = $photos->fetch_object();
|
||||||
|
|
||||||
@ -618,7 +618,7 @@ class Photo extends Module {
|
|||||||
if (strlen($title)>50) $title = substr($title, 0, 50);
|
if (strlen($title)>50) $title = substr($title, 0, 50);
|
||||||
|
|
||||||
# Set title
|
# Set title
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET title = '?' WHERE id IN (?)", [LYCHEE_TABLE_PHOTOS, $title, $this->photoIDs]);
|
$query = Database::prepare($this->database, "UPDATE ? SET title = '?' WHERE id IN (?)", array(LYCHEE_TABLE_PHOTOS, $title, $this->photoIDs));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
# Call plugins
|
# Call plugins
|
||||||
@ -645,7 +645,7 @@ class Photo extends Module {
|
|||||||
if (strlen($description)>1000) $description = substr($description, 0, 1000);
|
if (strlen($description)>1000) $description = substr($description, 0, 1000);
|
||||||
|
|
||||||
# Set description
|
# Set description
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET description = '?' WHERE id IN ('?')", [LYCHEE_TABLE_PHOTOS, $description, $this->photoIDs]);
|
$query = Database::prepare($this->database, "UPDATE ? SET description = '?' WHERE id IN ('?')", array(LYCHEE_TABLE_PHOTOS, $description, $this->photoIDs));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
# Call plugins
|
# Call plugins
|
||||||
@ -671,7 +671,7 @@ class Photo extends Module {
|
|||||||
$error = false;
|
$error = false;
|
||||||
|
|
||||||
# Get photos
|
# Get photos
|
||||||
$query = Database::prepare($this->database, "SELECT id, star FROM ? WHERE id IN (?)", [LYCHEE_TABLE_PHOTOS, $this->photoIDs]);
|
$query = Database::prepare($this->database, "SELECT id, star FROM ? WHERE id IN (?)", array(LYCHEE_TABLE_PHOTOS, $this->photoIDs));
|
||||||
$photos = $this->database->query($query);
|
$photos = $this->database->query($query);
|
||||||
|
|
||||||
# For each photo
|
# For each photo
|
||||||
@ -681,7 +681,7 @@ class Photo extends Module {
|
|||||||
$star = ($photo->star==0 ? 1 : 0);
|
$star = ($photo->star==0 ? 1 : 0);
|
||||||
|
|
||||||
# Set star
|
# Set star
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET star = '?' WHERE id = '?'", [LYCHEE_TABLE_PHOTOS, $star, $photo->id]);
|
$query = Database::prepare($this->database, "UPDATE ? SET star = '?' WHERE id = '?'", array(LYCHEE_TABLE_PHOTOS, $star, $photo->id));
|
||||||
$star = $this->database->query($query);
|
$star = $this->database->query($query);
|
||||||
if (!$star) $error = true;
|
if (!$star) $error = true;
|
||||||
|
|
||||||
@ -707,7 +707,7 @@ class Photo extends Module {
|
|||||||
$this->plugins(__METHOD__, 0, func_get_args());
|
$this->plugins(__METHOD__, 0, func_get_args());
|
||||||
|
|
||||||
# Get photo
|
# Get photo
|
||||||
$query = Database::prepare($this->database, "SELECT public, album FROM ? WHERE id = '?' LIMIT 1", [LYCHEE_TABLE_PHOTOS, $this->photoIDs]);
|
$query = Database::prepare($this->database, "SELECT public, album FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_PHOTOS, $this->photoIDs));
|
||||||
$photos = $this->database->query($query);
|
$photos = $this->database->query($query);
|
||||||
$photo = $photos->fetch_object();
|
$photo = $photos->fetch_object();
|
||||||
|
|
||||||
@ -736,7 +736,7 @@ class Photo extends Module {
|
|||||||
$this->plugins(__METHOD__, 0, func_get_args());
|
$this->plugins(__METHOD__, 0, func_get_args());
|
||||||
|
|
||||||
# Get public
|
# Get public
|
||||||
$query = Database::prepare($this->database, "SELECT public FROM ? WHERE id = '?' LIMIT 1", [LYCHEE_TABLE_PHOTOS, $this->photoIDs]);
|
$query = Database::prepare($this->database, "SELECT public FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_PHOTOS, $this->photoIDs));
|
||||||
$photos = $this->database->query($query);
|
$photos = $this->database->query($query);
|
||||||
$photo = $photos->fetch_object();
|
$photo = $photos->fetch_object();
|
||||||
|
|
||||||
@ -744,7 +744,7 @@ class Photo extends Module {
|
|||||||
$public = ($photo->public==0 ? 1 : 0);
|
$public = ($photo->public==0 ? 1 : 0);
|
||||||
|
|
||||||
# Set public
|
# Set public
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET public = '?' WHERE id = '?'", [LYCHEE_TABLE_PHOTOS, $public, $this->photoIDs]);
|
$query = Database::prepare($this->database, "UPDATE ? SET public = '?' WHERE id = '?'", array(LYCHEE_TABLE_PHOTOS, $public, $this->photoIDs));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
# Call plugins
|
# Call plugins
|
||||||
@ -767,7 +767,7 @@ class Photo extends Module {
|
|||||||
$this->plugins(__METHOD__, 0, func_get_args());
|
$this->plugins(__METHOD__, 0, func_get_args());
|
||||||
|
|
||||||
# Set album
|
# Set album
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET album = '?' WHERE id IN (?)", [LYCHEE_TABLE_PHOTOS, $albumID, $this->photoIDs]);
|
$query = Database::prepare($this->database, "UPDATE ? SET album = '?' WHERE id IN (?)", array(LYCHEE_TABLE_PHOTOS, $albumID, $this->photoIDs));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
# Call plugins
|
# Call plugins
|
||||||
@ -798,7 +798,7 @@ class Photo extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set tags
|
# Set tags
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET tags = '?' WHERE id IN (?)", [LYCHEE_TABLE_PHOTOS, $tags, $this->photoIDs]);
|
$query = Database::prepare($this->database, "UPDATE ? SET tags = '?' WHERE id IN (?)", array(LYCHEE_TABLE_PHOTOS, $tags, $this->photoIDs));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
# Call plugins
|
# Call plugins
|
||||||
@ -821,7 +821,7 @@ class Photo extends Module {
|
|||||||
$this->plugins(__METHOD__, 0, func_get_args());
|
$this->plugins(__METHOD__, 0, func_get_args());
|
||||||
|
|
||||||
# Get photos
|
# Get photos
|
||||||
$query = Database::prepare($this->database, "SELECT id, checksum FROM ? WHERE id IN (?)", [LYCHEE_TABLE_PHOTOS, $this->photoIDs]);
|
$query = Database::prepare($this->database, "SELECT id, checksum FROM ? WHERE id IN (?)", array(LYCHEE_TABLE_PHOTOS, $this->photoIDs));
|
||||||
$photos = $this->database->query($query);
|
$photos = $this->database->query($query);
|
||||||
if (!$photos) {
|
if (!$photos) {
|
||||||
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
||||||
@ -836,7 +836,7 @@ class Photo extends Module {
|
|||||||
while(strlen($id)<14) $id .= 0;
|
while(strlen($id)<14) $id .= 0;
|
||||||
|
|
||||||
# Duplicate entry
|
# Duplicate entry
|
||||||
$values = [LYCHEE_TABLE_PHOTOS, $id, LYCHEE_TABLE_PHOTOS, $photo->id];
|
$values = array(LYCHEE_TABLE_PHOTOS, $id, LYCHEE_TABLE_PHOTOS, $photo->id);
|
||||||
$query = Database::prepare($this->database, "INSERT INTO ? (id, title, url, description, tags, type, width, height, size, iso, aperture, make, model, shutter, focal, takestamp, thumbUrl, album, public, star, checksum) SELECT '?' AS id, title, url, description, tags, type, width, height, size, iso, aperture, make, model, shutter, focal, takestamp, thumbUrl, album, public, star, checksum FROM ? WHERE id = '?'", $values);
|
$query = Database::prepare($this->database, "INSERT INTO ? (id, title, url, description, tags, type, width, height, size, iso, aperture, make, model, shutter, focal, takestamp, thumbUrl, album, public, star, checksum) SELECT '?' AS id, title, url, description, tags, type, width, height, size, iso, aperture, make, model, shutter, focal, takestamp, thumbUrl, album, public, star, checksum FROM ? WHERE id = '?'", $values);
|
||||||
$duplicate = $this->database->query($query);
|
$duplicate = $this->database->query($query);
|
||||||
if (!$duplicate) {
|
if (!$duplicate) {
|
||||||
@ -859,7 +859,7 @@ class Photo extends Module {
|
|||||||
$this->plugins(__METHOD__, 0, func_get_args());
|
$this->plugins(__METHOD__, 0, func_get_args());
|
||||||
|
|
||||||
# Get photos
|
# Get photos
|
||||||
$query = Database::prepare($this->database, "SELECT id, url, thumbUrl, checksum FROM ? WHERE id IN (?)", [LYCHEE_TABLE_PHOTOS, $this->photoIDs]);
|
$query = Database::prepare($this->database, "SELECT id, url, thumbUrl, checksum FROM ? WHERE id IN (?)", array(LYCHEE_TABLE_PHOTOS, $this->photoIDs));
|
||||||
$photos = $this->database->query($query);
|
$photos = $this->database->query($query);
|
||||||
if (!$photos) {
|
if (!$photos) {
|
||||||
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
||||||
@ -898,7 +898,7 @@ class Photo extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Delete db entry
|
# Delete db entry
|
||||||
$query = Database::prepare($this->database, "DELETE FROM ? WHERE id = '?'", [LYCHEE_TABLE_PHOTOS, $photo->id]);
|
$query = Database::prepare($this->database, "DELETE FROM ? WHERE id = '?'", array(LYCHEE_TABLE_PHOTOS, $photo->id));
|
||||||
$delete = $this->database->query($query);
|
$delete = $this->database->query($query);
|
||||||
if (!$delete) {
|
if (!$delete) {
|
||||||
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
||||||
|
@ -27,7 +27,7 @@ class Settings extends Module {
|
|||||||
self::dependencies(isset($this->database));
|
self::dependencies(isset($this->database));
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$query = Database::prepare($this->database, "SELECT * FROM ?", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($this->database, "SELECT * FROM ?", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$settings = $this->database->query($query);
|
$settings = $this->database->query($query);
|
||||||
|
|
||||||
# Add each to return
|
# Add each to return
|
||||||
@ -77,7 +77,7 @@ class Settings extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET value = '?' WHERE `key` = 'username'", [LYCHEE_TABLE_SETTINGS, $username]);
|
$query = Database::prepare($this->database, "UPDATE ? SET value = '?' WHERE `key` = 'username'", array(LYCHEE_TABLE_SETTINGS, $username));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
@ -98,7 +98,7 @@ class Settings extends Module {
|
|||||||
# Execute query
|
# Execute query
|
||||||
# Do not prepare $password because it is hashed and save
|
# Do not prepare $password because it is hashed and save
|
||||||
# Preparing (escaping) the password would destroy the hash
|
# Preparing (escaping) the password would destroy the hash
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET value = '$password' WHERE `key` = 'password'", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($this->database, "UPDATE ? SET value = '$password' WHERE `key` = 'password'", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
@ -120,7 +120,7 @@ class Settings extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET value = '?' WHERE `key` = 'dropboxKey'", [LYCHEE_TABLE_SETTINGS, $key]);
|
$query = Database::prepare($this->database, "UPDATE ? SET value = '?' WHERE `key` = 'dropboxKey'", array(LYCHEE_TABLE_SETTINGS, $key));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
@ -184,7 +184,7 @@ class Settings extends Module {
|
|||||||
# Execute query
|
# Execute query
|
||||||
# Do not prepare $sorting because it is a true statement
|
# Do not prepare $sorting because it is a true statement
|
||||||
# Preparing (escaping) the sorting would destroy it
|
# Preparing (escaping) the sorting would destroy it
|
||||||
$query = Database::prepare($this->database, "UPDATE ? SET value = '$sorting' WHERE `key` = 'sorting'", [LYCHEE_TABLE_SETTINGS]);
|
$query = Database::prepare($this->database, "UPDATE ? SET value = '$sorting' WHERE `key` = 'sorting'", array(LYCHEE_TABLE_SETTINGS));
|
||||||
$result = $this->database->query($query);
|
$result = $this->database->query($query);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
|
@ -16,7 +16,7 @@ function search($database, $settings, $term) {
|
|||||||
$return['albums'] = '';
|
$return['albums'] = '';
|
||||||
|
|
||||||
// Photos
|
// Photos
|
||||||
$query = Database::prepare($database, "SELECT id, title, tags, public, star, album, thumbUrl FROM ? WHERE title LIKE '%?%' OR description LIKE '%%' OR tags LIKE '%?%'", [LYCHEE_TABLE_PHOTOS, $term, $term, $term]);
|
$query = Database::prepare($database, "SELECT id, title, tags, public, star, album, thumbUrl FROM ? WHERE title LIKE '%?%' OR description LIKE '%%' OR tags LIKE '%?%'", array(LYCHEE_TABLE_PHOTOS, $term, $term, $term));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
while($row = $result->fetch_assoc()) {
|
while($row = $result->fetch_assoc()) {
|
||||||
$return['photos'][$row['id']] = $row;
|
$return['photos'][$row['id']] = $row;
|
||||||
@ -25,7 +25,7 @@ function search($database, $settings, $term) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Albums
|
// Albums
|
||||||
$query = Database::prepare($database, "SELECT id, title, public, sysstamp, password FROM ? WHERE title LIKE '%?%' OR description LIKE '%?%'", [LYCHEE_TABLE_ALBUMS, $term, $term]);
|
$query = Database::prepare($database, "SELECT id, title, public, sysstamp, password FROM ? WHERE title LIKE '%?%' OR description LIKE '%?%'", array(LYCHEE_TABLE_ALBUMS, $term, $term));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($row = $result->fetch_object()) {
|
while($row = $result->fetch_object()) {
|
||||||
@ -38,7 +38,7 @@ function search($database, $settings, $term) {
|
|||||||
$return['albums'][$row->id]['password'] = ($row->password=='' ? false : true);
|
$return['albums'][$row->id]['password'] = ($row->password=='' ? false : true);
|
||||||
|
|
||||||
// Thumbs
|
// Thumbs
|
||||||
$query = Database::prepare($database, "SELECT thumbUrl FROM ? WHERE album = '?' " . $settings['sorting'] . " LIMIT 0, 3", [LYCHEE_TABLE_PHOTOS, $row->id]);
|
$query = Database::prepare($database, "SELECT thumbUrl FROM ? WHERE album = '?' " . $settings['sorting'] . " LIMIT 0, 3", array(LYCHEE_TABLE_PHOTOS, $row->id));
|
||||||
$result2 = $database->query($query);
|
$result2 = $database->query($query);
|
||||||
$k = 0;
|
$k = 0;
|
||||||
while($row2 = $result2->fetch_object()){
|
while($row2 = $result2->fetch_object()){
|
||||||
@ -58,7 +58,7 @@ function getGraphHeader($database, $photoID) {
|
|||||||
|
|
||||||
if (!isset($database, $photoID)) return false;
|
if (!isset($database, $photoID)) return false;
|
||||||
|
|
||||||
$query = Database::prepare($database, "SELECT title, description, url FROM ? WHERE id = '?'", [LYCHEE_TABLE_PHOTOS, $photoID]);
|
$query = Database::prepare($database, "SELECT title, description, url FROM ? WHERE id = '?'", array(LYCHEE_TABLE_PHOTOS, $photoID));
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$row = $result->fetch_object();
|
$row = $result->fetch_object();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user