Updated default tables and changed sorting var/entry to sortingPhotos #98
This commit is contained in:
parent
90ac81acf1
commit
6b4f3546f9
BIN
dist/main.js
vendored
BIN
dist/main.js
vendored
Binary file not shown.
@ -4,12 +4,12 @@
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `?` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(50) NOT NULL,
|
||||
`title` varchar(100) NOT NULL DEFAULT '',
|
||||
`description` varchar(1000) DEFAULT '',
|
||||
`sysstamp` int(11) NOT NULL,
|
||||
`public` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`visible` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`downloadable` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`password` varchar(100) DEFAULT '',
|
||||
`password` varchar(100) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
|
@ -4,7 +4,7 @@
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `?` (
|
||||
`id` bigint(14) NOT NULL,
|
||||
`title` varchar(50) NOT NULL,
|
||||
`title` varchar(100) NOT NULL,
|
||||
`description` varchar(1000) DEFAULT '',
|
||||
`url` varchar(100) NOT NULL,
|
||||
`tags` varchar(1000) NOT NULL DEFAULT '',
|
||||
|
@ -9,6 +9,9 @@ VALUES
|
||||
('password',''),
|
||||
('thumbQuality','90'),
|
||||
('checkForUpdates','1'),
|
||||
('sorting','ORDER BY id DESC'),
|
||||
('sortingPhotos','ORDER BY id DESC'),
|
||||
('sortingAlbums','ORDER BY id DESC'),
|
||||
('medium','1'),
|
||||
('imagick','1'),
|
||||
('dropboxKey',''),
|
||||
('plugins','');
|
@ -35,6 +35,14 @@ if ($result->num_rows===0) {
|
||||
}
|
||||
}
|
||||
|
||||
# Rename sorting to sortingPhotos
|
||||
$query = Database::prepare($database, "UPDATE ? SET `key` = 'sortingPhotos' WHERE `key` = 'sorting' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
|
||||
$result = $database->query($query);
|
||||
if (!$result) {
|
||||
Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
# Set version
|
||||
if (Database::setVersion($database, '030001')===false) return false;
|
||||
|
||||
|
@ -94,19 +94,19 @@ class Album extends Module {
|
||||
switch ($this->albumIDs) {
|
||||
|
||||
case 'f': $return['public'] = '0';
|
||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE star = 1 " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE star = 1 " . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS));
|
||||
break;
|
||||
|
||||
case 's': $return['public'] = '0';
|
||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE public = 1 " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE public = 1 " . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS));
|
||||
break;
|
||||
|
||||
case 'r': $return['public'] = '0';
|
||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) " . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS));
|
||||
break;
|
||||
|
||||
case '0': $return['public'] = '0';
|
||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = 0 " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = 0 " . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS));
|
||||
break;
|
||||
|
||||
default: $query = Database::prepare($this->database, "SELECT * FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
|
||||
@ -114,7 +114,7 @@ class Album extends Module {
|
||||
$return = $albums->fetch_assoc();
|
||||
$return['sysdate'] = date('d M. Y', $return['sysstamp']);
|
||||
$return['password'] = ($return['password']=='' ? '0' : '1');
|
||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = '?' " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
|
||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = '?' " . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
|
||||
break;
|
||||
|
||||
}
|
||||
@ -210,7 +210,7 @@ class Album extends Module {
|
||||
($public===false)) {
|
||||
|
||||
# Execute query
|
||||
$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']));
|
||||
$query = Database::prepare($this->database, "SELECT thumbUrl FROM ? WHERE album = '?' ORDER BY star DESC, " . substr($this->settings['sortingPhotos'], 9) . " LIMIT 3", array(LYCHEE_TABLE_PHOTOS, $album['id']));
|
||||
$thumbs = $this->database->query($query);
|
||||
|
||||
# For each thumb
|
||||
@ -254,7 +254,7 @@ class Album extends Module {
|
||||
# Unsorted
|
||||
###
|
||||
|
||||
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE album = 0 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE album = 0 ' . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS));
|
||||
$unsorted = $this->database->query($query);
|
||||
$i = 0;
|
||||
|
||||
@ -274,7 +274,7 @@ class Album extends Module {
|
||||
# Starred
|
||||
###
|
||||
|
||||
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE star = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE star = 1 ' . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS));
|
||||
$starred = $this->database->query($query);
|
||||
$i = 0;
|
||||
|
||||
@ -294,7 +294,7 @@ class Album extends Module {
|
||||
# Public
|
||||
###
|
||||
|
||||
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE public = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
|
||||
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE public = 1 ' . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS));
|
||||
$public = $this->database->query($query);
|
||||
$i = 0;
|
||||
|
||||
@ -314,7 +314,7 @@ class Album extends Module {
|
||||
# Recent
|
||||
###
|
||||
|
||||
$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));
|
||||
$query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) ' . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS));
|
||||
$recent = $this->database->query($query);
|
||||
$i = 0;
|
||||
|
||||
|
@ -67,8 +67,8 @@ class Session extends Module {
|
||||
|
||||
# Unset unused vars
|
||||
unset($return['config']['thumbQuality']);
|
||||
unset($return['config']['sorting']);
|
||||
unset($return['config']['sortingAlbums']);
|
||||
unset($return['config']['sortingPhotos']);
|
||||
unset($return['config']['dropboxKey']);
|
||||
unset($return['config']['login']);
|
||||
unset($return['config']['location']);
|
||||
|
@ -183,7 +183,7 @@ class Settings extends Module {
|
||||
# Do not prepare $sorting because it is a true statement
|
||||
# Preparing (escaping) the sorting would destroy it
|
||||
# $sorting is save and can't contain user-input
|
||||
$query = Database::prepare($this->database, "UPDATE ? SET value = '$sorting' WHERE `key` = 'sorting'", array(LYCHEE_TABLE_SETTINGS));
|
||||
$query = Database::prepare($this->database, "UPDATE ? SET value = '$sorting' WHERE `key` = 'sortingPhotos'", array(LYCHEE_TABLE_SETTINGS));
|
||||
$result = $this->database->query($query);
|
||||
|
||||
if (!$result) {
|
||||
|
@ -47,7 +47,7 @@ function search($database, $settings, $term) {
|
||||
$album = Album::prepareData($album);
|
||||
|
||||
# Thumbs
|
||||
$query = Database::prepare($database, "SELECT thumbUrl FROM ? WHERE album = '?' " . $settings['sorting'] . " LIMIT 0, 3", array(LYCHEE_TABLE_PHOTOS, $album['id']));
|
||||
$query = Database::prepare($database, "SELECT thumbUrl FROM ? WHERE album = '?' " . $settings['sortingPhotos'] . " LIMIT 0, 3", array(LYCHEE_TABLE_PHOTOS, $album['id']));
|
||||
$thumbs = $database->query($query);
|
||||
|
||||
# For each thumb
|
||||
|
@ -18,7 +18,7 @@ lychee = {
|
||||
debugMode: false,
|
||||
|
||||
checkForUpdates:'1',
|
||||
sorting: '',
|
||||
sortingPhotos: '',
|
||||
sortingAlbums: '',
|
||||
location: '',
|
||||
|
||||
@ -49,7 +49,7 @@ lychee.init = function() {
|
||||
|
||||
// Logged in
|
||||
|
||||
lychee.sorting = data.config.sorting || '';
|
||||
lychee.sortingPhotos = data.config.sortingPhotos || '';
|
||||
lychee.sortingAlbums = data.config.sortingAlbums || '';
|
||||
lychee.dropboxKey = data.config.dropboxKey || '';
|
||||
lychee.location = data.config.location || '';
|
||||
|
@ -310,7 +310,7 @@ settings.setSorting = function() {
|
||||
|
||||
if (data===true) {
|
||||
lychee.sortingAlbums = 'ORDER BY ' + sortingAlbums[0] + ' ' + sortingAlbums[1];
|
||||
lychee.sorting = 'ORDER BY ' + sortingPhotos[0] + ' ' + sortingPhotos[1];
|
||||
lychee.sortingPhotos = 'ORDER BY ' + sortingPhotos[0] + ' ' + sortingPhotos[1];
|
||||
lychee.load();
|
||||
} else lychee.error(null, params, data);
|
||||
|
||||
@ -377,9 +377,9 @@ settings.setSorting = function() {
|
||||
|
||||
}
|
||||
|
||||
if (lychee.sorting!=='') {
|
||||
if (lychee.sortingPhotos!=='') {
|
||||
|
||||
sortingPhotos = lychee.sorting.replace('ORDER BY ', '').split(' ');
|
||||
sortingPhotos = lychee.sortingPhotos.replace('ORDER BY ', '').split(' ');
|
||||
|
||||
$('.basicModal select#settings_photos_type').val(sortingPhotos[0]);
|
||||
$('.basicModal select#settings_photos_order').val(sortingPhotos[1]);
|
||||
|
Loading…
Reference in New Issue
Block a user