Merge branch 'v2.5' of https://github.com/electerious/Lychee into uploader

Conflicts:
	assets/min/main.css
	assets/min/main.js
	assets/min/view.js
This commit is contained in:
Tobias Reich 2014-06-21 12:23:19 +02:00
commit 13dca6cb48
25 changed files with 287 additions and 117 deletions

View File

@ -156,13 +156,13 @@
margin-top: -1px;
margin-left: 12px;
padding: 12px 7px 3px 7px;
box-shadow: 0px 0px 3px #000;
box-shadow: 0px 0px 3px rgba(0, 0, 0, .8);
border-radius: 0px 0px 3px 3px;
border: 1px solid #fff;
border-top: none;
color: #fff;
font-size: 24px;
text-shadow: 0px 1px 0px #000;
text-shadow: 0px 1px 0px rgba(0, 0, 0, .4);
opacity: .9;
}
.album .badge.icon-star,
@ -236,7 +236,7 @@
color: #fff;
font-size: 14px;
font-weight: bold;
text-shadow: 0px -1px 0px #000;
text-shadow: 0px -1px 0px rgba(0, 0, 0, .8);
}
/* No Content ------------------------------------------------*/

View File

@ -15,15 +15,15 @@
top: 0px;
left: 0px;
padding: 5px 0px 6px 0px;
background-color: #393939;
background-image: -webkit-linear-gradient(top, #444, #2d2d2d);
background-image: -moz-linear-gradient(top, #393939, #2d2d2d);
background-image: -ms-linear-gradient(top, #393939, #2d2d2d);
background-image: linear-gradient(top, #393939, #2d2d2d);
border: 1px solid rgba(0,0,0,0.7);
border-bottom: 1px solid rgba(0,0,0,.9);
background-color: #444;
background-image: -webkit-linear-gradient(top, #444, #2f2f2f);
background-image: -moz-linear-gradient(top, #444, #2f2f2f);
background-image: -ms-linear-gradient(top, #444, #2f2f2f);
background-image: linear-gradient(top, #444, #2f2f2f);
border: 1px solid rgba(0,0,0,0.5);
border-bottom: 1px solid rgba(0,0,0,.7);
border-radius: 5px;
box-shadow: 0px 4px 5px rgba(0,0,0,0.3), inset 0px 1px 0px rgba(255,255,255,0.15), inset 1px 0px 0px rgba(255,255,255,0.05), inset -1px 0px 0px rgba(255,255,255,0.05);
box-shadow: 0px 3px 4px rgba(0,0,0,0.25), inset 0px 1px 0px rgba(255,255,255, .1);
opacity: 0;
z-index: 1001;
@ -36,15 +36,15 @@
.contextmenu tr {
font-size: 14px;
color: #eee;
text-shadow: 0px -1px 0px rgba(0,0,0,.4);
text-shadow: 0px -1px 0px rgba(0,0,0,.2);
cursor: pointer;
}
.contextmenu tr:hover {
background-color: #6a84f2;
background-image: -webkit-linear-gradient(top, #6a84f2, #3959ef);
background-image: -moz-linear-gradient(top, #6a84f2, #3959ef);
background-image: -ms-linear-gradient(top, #6a84f2, #3959ef);
background-image: linear-gradient(top, #6a84f2, #3959ef);
background-image: -webkit-linear-gradient(top, #6a84f2, #4967F0);
background-image: -moz-linear-gradient(top, #6a84f2, #4967F0);
background-image: -ms-linear-gradient(top, #6a84f2, #4967F0);
background-image: linear-gradient(top, #6a84f2, #4967F0);
}
.contextmenu tr.no_hover:hover {
cursor: inherit;
@ -55,8 +55,8 @@
float: left;
height: 1px;
width: 100%;
background-color: #1c1c1c;
border-bottom: 1px solid #4a4a4a;
background-color: #1f1f1f;
border-bottom: 1px solid #4c4c4c;
margin: 5px 0px;
cursor: inherit;
}
@ -74,7 +74,7 @@
.contextmenu tr:hover td {
color: #fff;
box-shadow: inset 0px 1px 0px rgba(255,255,255,.05);
text-shadow: 0px -1px 0px rgba(0,0,0,.4);
text-shadow: 0px -1px 0px rgba(0,0,0,.2);
}
.contextmenu tr.no_hover:hover td {
box-shadow: none;
@ -90,13 +90,13 @@
.contextmenu #link {
float: right;
width: 140px;
margin: 0px -17px -1px 0px;
padding: 4px 6px 5px 6px;
margin: -1px -18px -2px -1px;
padding: 5px 7px 6px 7px;
background-color: #444;
color: #fff;
border: none;
border: 1px solid #111;
box-shadow: 0px 1px 0px rgba(255,255,255,.1);
border: 1px solid rgba(0, 0, 0, .5);
box-shadow: 0px 1px 0px rgba(255,255,255,.08);
outline: none;
border-radius: 5px;
}

View File

@ -11,7 +11,7 @@
height: 100%;
top: 0px;
left: 0px;
background-color: rgba(0,0,0,.85);
background-color: rgba(0,0,0,.8);
}
#infobox {
z-index: 4;
@ -77,7 +77,7 @@
font-size: 16px;
font-weight: bold;
text-align: center;
text-shadow: 0px -1px 0px #000;
text-shadow: 0px -1px 0px rgba(0, 0, 0, .8);
}
#infobox .header a {
float: right;
@ -85,7 +85,7 @@
color: #fff;
font-size: 20px;
font-weight: bold;
text-shadow: 0px -1px 0px #000;
text-shadow: 0px -1px 0px rgba(0, 0, 0, .8);
opacity: .5;
cursor: pointer;
}
@ -105,7 +105,7 @@
color: #fff;
font-size: 14px;
font-weight: bold;
text-shadow: 0px -1px 0px #000;
text-shadow: 0px -1px 0px rgba(0, 0, 0, .8);
}
/* Table ------------------------------------------------*/

View File

@ -25,7 +25,7 @@
background-image: -ms-linear-gradient(top, rgb(75, 75, 75), rgb(45, 45, 45));
background-image: linear-gradient(top, rgb(75, 75, 75), rgb(45, 45, 45));
border-radius: 5px;
box-shadow: 0px 0px 5px #000, inset 0px 1px 0px rgba(255,255,255,.08), inset 1px 0px 0px rgba(255,255,255,.03), inset -1px 0px 0px rgba(255,255,255,.03);
box-shadow: 0px 0px 5px #000, inset 0px 1px 0px rgba(255,255,255,.08);
/* Animation */
-webkit-animation-name: moveUp;
@ -47,7 +47,7 @@
color: #fff;
font-size: 16px;
font-weight: bold;
text-shadow: 0px -1px 0px #222;
text-shadow: 0px -1px 0px rgba(0, 0, 0, .3);
text-align: center;
}
.message .close {
@ -57,7 +57,7 @@
padding: 12px 14px 6px 7px;
color: #aaa;
font-size: 20px;
text-shadow: 0px -1px 0px #222;
text-shadow: 0px -1px 0px rgba(0, 0, 0, .3);
cursor: pointer;
}
.message .close:hover {
@ -72,7 +72,7 @@
padding: 12px 5% 15px 5%;
color: #eee;
font-size: 14px;
text-shadow: 0px -1px 0px #222;
text-shadow: 0px -1px 0px rgba(0, 0, 0, .3);
line-height: 20px;
}
.message p b {
@ -88,20 +88,15 @@
.message .button {
float: right;
margin: 15px 15px 15px 0px;
padding: 6px 10px 8px 10px;
background-color: #4e4e4e;
background-image: -webkit-linear-gradient(top, rgb(60, 60, 60), rgb(45, 45, 45));
background-image: -moz-linear-gradient(top, rgb(60, 60, 60), rgb(45, 45, 45));
background-image: -ms-linear-gradient(top, rgb(60, 60, 60), rgb(45, 45, 45));
background-image: linear-gradient(top, rgb(60, 60, 60), rgb(45, 45, 45));
padding: 7px 10px 8px 10px;
color: #ccc;
font-size: 14px;
font-weight: bold;
text-align: center;
text-shadow: 0px -1px 0px #222;
border-radius: 5px;
border: 1px solid #191919;
box-shadow: inset 0px 1px 0px rgba(255,255,255,.1), 0px 1px 0px rgba(255,255,255,.1);
border: 1px solid rgba(0,0,0,.4);
box-shadow: inset 0px 1px 0px rgba(255,255,255,.08), 0px 1px 0px rgba(255,255,255,.05);
cursor: pointer;
}
.message .button:first-of-type {
@ -109,22 +104,22 @@
}
.message .button.active {
color: #fff;
box-shadow: inset 0px 1px 0px rgba(255,255,255,.1), 0px 1px 0px rgba(255,255,255,.1), 0px 0px 4px #005ecc;
box-shadow: inset 0px 1px 0px rgba(255,255,255,.08), 0px 1px 0px rgba(255,255,255,.1), 0px 0px 4px #005ecc;
}
.message .button:hover {
background-color: #565757;
background-image: -webkit-linear-gradient(top, rgb(80, 80, 80), rgb(57, 57, 57));
background-image: -moz-linear-gradient(top, rgb(80, 80, 80), rgb(57, 57, 57));
background-image: -ms-linear-gradient(top, rgb(80, 80, 80), rgb(57, 57, 57));
background-image: linear-gradient(top, rgb(80, 80, 80), rgb(57, 57, 57));
background-image: -webkit-linear-gradient(top, rgb(60, 60, 60), rgb(57, 57, 57));
background-image: -moz-linear-gradient(top, rgb(60, 60, 60), rgb(57, 57, 57));
background-image: -ms-linear-gradient(top, rgb(60, 60, 60), rgb(57, 57, 57));
background-image: linear-gradient(top, rgb(60, 60, 60), rgb(57, 57, 57));
}
.message .button:active,
.message .button.pressed {
background-color: #393939;
background-image: -webkit-linear-gradient(top, rgb(57, 57, 57), rgb(70, 70, 70));
background-image: -moz-linear-gradient(top, rgb(57, 57, 57), rgb(70, 70, 70));
background-image: -ms-linear-gradient(top, rgb(57, 57, 57), rgb(70, 70, 70));
background-image: linear-gradient(top, rgb(57, 57, 57), rgb(70, 70, 70));
background-image: -webkit-linear-gradient(top, rgb(57, 57, 57), rgb(60, 60, 60));
background-image: -moz-linear-gradient(top, rgb(57, 57, 57), rgb(60, 60, 60));
background-image: -ms-linear-gradient(top, rgb(57, 57, 57), rgb(60, 60, 60));
background-image: linear-gradient(top, rgb(57, 57, 57), rgb(60, 60, 60));
}
/* Sign in ------------------------------------------------*/
@ -213,7 +208,7 @@
color: #fff;
font-size: 14px;
font-weight: 700;
text-shadow: 0 -1px 0 #222;
text-shadow: 0 -1px 0 rgba(0, 0, 0, .3);
}
.message .choice p {
margin-top: 2px;

View File

@ -207,7 +207,14 @@ album = {
buttons = [
["Set Title", function() {
newTitle = ($(".message input.text").val()==="") ? "Untitled" : $(".message input.text").val();
// Get input
newTitle = $(".message input.text").val();
// Remove html from input
newTitle = lychee.removeHTML(newTitle);
// Set to Untitled when empty
newTitle = (newTitle==="") ? "Untitled" : newTitle;
if (visible.album()) {
@ -249,14 +256,18 @@ album = {
buttons = [
["Set Description", function() {
// Get input
description = $(".message input.text").val();
// Remove html from input
description = lychee.removeHTML(description);
if (visible.album()) {
album.json.description = description;
view.album.description();
}
params = "setAlbumDescription&albumID=" + photoID + "&description=" + escape(description);
params = "setAlbumDescription&albumID=" + photoID + "&description=" + escape(encodeURI(description));
lychee.api(params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -332,7 +343,7 @@ album = {
link = "http://www.facebook.com/sharer.php?u=" + encodeURI(url) + "&t=" + encodeURI(album.json.title);
break;
case 2:
link = "mailto:?subject=" + encodeURI(album.json.title) + "&body=" + encodeURI("Hi! Check this out: " + url);
link = "mailto:?subject=" + encodeURI(album.json.title) + "&body=" + encodeURI(url);
break;
default:
link = "";

View File

@ -333,7 +333,7 @@ build = {
["Tags", build.tags(photoJSON.tags, forView)]
];
if ((photoJSON.takedate+photoJSON.make+photoJSON.model+photoJSON.shutter+photoJSON.aperture+photoJSON.focal+photoJSON.iso)!="") {
if ((photoJSON.takestamp+photoJSON.make+photoJSON.model+photoJSON.shutter+photoJSON.aperture+photoJSON.focal+photoJSON.iso)!=="null") {
infos = infos.concat([
["", "Camera"],

View File

@ -86,8 +86,9 @@ contextMenu = {
function() { settings.setLogin() },
function() { settings.setSorting() },
function() { settings.setDropboxKey() },
function() { window.open(lychee.website, "_newtab"); },
function() { window.open("plugins/check/", "_newtab"); },
function() { window.open(lychee.website); },
function() { window.open("plugins/check/"); },
function() { window.open("plugins/displaylog/"); },
function() { lychee.logout() }
];
@ -98,8 +99,9 @@ contextMenu = {
["separator", -1],
["<a class='icon-info-sign'></a> About Lychee", 3],
["<a class='icon-dashboard'></a> Diagnostics", 4],
["<a class='icon-list'></a> Show Log", 5],
["separator", -1],
["<a class='icon-signout'></a> Sign Out", 5]
["<a class='icon-signout'></a> Sign Out", 6]
];
contextMenu.show(items, mouse_x, mouse_y, "right");
@ -217,7 +219,7 @@ contextMenu = {
items;
contextMenu.fns = [
function() { window.open(photo.getDirectLink(),"_newtab") },
function() { window.open(photo.getDirectLink()) },
function() { photo.getArchive(photoID) }
];
@ -276,7 +278,7 @@ contextMenu = {
function() { photo.share(photoID, 1) },
function() { photo.share(photoID, 2) },
function() { photo.share(photoID, 3) },
function() { window.open(photo.getDirectLink(),"_newtab") }
function() { window.open(photo.getDirectLink()) }
];
link = photo.getViewLink(photoID);

View File

@ -20,7 +20,7 @@ $(document).ready(function(){
$(document).on("mouseup", multiselect.getSelection);
/* Header */
$("#hostedwith").on(event_name, function() { window.open(lychee.website,"_newtab") });
$("#hostedwith").on(event_name, function() { window.open(lychee.website) });
$("#button_signin").on(event_name, lychee.loginDialog);
$("#button_settings").on("click", contextMenu.settings);
$("#button_share").on(event_name, function(e) {

View File

@ -8,7 +8,7 @@
var lychee = {
title: "",
version: "2.5 b2",
version: "2.5 rc1",
version_code: "020500",
api_path: "php/api.php",
@ -21,7 +21,7 @@ var lychee = {
publicMode: false,
viewMode: false,
debugMode: true,
debugMode: false,
username: "",
checkForUpdates: false,
@ -169,6 +169,7 @@ var lychee = {
photoID = "",
hash = document.location.hash.replace("#", "").split("/");
$(".no_content").remove();
contextMenu.close();
multiselect.close();
@ -344,6 +345,14 @@ var lychee = {
},
removeHTML: function(html) {
var tmp = document.createElement("DIV");
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText;
},
error: function(errorThrown, params, data) {
console.log("Error Description: " + errorThrown);

View File

@ -207,8 +207,12 @@ photo = {
buttons = [
["Set Title", function() {
// Get input
newTitle = $(".message input.text").val();
// Remove html from input
newTitle = lychee.removeHTML(newTitle);
if (visible.photo()) {
photo.json.title = (newTitle==="") ? "Untitled" : newTitle;
view.photo.title();
@ -337,14 +341,18 @@ photo = {
buttons = [
["Set Description", function() {
// Get input
description = $(".message input.text").val();
// Remove html from input
description = lychee.removeHTML(description);
if (visible.photo()) {
photo.json.description = description;
view.photo.description();
}
params = "setPhotoDescription&photoID=" + photoID + "&description=" + escape(description);
params = "setPhotoDescription&photoID=" + photoID + "&description=" + escape(encodeURI(description));
lychee.api(params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -410,6 +418,9 @@ photo = {
tags = tags.replace(/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/g, ',');
tags = tags.replace(/,$|^,|(\ ){0,}$/g, '');
// Remove html from input
tags = lychee.removeHTML(tags);
if (visible.photo()) {
photo.json.tags = tags;
view.photo.tags();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,6 +9,7 @@ Released -
- `New` Logging-System
- `New` Blowfish hash instead of MD5 for all new passwords (thanks @bb-Ricardo)
- `New` Compile Lychee using Grunt (with npm and bower)
- `New` Open full photo without making the photo public
- `Improved` Shortcuts
- `Improved` Album share dialog
- `Improved` Database update mechanism
@ -16,7 +17,7 @@ Released -
- `Improved` EXIF parsing
- `Improved` URL and Server import (thanks @djdallmann)
- `Improved` Check permissions on upload
- `Fixed` Wrong capture date in InfoBox
- `Fixed` Wrong capture date in Infobox
- `Fixed` Sorting by takedate
## v2.1.1

View File

@ -13,6 +13,7 @@ If possible, change these settings directly in your `php.ini`. We recommend to i
upload_max_size = 200M
upload_max_filesize = 20M
max_file_uploads = 100
memory_limit = 256M
#### Which browsers are supported?
Lychee supports the latest versions of Google Chrome, Apple Safari, Mozilla Firefox and Opera. Photos you share with others can be viewed from every browser.
@ -34,6 +35,12 @@ To backup your Lychee installation you need to do the following steps:
- INSERT INTO lychee_photos_backup SELECT * FROM lychee_photos;
- CREATE TABLE lychee_settings_backup LIKE lychee_settings;
- INSERT INTO lychee_settings_backup SELECT * FROM lychee_settings;
#### Can I use my existing folder-structure?
No. Lychee has it's own folder-structure and database. Please upload or import all your photos to use them.
#### Can I upload videos?
No. Video support is not planned.
#### What's the advantage of buying Lychee?
Lychee is completely free to use for personal usage. However, if you like Lychee or want to use in commercially, you need to buy Lychee from [our site](http://lychee.electerious.com). I hope you appreciate my work and support further development by buying a license.

View File

@ -16,7 +16,7 @@ class Guest extends Access {
switch ($fn) {
# Album functions
case 'getAlbums': $this->getAlbums(); break;
case 'getAlbums': $this->getAlbums(); break;
case 'getAlbum': $this->getAlbum(); break;
case 'checkAlbumAccess': $this->checkAlbumAccess(); break;
@ -25,7 +25,8 @@ class Guest extends Access {
# Session functions
case 'init': $this->init(); break;
case 'login': $this->login(); break;
case 'login': $this->login(); break;
case 'logout': $this->logout(); break;
# $_GET functions
case 'getAlbumArchive': $this->getAlbumArchive(); break;
@ -121,6 +122,13 @@ class Guest extends Access {
}
private function logout() {
$session = new Session($this->plugins, $this->settings);
echo $session->logout();
}
# $_GET functions
private function getAlbumArchive() {

View File

@ -8,22 +8,34 @@
if(!$database->query("SELECT `tags` FROM `lychee_photos` LIMIT 1;")) {
$result = $database->query("ALTER TABLE `lychee_photos` ADD `tags` VARCHAR( 1000 ) NULL DEFAULT ''");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
}
$result = $database->query("SELECT `key` FROM `lychee_settings` WHERE `key` = 'dropboxKey' LIMIT 1;");
if ($result->num_rows===0) {
$result = $database->query("INSERT INTO `lychee_settings` (`key`, `value`) VALUES ('dropboxKey', '')");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
}
$result = $database->query("SELECT `key` FROM `lychee_settings` WHERE `key` = 'version' LIMIT 1;");
if ($result->num_rows===0) {
$result = $database->query("INSERT INTO `lychee_settings` (`key`, `value`) VALUES ('version', '020100')");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
} else {
$result = $database->query("UPDATE lychee_settings SET value = '020100' WHERE `key` = 'version';");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
}
?>

View File

@ -7,9 +7,15 @@
###
$result = $database->query("ALTER TABLE `lychee_settings` CHANGE `value` `value` VARCHAR( 200 ) NULL DEFAULT ''");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020101', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
$result = $database->query("UPDATE lychee_settings SET value = '020101' WHERE `key` = 'version';");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020101', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
?>

View File

@ -8,10 +8,16 @@
if (!$database->query("SELECT `visible` FROM `lychee_albums` LIMIT 1;")) {
$result = $database->query("ALTER TABLE `lychee_albums` ADD `visible` TINYINT(1) NOT NULL DEFAULT 1");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020200', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
}
$result = $database->query("UPDATE lychee_settings SET value = '020200' WHERE `key` = 'version';");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020200', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
?>

View File

@ -10,19 +10,28 @@
$result = $database->query("SELECT `key` FROM `lychee_settings` WHERE `key` = 'plugins' LIMIT 1;");
if ($result->num_rows===0) {
$result = $database->query("INSERT INTO `lychee_settings` (`key`, `value`) VALUES ('plugins', '')");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
}
# Add `takestamp`
if (!$database->query("SELECT `takestamp` FROM `lychee_photos` LIMIT 1;")) {
$result = $database->query("ALTER TABLE `lychee_photos` ADD `takestamp` INT(11) DEFAULT NULL");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
}
# Convert to `takestamp`
if ($database->query("SELECT `takedate`, `taketime` FROM `lychee_photos` LIMIT 1;")) {
$result = $database->query("SELECT `id`, `takedate`, `taketime` FROM `lychee_photos` WHERE `takedate` <> '' AND `taketime` <> '';");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
while ($photo = $result->fetch_object()) {
$takestamp = strtotime($photo->takedate . $photo->taketime);
$database->query("UPDATE `lychee_photos` SET `takestamp` = '$takestamp' WHERE `id` = '$photo->id';");
@ -45,13 +54,19 @@ if ($database->query("SELECT `sysdate`, `systime` FROM `lychee_photos` LIMIT 1;"
# Add `sysstamp`
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 (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
}
# Convert to `sysstamp`
if ($database->query("SELECT `sysdate` FROM `lychee_albums` LIMIT 1;")) {
$result = $database->query("SELECT `id`, `sysdate` FROM `lychee_albums`;");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
while ($album = $result->fetch_object()) {
$sysstamp = strtotime($album->sysdate);
$database->query("UPDATE `lychee_albums` SET `sysstamp` = '$sysstamp' WHERE `id` = '$album->id';");
@ -61,34 +76,58 @@ if ($database->query("SELECT `sysdate` FROM `lychee_albums` LIMIT 1;")) {
# Set character of database
$result = $database->query("ALTER DATABASE $dbName CHARACTER SET utf8 COLLATE utf8_general_ci;");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
# Set character
$result = $database->query("ALTER TABLE `lychee_albums` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
# Set character
$result = $database->query("ALTER TABLE `lychee_photos` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
# Set character
$result = $database->query("ALTER TABLE `lychee_settings` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
# Set album password length to 100 (for longer hashes)
$result = $database->query("ALTER TABLE `lychee_albums` CHANGE `password` `password` VARCHAR(100);");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
# Set make length to 50
$result = $database->query("ALTER TABLE `lychee_photos` CHANGE `make` `make` VARCHAR(50);");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
# Reset sorting
$result = $database->query("UPDATE lychee_settings SET value = 'ORDER BY takestamp DESC' WHERE `key` = 'sorting' AND `value` LIKE '%UNIX_TIMESTAMP%';");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
# Set version
$result = $database->query("UPDATE lychee_settings SET value = '020500' WHERE `key` = 'version';");
if (!$result) return false;
if (!$result) {
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
?>

View File

@ -237,6 +237,12 @@ class Album extends Module {
# Call plugins
$this->plugins(__METHOD__, 0, func_get_args());
# Illicit chars
$badChars = array_merge(
array_map('chr', range(0,31)),
array("<", ">", ":", '"', "/", "\\", "|", "?", "*")
);
# Photos query
switch($this->albumIDs) {
case 's':
@ -255,6 +261,10 @@ class Album extends Module {
# Set title
$album = $this->database->query("SELECT title FROM lychee_albums WHERE id = '$this->albumIDs' LIMIT 1;");
if ($this->albumIDs!=0&&is_numeric($this->albumIDs)) $zipTitle = $album->fetch_object()->title;
# Parse title
$zipTitle = str_replace($badChars, '', $zipTitle);
$filename = LYCHEE_DATA . $zipTitle . '.zip';
# Create zip
@ -281,10 +291,6 @@ class Album extends Module {
$photo->url = LYCHEE_UPLOADS_BIG . $photo->url;
# Parse title
$badChars = array_merge(
array_map('chr', range(0,31)),
array("<", ">", ":", '"', "/", "\\", "|", "?", "*")
);
$photo->title = str_replace($badChars, '', $photo->title);
if (!isset($photo->title)||$photo->title==='') $photo->title = 'Untitled';
@ -295,7 +301,7 @@ class Album extends Module {
$extension = getExtension($photo->url);
# Set title for photo
$zipFileName = $zipTitle . '/' . $photo->title . '.' . $extension;
$zipFileName = $zipTitle . '/' . $photo->title . $extension;
# Check for duplicates
if (!empty($files)) {

View File

@ -140,16 +140,28 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
$query = @file_get_contents($file);
# Create table
if (!isset($query)||$query===false) return false;
if (!$database->query($query)) return false;
if (!isset($query)||$query===false) {
Log::error($database, __METHOD__, __LINE__, 'Could not load query for lychee_settings');
return false;
}
if (!$database->query($query)) {
Log::error($database, __METHOD__, __LINE__, $database->error);
return false;
}
# Read file
$file = __DIR__ . '/../database/settings_content.sql';
$query = @file_get_contents($file);
# Add content
if (!isset($query)||$query===false) return false;
if (!$database->query($query)) return false;
if (!isset($query)||$query===false) {
Log::error($database, __METHOD__, __LINE__, 'Could not load content-query for lychee_settings');
return false;
}
if (!$database->query($query)) {
Log::error($database, __METHOD__, __LINE__, $database->error);
return false;
}
}
@ -161,8 +173,14 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
$query = @file_get_contents($file);
# Create table
if (!isset($query)||$query===false) return false;
if (!$database->query($query)) return false;
if (!isset($query)||$query===false) {
Log::error($database, __METHOD__, __LINE__, 'Could not load query for lychee_albums');
return false;
}
if (!$database->query($query)) {
Log::error($database, __METHOD__, __LINE__, $database->error);
return false;
}
}
@ -174,8 +192,14 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
$query = @file_get_contents($file);
# Create table
if (!isset($query)||$query===false) return false;
if (!$database->query($query)) return false;
if (!isset($query)||$query===false) {
Log::error($database, __METHOD__, __LINE__, 'Could not load query for lychee_photos');
return false;
}
if (!$database->query($query)) {
Log::error($database, __METHOD__, __LINE__, $database->error);
return false;
}
}

View File

@ -110,17 +110,14 @@ class Photo extends Module {
$info = $this->getInfo($path);
# Use title of file if IPTC title missing
if ($info['title']==='') $info['title'] = mysqli_real_escape_string($this->database, substr(basename($file['name'], ".$extension"), 0, 30));
if ($info['title']==='') $info['title'] = mysqli_real_escape_string($this->database, substr(basename($file['name'], $extension), 0, 30));
# Use description parameter if set
if ($description==='') $description = $info['description'];
# Set orientation based on EXIF data
if ($file['type']==='image/jpeg'&&isset($info['orientation'])&&$info['orientation']!==''&&isset($info['width'])&&isset($info['height'])) {
if (!$this->adjustFile($path, $info)) {
Log::error($this->database, __METHOD__, __LINE__, 'Could not adjust photo');
exit('Error: Could not adjust photo!');
}
if (!$this->adjustFile($path, $info)) Log::notice($this->database, __METHOD__, __LINE__, 'Could not adjust photo (' . $info['title'] . ')');
}
# Set original date
@ -621,7 +618,7 @@ class Photo extends Module {
# Call plugins
$this->plugins(__METHOD__, 1, func_get_args());
if ($error) {
if ($error===true) {
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
return false;
}
@ -720,7 +717,7 @@ class Photo extends Module {
$tags = preg_replace('/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/', ',', $tags);
$tags = preg_replace('/,$|^,|(\ ){0,}$/', '', $tags);
if (strlen($tags)>1000) {
Log::error($this->database, __METHOD__, __LINE__, 'Length of tags higher than 1000');
Log::notice($this->database, __METHOD__, __LINE__, 'Length of tags higher than 1000');
return false;
}

View File

@ -31,8 +31,12 @@ class Session extends Module {
$this->plugins(__METHOD__, 0, func_get_args());
# Update
if (!isset($this->settings['version'])||$this->settings['version']!==$version)
if (!Database::update($database, $dbName, @$this->settings['version'])) exit('Error: Updating the database failed!');
if (!isset($this->settings['version'])||$this->settings['version']!==$version) {
if (!Database::update($database, $dbName, @$this->settings['version'])) {
Log::error($database, __METHOD__, __LINE__, 'Updating the database failed');
exit('Error: Updating the database failed!');
}
}
# Return settings
$return['config'] = $this->settings;

View File

@ -70,12 +70,18 @@ class Settings extends Module {
# Parse
$username = htmlentities($username);
if (strlen($username)>50) return false;
if (strlen($username)>50) {
Log::notice($this->database, __METHOD__, __LINE__, 'Username is longer than 50 chars');
return false;
}
# Execute query
$result = $this->database->query("UPDATE lychee_settings SET value = '$username' WHERE `key` = 'username';");
if (!$result) return false;
if (!$result) {
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
return false;
}
return true;
}
@ -90,7 +96,10 @@ class Settings extends Module {
# Execute query
$result = $this->database->query("UPDATE lychee_settings SET value = '$password' WHERE `key` = 'password';");
if (!$result) return false;
if (!$result) {
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
return false;
}
return true;
}
@ -100,12 +109,18 @@ class Settings extends Module {
# Check dependencies
$this->dependencies(isset($this->database, $key));
if (strlen($key)<1||strlen($key)>50) return false;
if (strlen($key)<1||strlen($key)>50) {
Log::notice($this->database, __METHOD__, __LINE__, 'Dropbox key is either too short or too long');
return false;
}
# Execute query
$result = $this->database->query("UPDATE lychee_settings SET value = '$key' WHERE `key` = 'dropboxKey';");
if (!$result) return false;
if (!$result) {
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
return false;
}
return true;
}
@ -163,7 +178,10 @@ class Settings extends Module {
# Execute query
$result = $this->database->query("UPDATE lychee_settings SET value = '$sorting' WHERE `key` = 'sorting';");
if (!$result) return false;
if (!$result) {
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
return false;
}
return true;
}