Added timestamp to albums
This commit is contained in:
parent
e7578d8d23
commit
b62d8b24fa
@ -16,12 +16,27 @@ if ($database->query("SELECT `takedate`, `taketime` FROM `lychee_photos` LIMIT 1
|
|||||||
if (!$result) return false;
|
if (!$result) return false;
|
||||||
while ($photo = $result->fetch_object()) {
|
while ($photo = $result->fetch_object()) {
|
||||||
$takestamp = strtotime($photo->takedate . $photo->taketime);
|
$takestamp = strtotime($photo->takedate . $photo->taketime);
|
||||||
$database->query("UPDATE lychee_photos SET takestamp = '$takestamp' WHERE `id` = '$photo->id';");
|
$database->query("UPDATE `lychee_photos` SET `takestamp` = '$takestamp' WHERE `id` = '$photo->id';");
|
||||||
}
|
}
|
||||||
$result = $database->query("ALTER TABLE `lychee_photos` DROP COLUMN `takedate`;");
|
$result = $database->query("ALTER TABLE `lychee_photos` DROP COLUMN `takedate`;");
|
||||||
$result = $database->query("ALTER TABLE `lychee_photos` DROP COLUMN `taketime`;");
|
$result = $database->query("ALTER TABLE `lychee_photos` DROP COLUMN `taketime`;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$database->query("SELECT `sysstamp` FROM `lychee_albums` LIMIT 1;")) {
|
||||||
|
$result = $database->query("ALTER TABLE `lychee_albums` ADD `sysstamp` INT(11) DEFAULT NULL");
|
||||||
|
if (!$result) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($database->query("SELECT `sysdate` FROM `lychee_albums` LIMIT 1;")) {
|
||||||
|
$result = $database->query("SELECT `id`, `sysdate` FROM `lychee_albums`;");
|
||||||
|
if (!$result) return false;
|
||||||
|
while ($album = $result->fetch_object()) {
|
||||||
|
$sysstamp = strtotime($album->sysdate);
|
||||||
|
$database->query("UPDATE `lychee_albums` SET `sysstamp` = '$sysstamp' WHERE `id` = '$album->id';");
|
||||||
|
}
|
||||||
|
$result = $database->query("ALTER TABLE `lychee_albums` DROP COLUMN `sysdate`;");
|
||||||
|
}
|
||||||
|
|
||||||
$result = $database->query("UPDATE lychee_settings SET value = '020500' WHERE `key` = 'version';");
|
$result = $database->query("UPDATE lychee_settings SET value = '020500' WHERE `key` = 'version';");
|
||||||
if (!$result) return false;
|
if (!$result) return false;
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ class Album extends Module {
|
|||||||
if (strlen($title)>50) $title = substr($title, 0, 50);
|
if (strlen($title)>50) $title = substr($title, 0, 50);
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
$sysdate = date('d.m.Y');
|
$sysstamp = time();
|
||||||
$result = $this->database->query("INSERT INTO lychee_albums (title, sysdate, public, visible) VALUES ('$title', '$sysdate', '$public', '$visible');");
|
$result = $this->database->query("INSERT INTO lychee_albums (title, sysstamp, public, visible) VALUES ('$title', '$sysstamp', '$public', '$visible');");
|
||||||
|
|
||||||
# Call plugins
|
# Call plugins
|
||||||
$this->plugins(__METHOD__, 1, func_get_args());
|
$this->plugins(__METHOD__, 1, func_get_args());
|
||||||
@ -72,7 +72,7 @@ class Album extends Module {
|
|||||||
|
|
||||||
default: $albums = $this->database->query("SELECT * FROM lychee_albums WHERE id = '$this->albumIDs' LIMIT 1;");
|
default: $albums = $this->database->query("SELECT * FROM lychee_albums WHERE id = '$this->albumIDs' LIMIT 1;");
|
||||||
$return = $albums->fetch_assoc();
|
$return = $albums->fetch_assoc();
|
||||||
$return['sysdate'] = date('d M. Y', strtotime($return['sysdate']));
|
$return['sysdate'] = date('d M. Y', $return['sysstamp']);
|
||||||
$return['password'] = ($return['password']=='' ? false : true);
|
$return['password'] = ($return['password']=='' ? false : true);
|
||||||
$query = "SELECT id, title, tags, public, star, album, thumbUrl FROM lychee_photos WHERE album = '$this->albumIDs' " . $this->settings['sorting'];
|
$query = "SELECT id, title, tags, public, star, album, thumbUrl FROM lychee_photos WHERE album = '$this->albumIDs' " . $this->settings['sorting'];
|
||||||
break;
|
break;
|
||||||
@ -138,8 +138,8 @@ class Album extends Module {
|
|||||||
if ($public===false) $return = $this->getSmartInfo();
|
if ($public===false) $return = $this->getSmartInfo();
|
||||||
|
|
||||||
# Albums query
|
# Albums query
|
||||||
$query = 'SELECT id, title, public, sysdate, password FROM lychee_albums WHERE public = 1 AND visible <> 0';
|
$query = 'SELECT id, title, public, sysstamp, password FROM lychee_albums WHERE public = 1 AND visible <> 0';
|
||||||
if ($public===false) $query = 'SELECT id, title, public, sysdate, password FROM lychee_albums';
|
if ($public===false) $query = 'SELECT id, title, public, sysstamp, password FROM lychee_albums';
|
||||||
|
|
||||||
# Execute query
|
# Execute query
|
||||||
$albums = $this->database->query($query) OR exit('Error: ' . $this->database->error);
|
$albums = $this->database->query($query) OR exit('Error: ' . $this->database->error);
|
||||||
@ -148,7 +148,7 @@ class Album extends Module {
|
|||||||
while ($album = $albums->fetch_assoc()) {
|
while ($album = $albums->fetch_assoc()) {
|
||||||
|
|
||||||
# Parse info
|
# Parse info
|
||||||
$album['sysdate'] = date('F Y', strtotime($album['sysdate']));
|
$album['sysdate'] = date('F Y', $album['sysstamp']);
|
||||||
$album['password'] = ($album['password'] != '');
|
$album['password'] = ($album['password'] != '');
|
||||||
|
|
||||||
# Thumbs
|
# Thumbs
|
||||||
|
@ -46,14 +46,14 @@ function search($term) {
|
|||||||
$return['albums'] = '';
|
$return['albums'] = '';
|
||||||
|
|
||||||
// Photos
|
// Photos
|
||||||
$result = $database->query("SELECT id, title, tags, sysdate, public, star, album, thumbUrl FROM lychee_photos WHERE title like '%$term%' OR description like '%$term%' OR tags like '%$term%';");
|
$result = $database->query("SELECT id, title, tags, public, star, album, thumbUrl FROM lychee_photos WHERE title like '%$term%' OR description like '%$term%' OR tags like '%$term%';");
|
||||||
while($row = $result->fetch_assoc()) {
|
while($row = $result->fetch_assoc()) {
|
||||||
$return['photos'][$row['id']] = $row;
|
$return['photos'][$row['id']] = $row;
|
||||||
$return['photos'][$row['id']]['sysdate'] = date('d F Y', strtotime($row['sysdate']));
|
$return['photos'][$row['id']]['sysdate'] = date('d M. Y', substr($row['id'], 0, -4));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Albums
|
// Albums
|
||||||
$result = $database->query("SELECT id, title, public, sysdate, password FROM lychee_albums WHERE title like '%$term%' OR description like '%$term%';");
|
$result = $database->query("SELECT id, title, public, sysstamp, password FROM lychee_albums WHERE title like '%$term%' OR description like '%$term%';");
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($row = $result->fetch_object()) {
|
while($row = $result->fetch_object()) {
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ function search($term) {
|
|||||||
$return['albums'][$row->id]['id'] = $row->id;
|
$return['albums'][$row->id]['id'] = $row->id;
|
||||||
$return['albums'][$row->id]['title'] = $row->title;
|
$return['albums'][$row->id]['title'] = $row->title;
|
||||||
$return['albums'][$row->id]['public'] = $row->public;
|
$return['albums'][$row->id]['public'] = $row->public;
|
||||||
$return['albums'][$row->id]['sysdate'] = date('F Y', strtotime($row->sysdate));
|
$return['albums'][$row->id]['sysdate'] = date('F Y', $row->sysstamp);
|
||||||
$return['albums'][$row->id]['password'] = ($row->password=='' ? false : true);
|
$return['albums'][$row->id]['password'] = ($row->password=='' ? false : true);
|
||||||
|
|
||||||
// Thumbs
|
// Thumbs
|
||||||
|
Loading…
Reference in New Issue
Block a user