Added row visible

This commit is contained in:
Tobias Reich 2014-03-30 17:42:45 +02:00
parent c915058bf8
commit 5cce602a05
3 changed files with 7 additions and 5 deletions

View File

@ -9,14 +9,14 @@
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
function addAlbum($title, $public = 0) { function addAlbum($title = '', $public = 0, $visible = 1) {
global $database; global $database;
if (strlen($title)<1||strlen($title)>50) return false; if (strlen($title)>50) $title = substr($title, 0, 50);
$sysdate = date("d.m.Y"); $sysdate = date("d.m.Y");
$result = $database->query("INSERT INTO lychee_albums (title, sysdate, public) VALUES ('$title', '$sysdate', '$public');"); $result = $database->query("INSERT INTO lychee_albums (title, sysdate, public, visible) VALUES ('$title', '$sysdate', '$public', '$visible');");
if (!$result) return false; if (!$result) return false;
return $database->insert_id; return $database->insert_id;
@ -31,7 +31,7 @@ function getAlbums($public) {
if (!$public) $return = getSmartInfo(); if (!$public) $return = getSmartInfo();
// Albums // Albums
if ($public) $query = "SELECT id, title, public, sysdate, password FROM lychee_albums WHERE public = 1"; if ($public) $query = "SELECT id, title, public, sysdate, password FROM lychee_albums WHERE public = 1 AND visible <> 0";
else $query = "SELECT id, title, public, sysdate, password FROM lychee_albums"; else $query = "SELECT id, title, public, sysdate, password FROM lychee_albums";
$result = $database->query($query) OR exit("Error: $result <br>".$database->error); $result = $database->query($query) OR exit("Error: $result <br>".$database->error);

View File

@ -119,7 +119,8 @@ function dbCreateTables($database) {
`title` varchar(50) NOT NULL, `title` varchar(50) NOT NULL,
`description` varchar(1000) DEFAULT '', `description` varchar(1000) DEFAULT '',
`sysdate` varchar(10) NOT NULL, `sysdate` varchar(10) NOT NULL,
`public` tinyint(1) DEFAULT '0', `public` tinyint(1) NOT NULL DEFAULT '0',
`visible` tinyint(1) NOT NULL DEFAULT '1',
`password` varchar(100) DEFAULT '', `password` varchar(100) DEFAULT '',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

View File

@ -87,6 +87,7 @@ function update($version = '') {
// Albums // Albums
if(!$database->query("SELECT `description` FROM `lychee_albums` LIMIT 1;")) $database->query("ALTER TABLE `lychee_albums` ADD `description` VARCHAR( 1000 ) NULL DEFAULT ''"); // v2.0 if(!$database->query("SELECT `description` FROM `lychee_albums` LIMIT 1;")) $database->query("ALTER TABLE `lychee_albums` ADD `description` VARCHAR( 1000 ) NULL DEFAULT ''"); // v2.0
if($database->query("SELECT `password` FROM `lychee_albums` LIMIT 1;")) $database->query("ALTER TABLE `lychee_albums` CHANGE `password` `password` VARCHAR( 100 ) NULL DEFAULT ''"); // v2.0 if($database->query("SELECT `password` FROM `lychee_albums` LIMIT 1;")) $database->query("ALTER TABLE `lychee_albums` CHANGE `password` `password` VARCHAR( 100 ) NULL DEFAULT ''"); // v2.0
if(!$database->query("SELECT `visible` FROM `lychee_albums` LIMIT 1;")) $database->query("ALTER TABLE `lychee_albums` ADD `visible` TINYINT(1) NOT NULL DEFAULT 1"); // v2.2
// Photos // Photos
if($database->query("SELECT `description` FROM `lychee_photos` LIMIT 1;")) $database->query("ALTER TABLE `lychee_photos` CHANGE `description` `description` VARCHAR( 1000 ) NULL DEFAULT ''"); // v2.0 if($database->query("SELECT `description` FROM `lychee_photos` LIMIT 1;")) $database->query("ALTER TABLE `lychee_photos` CHANGE `description` `description` VARCHAR( 1000 ) NULL DEFAULT ''"); // v2.0