From 5cce602a056ce4b87b619e13b76325204cd53f1f Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 30 Mar 2014 17:42:45 +0200 Subject: [PATCH] Added row `visible` --- php/modules/album.php | 8 ++++---- php/modules/db.php | 3 ++- php/modules/misc.php | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/php/modules/album.php b/php/modules/album.php index 7c077d2..c9369e0 100755 --- a/php/modules/album.php +++ b/php/modules/album.php @@ -9,14 +9,14 @@ if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); -function addAlbum($title, $public = 0) { +function addAlbum($title = '', $public = 0, $visible = 1) { 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"); - $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; return $database->insert_id; @@ -31,7 +31,7 @@ function getAlbums($public) { if (!$public) $return = getSmartInfo(); // 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"; $result = $database->query($query) OR exit("Error: $result
".$database->error); diff --git a/php/modules/db.php b/php/modules/db.php index 12ffb40..4b1bccf 100755 --- a/php/modules/db.php +++ b/php/modules/db.php @@ -119,7 +119,8 @@ function dbCreateTables($database) { `title` varchar(50) NOT NULL, `description` varchar(1000) DEFAULT '', `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 '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/php/modules/misc.php b/php/modules/misc.php index cd6bea7..8ede984 100755 --- a/php/modules/misc.php +++ b/php/modules/misc.php @@ -87,6 +87,7 @@ function update($version = '') { // 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 `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 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