@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @name multiselect.css
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
#multiselect {
|
||||
position: absolute;
|
||||
background-color: rgba(0, 94, 204, .3);
|
||||
border: 1px solid rgba(0, 94, 204, 1);
|
||||
border-radius: 3px;
|
||||
z-index: 3;
|
||||
}
|
@ -1,339 +0,0 @@
|
||||
/**
|
||||
* @name Photo Module
|
||||
* @description Takes care of every action a photo can handle and execute.
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
photo = {
|
||||
|
||||
json: null,
|
||||
|
||||
getID: function() {
|
||||
|
||||
var id;
|
||||
|
||||
if (photo.json) id = photo.json.id;
|
||||
else id = $(".photo:hover, .photo.active").attr("data-id");
|
||||
|
||||
if (id) return id;
|
||||
else return false;
|
||||
|
||||
},
|
||||
|
||||
load: function(photoID, albumID) {
|
||||
|
||||
var params,
|
||||
checkPasswd;
|
||||
|
||||
params = "getPhoto&photoID=" + photoID + "&albumID=" + albumID + "&password=" + password.value;
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data==="Warning: Wrong password!") {
|
||||
checkPasswd = function() {
|
||||
if (password.value!=="") photo.load(photoID, albumID);
|
||||
else setTimeout(checkPasswd, 250);
|
||||
}
|
||||
checkPasswd();
|
||||
return false;
|
||||
}
|
||||
|
||||
photo.json = data;
|
||||
if (!visible.photo()) view.photo.show();
|
||||
view.photo.init();
|
||||
|
||||
lychee.imageview.show();
|
||||
setTimeout(function() { lychee.content.show() }, 300);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
parse: function() {
|
||||
|
||||
if (!photo.json.title) photo.json.title = "Untitled";
|
||||
photo.json.url = lychee.upload_path_big + photo.json.url;
|
||||
|
||||
},
|
||||
|
||||
delete: function(photoID) {
|
||||
|
||||
var params,
|
||||
buttons,
|
||||
photoTitle;
|
||||
|
||||
if (!photoID) return false;
|
||||
|
||||
if (visible.photo()) photoTitle = photo.json.title;
|
||||
else photoTitle = album.json.content[photoID].title;
|
||||
if (photoTitle=="") photoTitle = "Untitled";
|
||||
|
||||
buttons = [
|
||||
["Delete Photo", function() {
|
||||
|
||||
// Change reference for the next and previous photo
|
||||
if (album.json.content[photoID].nextPhoto!==""||album.json.content[photoID].previousPhoto!=="") {
|
||||
|
||||
nextPhoto = album.json.content[photoID].nextPhoto;
|
||||
previousPhoto = album.json.content[photoID].previousPhoto;
|
||||
|
||||
album.json.content[previousPhoto].nextPhoto = nextPhoto;
|
||||
album.json.content[nextPhoto].previousPhoto = previousPhoto;
|
||||
|
||||
}
|
||||
|
||||
album.json.content[photoID] = null;
|
||||
|
||||
view.album.content.delete(photoID);
|
||||
|
||||
// Only when search is not active
|
||||
if (!visible.albums()) lychee.goto(album.getID());
|
||||
|
||||
params = "deletePhoto&photoID=" + photoID;
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
}],
|
||||
["Keep Photo", function() {}]
|
||||
];
|
||||
modal.show("Delete Photo", "Are you sure you want to delete the photo '" + photoTitle + "'?<br>This action can't be undone!", buttons);
|
||||
|
||||
},
|
||||
|
||||
setTitle: function(photoID) {
|
||||
|
||||
var oldTitle = "",
|
||||
newTitle,
|
||||
params,
|
||||
buttons;
|
||||
|
||||
if (!photoID) return false;
|
||||
if (photo.json) oldTitle = photo.json.title;
|
||||
else if (album.json) oldTitle = album.json.content[photoID].title;
|
||||
|
||||
buttons = [
|
||||
["Set Title", function() {
|
||||
|
||||
newTitle = $(".message input.text").val();
|
||||
|
||||
if (photoID!=null&&photoID&&newTitle.length<31) {
|
||||
|
||||
if (visible.photo()) {
|
||||
photo.json.title = (newTitle==="") ? "Untitled" : newTitle;
|
||||
view.photo.title(oldTitle);
|
||||
}
|
||||
|
||||
album.json.content[photoID].title = newTitle;
|
||||
view.album.content.title(photoID);
|
||||
|
||||
params = "setPhotoTitle&photoID=" + photoID + "&title=" + escape(encodeURI(newTitle));
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
} else if (newTitle.length>0) loadingBar.show("error", "New title to short or too long. Please try another one!");
|
||||
|
||||
}],
|
||||
["Cancel", function() {}]
|
||||
];
|
||||
modal.show("Set Title", "Please enter a new title for this photo: <input class='text' type='text' placeholder='Title' value='" + oldTitle + "'>", buttons);
|
||||
|
||||
},
|
||||
|
||||
setAlbum: function(albumID, photoID) {
|
||||
|
||||
var params;
|
||||
|
||||
if (albumID>=0) {
|
||||
|
||||
// Change reference for the next and previous photo
|
||||
if (album.json.content[photoID].nextPhoto!==""||album.json.content[photoID].previousPhoto!=="") {
|
||||
|
||||
nextPhoto = album.json.content[photoID].nextPhoto;
|
||||
previousPhoto = album.json.content[photoID].previousPhoto;
|
||||
|
||||
album.json.content[previousPhoto].nextPhoto = nextPhoto;
|
||||
album.json.content[nextPhoto].previousPhoto = previousPhoto;
|
||||
|
||||
}
|
||||
|
||||
if (visible.photo) lychee.goto(album.getID());
|
||||
album.json.content[photoID] = null;
|
||||
view.album.content.delete(photoID);
|
||||
|
||||
params = "setAlbum&photoID=" + photoID + "&albumID=" + albumID;
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
setStar: function(photoID) {
|
||||
|
||||
var params;
|
||||
|
||||
if (visible.photo()) {
|
||||
photo.json.star = (photo.json.star==0) ? 1 : 0;
|
||||
view.photo.star();
|
||||
}
|
||||
|
||||
album.json.content[photoID].star = (album.json.content[photoID].star==0) ? 1 : 0;
|
||||
view.album.content.star(photoID);
|
||||
|
||||
params = "setPhotoStar&photoID=" + photoID;
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
setPublic: function(photoID, e) {
|
||||
|
||||
var params;
|
||||
|
||||
if (photo.json.public==2) {
|
||||
|
||||
modal.show("Public Album", "This photo is located in a public album. To make this photo private or public, edit the visibility of the associated album.", [["Show Album", function() { lychee.goto(photo.json.original_album) }], ["Close", function() {}]]);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (visible.photo()) {
|
||||
|
||||
photo.json.public = (photo.json.public==0) ? 1 : 0;
|
||||
view.photo.public();
|
||||
if (photo.json.public==1) contextMenu.sharePhoto(photoID, e);
|
||||
|
||||
}
|
||||
|
||||
album.json.content[photoID].public = (album.json.content[photoID].public==0) ? 1 : 0;
|
||||
view.album.content.public(photoID);
|
||||
|
||||
params = "setPhotoPublic&photoID=" + photoID + "&url=" + photo.getViewLink(photoID);
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
setDescription: function(photoID) {
|
||||
|
||||
var oldDescription = photo.json.description,
|
||||
description,
|
||||
params,
|
||||
buttons;
|
||||
|
||||
buttons = [
|
||||
["Set Description", function() {
|
||||
|
||||
description = $(".message input.text").val();
|
||||
|
||||
if (description.length<800) {
|
||||
|
||||
if (visible.photo()) {
|
||||
photo.json.description = description;
|
||||
view.photo.description();
|
||||
}
|
||||
|
||||
params = "setPhotoDescription&photoID=" + photoID + "&description=" + escape(description);
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
} else loadingBar.show("error", "Description too long. Please try again!");
|
||||
|
||||
}],
|
||||
["Cancel", function() {}]
|
||||
];
|
||||
modal.show("Set Description", "Please enter a description for this photo: <input class='text' type='text' placeholder='Description' value='" + oldDescription + "'>", buttons);
|
||||
|
||||
},
|
||||
|
||||
share: function(photoID, service) {
|
||||
|
||||
var link = "",
|
||||
url = photo.getViewLink(photoID),
|
||||
filename = "unknown";
|
||||
|
||||
switch (service) {
|
||||
case 0:
|
||||
link = "https://twitter.com/share?url=" + encodeURI(url);
|
||||
break;
|
||||
case 1:
|
||||
link = "http://www.facebook.com/sharer.php?u=" + encodeURI(url) + "&t=" + encodeURI(photo.json.title);
|
||||
break;
|
||||
case 2:
|
||||
link = "mailto:?subject=" + encodeURI(photo.json.title) + "&body=" + encodeURI(url);
|
||||
break;
|
||||
case 3:
|
||||
lychee.loadDropbox(function() {
|
||||
filename = photo.json.title + "." + photo.getDirectLink().split('.').pop();
|
||||
Dropbox.save(photo.getDirectLink(), filename);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
link = "";
|
||||
break;
|
||||
}
|
||||
|
||||
if (link.length>5) location.href = link;
|
||||
|
||||
},
|
||||
|
||||
isSmall: function() {
|
||||
|
||||
var size = [
|
||||
["width", false],
|
||||
["height", false]
|
||||
];
|
||||
|
||||
if (photo.json.width<$(window).width()-60) size["width"] = true;
|
||||
if (photo.json.height<$(window).height()-100) size["height"] = true;
|
||||
|
||||
if (size["width"]&&size["height"]) return true;
|
||||
else return false;
|
||||
|
||||
},
|
||||
|
||||
getArchive: function(photoID) {
|
||||
|
||||
var link;
|
||||
|
||||
if (location.href.indexOf("index.html")>0) link = location.href.replace(location.hash, "").replace("index.html", "php/api.php?function=getPhotoArchive&photoID=" + photoID);
|
||||
else link = location.href.replace(location.hash, "") + "php/api.php?function=getPhotoArchive&photoID=" + photoID;
|
||||
|
||||
if (lychee.publicMode) link += "&password=" + password.value;
|
||||
|
||||
location.href = link;
|
||||
|
||||
},
|
||||
|
||||
getDirectLink: function() {
|
||||
|
||||
return $("#imageview #image").css("background-image").replace(/"/g,"").replace(/url\(|\)$/ig, "");
|
||||
|
||||
},
|
||||
|
||||
getViewLink: function(photoID) {
|
||||
|
||||
if (location.href.indexOf("index.html")>0) return location.href.replace("index.html" + location.hash, "view.php?p=" + photoID);
|
||||
else return location.href.replace(location.hash, "view.php?p=" + photoID);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,468 +0,0 @@
|
||||
/**
|
||||
* @name UI View
|
||||
* @description Responsible to reflect data changes to the UI.
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
view = {
|
||||
|
||||
header: {
|
||||
|
||||
show: function() {
|
||||
|
||||
clearTimeout($(window).data("timeout"));
|
||||
|
||||
if (visible.photo()) {
|
||||
lychee.imageview.removeClass("full");
|
||||
lychee.loadingBar.css("opacity", 1);
|
||||
lychee.header.removeClass("hidden");
|
||||
if ($("#imageview #image.small").length>0) {
|
||||
$("#imageview #image").css({
|
||||
marginTop: -1*($("#imageview #image").height()/2)+20
|
||||
});
|
||||
} else {
|
||||
$("#imageview #image").css({
|
||||
top: 60,
|
||||
right: 30,
|
||||
bottom: 30,
|
||||
left: 30
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
|
||||
if (visible.photo()&&!visible.infobox()&&!visible.contextMenu()&&!visible.message()) {
|
||||
clearTimeout($(window).data("timeout"));
|
||||
$(window).data("timeout", setTimeout(function() {
|
||||
lychee.imageview.addClass("full");
|
||||
lychee.loadingBar.css("opacity", 0);
|
||||
lychee.header.addClass("hidden");
|
||||
if ($("#imageview #image.small").length>0) {
|
||||
$("#imageview #image").css({
|
||||
marginTop: -1*($("#imageview #image").height()/2)
|
||||
});
|
||||
} else {
|
||||
$("#imageview #image").css({
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0
|
||||
});
|
||||
}
|
||||
}, 500));
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
mode: function(mode) {
|
||||
|
||||
var albumID = album.getID();
|
||||
|
||||
switch (mode) {
|
||||
case "albums":
|
||||
lychee.header.removeClass("view");
|
||||
$("#tools_album, #tools_photo").hide();
|
||||
$("#tools_albums").show();
|
||||
break;
|
||||
case "album":
|
||||
lychee.header.removeClass("view");
|
||||
$("#tools_albums, #tools_photo").hide();
|
||||
$("#tools_album").show();
|
||||
album.json.content === false ? $("#button_archive").hide() : $("#button_archive").show();
|
||||
if (albumID==="s"||albumID==="f") {
|
||||
$("#button_info_album, #button_trash_album, #button_share_album").hide();
|
||||
} else if (albumID==="0") {
|
||||
$("#button_info_album, #button_share_album").hide();
|
||||
$("#button_trash_album").show();
|
||||
} else {
|
||||
$("#button_info_album, #button_trash_album, #button_share_album").show();
|
||||
}
|
||||
break;
|
||||
case "photo":
|
||||
lychee.header.addClass("view");
|
||||
$("#tools_albums, #tools_album").hide();
|
||||
$("#tools_photo").show();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
infobox: {
|
||||
|
||||
show: function() {
|
||||
|
||||
if (!visible.infobox()) $("body").append("<div id='infobox_overlay' class='fadeIn'></div>");
|
||||
lychee.infobox.addClass("active");
|
||||
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
|
||||
lychee.animate("#infobox_overlay", "fadeOut");
|
||||
setTimeout(function() { $("#infobox_overlay").remove() }, 300);
|
||||
lychee.infobox.removeClass("active");
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
albums: {
|
||||
|
||||
init: function() {
|
||||
|
||||
view.albums.title();
|
||||
view.albums.content.init();
|
||||
|
||||
},
|
||||
|
||||
title: function() {
|
||||
|
||||
lychee.setTitle("Albums", false);
|
||||
|
||||
},
|
||||
|
||||
content: {
|
||||
|
||||
init: function() {
|
||||
|
||||
var smartData = "",
|
||||
albumsData = "";
|
||||
|
||||
/* Smart Albums */
|
||||
albums.parse(albums.json.unsortedAlbum);
|
||||
albums.parse(albums.json.publicAlbum);
|
||||
albums.parse(albums.json.starredAlbum);
|
||||
if (!lychee.publicMode) smartData = build.divider("Smart Albums") + build.album(albums.json.unsortedAlbum) + build.album(albums.json.starredAlbum) + build.album(albums.json.publicAlbum);
|
||||
|
||||
/* Albums */
|
||||
if (albums.json.content) {
|
||||
|
||||
if (!lychee.publicMode) albumsData = build.divider("Albums");
|
||||
$.each(albums.json.content, function() {
|
||||
albums.parse(this);
|
||||
albumsData += build.album(this);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (smartData===""&&albumsData==="") $("body").append(build.no_content("picture"));
|
||||
else lychee.content.html(smartData + albumsData);
|
||||
|
||||
$("img[data-type!='svg']").retina();
|
||||
|
||||
},
|
||||
|
||||
title: function(albumID) {
|
||||
|
||||
var prefix = "",
|
||||
longTitle = "",
|
||||
title = albums.json.content[albumID].title;
|
||||
|
||||
if (albums.json.content[albumID].password) prefix = "<span class='icon-lock'></span> ";
|
||||
if (title.length>18) {
|
||||
longTitle = title;
|
||||
title = title.substr(0, 18) + "...";
|
||||
}
|
||||
|
||||
$(".album[data-id='" + albumID + "'] .overlay h1")
|
||||
.html(prefix + title)
|
||||
.attr("title", longTitle);
|
||||
|
||||
},
|
||||
|
||||
delete: function(albumID) {
|
||||
|
||||
$(".album[data-id='" + albumID + "']").css("opacity", 0).animate({
|
||||
width: 0,
|
||||
marginLeft: 0
|
||||
}, 300, function() {
|
||||
$(this).remove();
|
||||
if (albums.json.num<=0) lychee.animate(".divider:last-of-type", "fadeOut");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
album: {
|
||||
|
||||
init: function() {
|
||||
|
||||
album.parse();
|
||||
|
||||
view.album.infobox();
|
||||
view.album.title();
|
||||
view.album.public();
|
||||
view.album.content.init();
|
||||
|
||||
album.json.init = 1;
|
||||
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
|
||||
view.infobox.hide();
|
||||
|
||||
},
|
||||
|
||||
title: function(oldTitle) {
|
||||
|
||||
if ((visible.album()||!album.json.init)&&!visible.photo()) {
|
||||
|
||||
switch (album.getID()) {
|
||||
case "f":
|
||||
lychee.setTitle("Starred", false);
|
||||
break;
|
||||
case "s":
|
||||
lychee.setTitle("Public", false);
|
||||
break;
|
||||
case "0":
|
||||
lychee.setTitle("Unsorted", false);
|
||||
break;
|
||||
default:
|
||||
if (album.json.init) $("#infobox .attr_name").html(album.json.title + " " + build.editIcon("edit_title_album"));
|
||||
lychee.setTitle(album.json.title, true);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
description: function() {
|
||||
|
||||
$("#infobox .attr_description").html(album.json.description + " " + build.editIcon("edit_description_album"));
|
||||
|
||||
},
|
||||
|
||||
content: {
|
||||
|
||||
init: function() {
|
||||
|
||||
var photosData = "";
|
||||
|
||||
$.each(album.json.content, function() {
|
||||
album.parse(this);
|
||||
photosData += build.photo(this);
|
||||
});
|
||||
lychee.content.html(photosData);
|
||||
|
||||
$("img[data-type!='svg']").retina();
|
||||
|
||||
},
|
||||
|
||||
title: function(photoID) {
|
||||
|
||||
var longTitle = "",
|
||||
title = album.json.content[photoID].title;
|
||||
|
||||
if (title.length>18) {
|
||||
longTitle = title;
|
||||
title = title.substr(0, 18) + "...";
|
||||
}
|
||||
|
||||
$(".photo[data-id='" + photoID + "'] .overlay h1")
|
||||
.html(title)
|
||||
.attr("title", longTitle);
|
||||
|
||||
},
|
||||
|
||||
star: function(photoID) {
|
||||
|
||||
$(".photo[data-id='" + photoID + "'] .icon-star").remove();
|
||||
if (album.json.content[photoID].star==1) $(".photo[data-id='" + photoID + "']").append("<a class='badge red icon-star'></a>");
|
||||
|
||||
},
|
||||
|
||||
public: function(photoID) {
|
||||
|
||||
$(".photo[data-id='" + photoID + "'] .icon-share").remove();
|
||||
if (album.json.content[photoID].public==1) $(".photo[data-id='" + photoID + "']").append("<a class='badge red icon-share'></a>");
|
||||
|
||||
},
|
||||
|
||||
delete: function(photoID) {
|
||||
|
||||
$(".photo[data-id='" + photoID + "']").css("opacity", 0).animate({
|
||||
width: 0,
|
||||
marginLeft: 0
|
||||
}, 300, function() {
|
||||
$(this).remove();
|
||||
// Only when search is not active
|
||||
if (!visible.albums()) {
|
||||
album.json.num--;
|
||||
view.album.num();
|
||||
view.album.title();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
num: function() {
|
||||
|
||||
$("#infobox .attr_images").html(album.json.num);
|
||||
|
||||
},
|
||||
|
||||
public: function() {
|
||||
|
||||
if (album.json.public==1) {
|
||||
$("#button_share_album a").addClass("active");
|
||||
$("#button_share_album").attr("title", "Share Album");
|
||||
$(".photo .icon-share").remove();
|
||||
if (album.json.init) $("#infobox .attr_visibility").html("Public");
|
||||
} else {
|
||||
$("#button_share_album a").removeClass("active");
|
||||
$("#button_share_album").attr("title", "Make Public");
|
||||
if (album.json.init) $("#infobox .attr_visibility").html("Private");
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
password: function() {
|
||||
|
||||
if (album.json.password==1) $("#infobox .attr_password").html("Yes");
|
||||
else $("#infobox .attr_password").html("No");
|
||||
|
||||
},
|
||||
|
||||
infobox: function() {
|
||||
|
||||
if ((visible.album()||!album.json.init)&&!visible.photo()) lychee.infobox.html(build.infoboxAlbum(album.json)).show();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
photo: {
|
||||
|
||||
init: function() {
|
||||
|
||||
photo.parse();
|
||||
|
||||
view.photo.infobox();
|
||||
view.photo.title();
|
||||
view.photo.star();
|
||||
view.photo.public();
|
||||
view.photo.photo();
|
||||
|
||||
photo.json.init = 1;
|
||||
|
||||
},
|
||||
|
||||
show: function() {
|
||||
|
||||
// Change header
|
||||
lychee.content.addClass("view");
|
||||
view.header.mode("photo");
|
||||
|
||||
// Make body not scrollable
|
||||
$("body").css("overflow", "hidden");
|
||||
|
||||
// Fullscreen
|
||||
$(document)
|
||||
.bind("mouseenter", view.header.show)
|
||||
.bind("mouseleave", view.header.hide);
|
||||
|
||||
lychee.animate(lychee.imageview, "fadeIn");
|
||||
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
|
||||
if (!visible.controls()) view.header.show();
|
||||
if (visible.infobox) view.infobox.hide();
|
||||
|
||||
lychee.content.removeClass("view");
|
||||
view.header.mode("album");
|
||||
|
||||
// Make body scrollable
|
||||
$("body").css("overflow", "auto");
|
||||
|
||||
// Disable Fullscreen
|
||||
$(document)
|
||||
.unbind("mouseenter")
|
||||
.unbind("mouseleave");
|
||||
|
||||
// Hide Photo
|
||||
lychee.animate(lychee.imageview, "fadeOut");
|
||||
setTimeout(function() {
|
||||
lychee.imageview.hide();
|
||||
view.album.infobox();
|
||||
}, 300);
|
||||
|
||||
},
|
||||
|
||||
title: function(oldTitle) {
|
||||
|
||||
if (photo.json.init) $("#infobox .attr_name").html(photo.json.title + " " + build.editIcon("edit_title"));
|
||||
lychee.setTitle(photo.json.title, true);
|
||||
|
||||
},
|
||||
|
||||
description: function() {
|
||||
|
||||
if (photo.json.init) $("#infobox .attr_description").html(photo.json.description + " " + build.editIcon("edit_description"));
|
||||
|
||||
},
|
||||
|
||||
star: function() {
|
||||
|
||||
$("#button_star a").removeClass("icon-star-empty icon-star");
|
||||
if (photo.json.star==1) {
|
||||
// Starred
|
||||
$("#button_star a").addClass("icon-star");
|
||||
$("#button_star").attr("title", "Unstar Photo");
|
||||
} else {
|
||||
// Unstarred
|
||||
$("#button_star a").addClass("icon-star-empty");
|
||||
$("#button_star").attr("title", "Star Photo");
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
public: function() {
|
||||
|
||||
if (photo.json.public==1||photo.json.public==2) {
|
||||
// Photo public
|
||||
$("#button_share a").addClass("active");
|
||||
$("#button_share").attr("title", "Share Photo");
|
||||
if (photo.json.init) $("#infobox .attr_visibility").html("Public");
|
||||
} else {
|
||||
// Photo private
|
||||
$("#button_share a").removeClass("active");
|
||||
$("#button_share").attr("title", "Make Public");
|
||||
if (photo.json.init) $("#infobox .attr_visibility").html("Private");
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
photo: function() {
|
||||
|
||||
lychee.imageview.html(build.imageview(photo.json, photo.isSmall(), visible.controls()));
|
||||
|
||||
if ((album.json&&album.json.content[photo.getID()]&&album.json.content[photo.getID()].nextPhoto==="")||lychee.viewMode) $("a#next").hide();
|
||||
if ((album.json&&album.json.content[photo.getID()]&&album.json.content[photo.getID()].previousPhoto==="")||lychee.viewMode) $("a#previous").hide();
|
||||
|
||||
},
|
||||
|
||||
infobox: function() {
|
||||
|
||||
lychee.infobox.html(build.infoboxPhoto(photo.json)).show();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/**
|
||||
* @name Visible Module
|
||||
* @description This module is used to check if elements are visible or not.
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
visible = {
|
||||
|
||||
albums: function() {
|
||||
if ($("#tools_albums").css("display")==="block") return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
album: function() {
|
||||
if ($("#tools_album").css("display")==="block") return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
photo: function() {
|
||||
if ($("#imageview.fadeIn").length>0) return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
infobox: function() {
|
||||
if ($("#infobox.active").length>0) return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
controls: function() {
|
||||
if (lychee.loadingBar.css("opacity")<1) return false;
|
||||
else return true;
|
||||
},
|
||||
|
||||
message: function() {
|
||||
if ($(".message").length>0) return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
signin: function() {
|
||||
if ($(".message .sign_in").length>0) return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
contextMenu: function() {
|
||||
if ($(".contextmenu").length>0) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
/**
|
||||
* @name Multiselect Module
|
||||
* @description Select multiple albums or photos.
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
multiselect = {
|
||||
|
||||
position: {
|
||||
|
||||
top: null,
|
||||
right: null,
|
||||
bottom: null,
|
||||
left: null
|
||||
|
||||
},
|
||||
|
||||
show: function(e) {
|
||||
|
||||
if (mobileBrowser()) return false;
|
||||
if (lychee.publicMode) return false;
|
||||
if (visible.search()) return false;
|
||||
if ($('.album:hover, .photo:hover').length!==0) return false;
|
||||
if (visible.multiselect()) $('#multiselect').remove();
|
||||
|
||||
multiselect.position.top = e.pageY;
|
||||
multiselect.position.right = -1 * (e.pageX - $(document).width());
|
||||
multiselect.position.bottom = -1 * (multiselect.position.top - $(window).height());
|
||||
multiselect.position.left = e.pageX;
|
||||
|
||||
$('body').append(build.multiselect(multiselect.position.top, multiselect.position.left));
|
||||
$(document).on('mousemove', multiselect.resize);
|
||||
|
||||
},
|
||||
|
||||
resize: function(e) {
|
||||
|
||||
var mouse_x = e.pageX,
|
||||
mouse_y = e.pageY,
|
||||
newHeight,
|
||||
newWidth;
|
||||
|
||||
if (multiselect.position.top===null||
|
||||
multiselect.position.right===null||
|
||||
multiselect.position.bottom===null||
|
||||
multiselect.position.left===null) return false;
|
||||
|
||||
if (mouse_y>=multiselect.position.top) {
|
||||
|
||||
// Do not leave the screen
|
||||
newHeight = e.pageY - multiselect.position.top;
|
||||
if ((multiselect.position.top+newHeight)>=$(document).height())
|
||||
newHeight -= (multiselect.position.top + newHeight) - $(document).height() + 2;
|
||||
|
||||
$('#multiselect').css({
|
||||
top: multiselect.position.top,
|
||||
bottom: 'inherit',
|
||||
height: newHeight
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
$('#multiselect').css({
|
||||
top: 'inherit',
|
||||
bottom: multiselect.position.bottom,
|
||||
height: multiselect.position.top - e.pageY
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (mouse_x>=multiselect.position.left) {
|
||||
|
||||
// Do not leave the screen
|
||||
newWidth = e.pageX - multiselect.position.left;
|
||||
if ((multiselect.position.left+newWidth)>=$(document).width())
|
||||
newWidth -= (multiselect.position.left + newWidth) - $(document).width() + 2;
|
||||
|
||||
$('#multiselect').css({
|
||||
right: 'inherit',
|
||||
left: multiselect.position.left,
|
||||
width: newWidth
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
$('#multiselect').css({
|
||||
right: multiselect.position.right,
|
||||
left: 'inherit',
|
||||
width: multiselect.position.left - e.pageX
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
stopResize: function() {
|
||||
|
||||
$(document).off('mousemove');
|
||||
|
||||
},
|
||||
|
||||
getSize: function() {
|
||||
|
||||
if (!visible.multiselect()) return false;
|
||||
|
||||
return {
|
||||
top: $('#multiselect').offset().top,
|
||||
left: $('#multiselect').offset().left,
|
||||
width: parseInt($('#multiselect').css('width').replace('px', '')),
|
||||
height: parseInt($('#multiselect').css('height').replace('px', ''))
|
||||
};
|
||||
|
||||
},
|
||||
|
||||
getSelection: function(e) {
|
||||
|
||||
var tolerance = 150,
|
||||
id,
|
||||
ids = [],
|
||||
offset,
|
||||
size = multiselect.getSize();
|
||||
|
||||
if (visible.contextMenu()) return false;
|
||||
if (!visible.multiselect()) return false;
|
||||
|
||||
$('.photo, .album').each(function() {
|
||||
|
||||
offset = $(this).offset();
|
||||
|
||||
if (offset.top>=(size.top-tolerance)&&
|
||||
offset.left>=(size.left-tolerance)&&
|
||||
(offset.top+206)<=(size.top+size.height+tolerance)&&
|
||||
(offset.left+206)<=(size.left+size.width+tolerance)) {
|
||||
|
||||
id = $(this).data('id');
|
||||
|
||||
if (id!=='0'&&id!==0&&id!=='f'&&id!=='s'&&id!==null&id!==undefined) {
|
||||
|
||||
ids.push(id);
|
||||
$(this).addClass('active');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (ids.length!==0&&visible.album()) contextMenu.photoMulti(ids, e);
|
||||
else if (ids.length!==0&&visible.albums()) contextMenu.albumMulti(ids, e);
|
||||
else multiselect.close();
|
||||
|
||||
},
|
||||
|
||||
close: function() {
|
||||
|
||||
multiselect.stopResize();
|
||||
|
||||
multiselect.position.top = null;
|
||||
multiselect.position.right = null;
|
||||
multiselect.position.bottom = null;
|
||||
multiselect.position.left = null;
|
||||
|
||||
lychee.animate('#multiselect', 'fadeOut');
|
||||
setTimeout(function() {
|
||||
$('#multiselect').remove();
|
||||
}, 300);
|
||||
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,454 @@
|
||||
/**
|
||||
* @name Photo Module
|
||||
* @description Takes care of every action a photo can handle and execute.
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
photo = {
|
||||
|
||||
json: null,
|
||||
|
||||
getID: function() {
|
||||
|
||||
var id;
|
||||
|
||||
if (photo.json) id = photo.json.id;
|
||||
else id = $(".photo:hover, .photo.active").attr("data-id");
|
||||
|
||||
if (id) return id;
|
||||
else return false;
|
||||
|
||||
},
|
||||
|
||||
load: function(photoID, albumID) {
|
||||
|
||||
var params,
|
||||
checkPasswd;
|
||||
|
||||
params = "getPhoto&photoID=" + photoID + "&albumID=" + albumID + "&password=" + password.value;
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data==="Warning: Wrong password!") {
|
||||
checkPasswd = function() {
|
||||
if (password.value!=="") photo.load(photoID, albumID);
|
||||
else setTimeout(checkPasswd, 250);
|
||||
};
|
||||
checkPasswd();
|
||||
return false;
|
||||
}
|
||||
|
||||
photo.json = data;
|
||||
if (!visible.photo()) view.photo.show();
|
||||
view.photo.init();
|
||||
|
||||
lychee.imageview.show();
|
||||
setTimeout(function() { lychee.content.show() }, 300);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
parse: function() {
|
||||
|
||||
if (!photo.json.title) photo.json.title = "Untitled";
|
||||
photo.json.url = lychee.upload_path_big + photo.json.url;
|
||||
|
||||
},
|
||||
|
||||
delete: function(photoIDs) {
|
||||
|
||||
var params,
|
||||
buttons,
|
||||
photoTitle;
|
||||
|
||||
if (!photoIDs) return false;
|
||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs];
|
||||
|
||||
if (photoIDs.length===1) {
|
||||
// Get title if only one photo is selected
|
||||
if (visible.photo()) photoTitle = photo.json.title;
|
||||
else photoTitle = album.json.content[photoIDs].title;
|
||||
if (photoTitle==="") photoTitle = "Untitled";
|
||||
}
|
||||
|
||||
buttons = [
|
||||
["", function() {
|
||||
|
||||
photoIDs.forEach(function(id, index, array) {
|
||||
|
||||
// Change reference for the next and previous photo
|
||||
if (album.json.content[id].nextPhoto!==""||album.json.content[id].previousPhoto!=="") {
|
||||
|
||||
nextPhoto = album.json.content[id].nextPhoto;
|
||||
previousPhoto = album.json.content[id].previousPhoto;
|
||||
|
||||
album.json.content[previousPhoto].nextPhoto = nextPhoto;
|
||||
album.json.content[nextPhoto].previousPhoto = previousPhoto;
|
||||
|
||||
}
|
||||
|
||||
album.json.content[id] = null;
|
||||
view.album.content.delete(id);
|
||||
|
||||
});
|
||||
|
||||
// Only when search is not active
|
||||
if (!visible.albums()) lychee.goto(album.getID());
|
||||
|
||||
params = "deletePhoto&photoIDs=" + photoIDs;
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
}],
|
||||
["", function() {}]
|
||||
];
|
||||
|
||||
if (photoIDs.length===1) {
|
||||
|
||||
buttons[0][0] = "Delete Photo";
|
||||
buttons[1][0] = "Keep Photo";
|
||||
|
||||
modal.show("Delete Photo", "Are you sure you want to delete the photo '" + photoTitle + "'?<br>This action can't be undone!", buttons);
|
||||
|
||||
} else {
|
||||
|
||||
buttons[0][0] = "Delete Photos";
|
||||
buttons[1][0] = "Keep Photos";
|
||||
|
||||
modal.show("Delete Photos", "Are you sure you want to delete all " + photoIDs.length + " selected photo?<br>This action can't be undone!", buttons);
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
setTitle: function(photoIDs) {
|
||||
|
||||
var oldTitle = "",
|
||||
newTitle,
|
||||
params,
|
||||
buttons;
|
||||
|
||||
if (!photoIDs) return false;
|
||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs];
|
||||
|
||||
if (photoIDs.length===1) {
|
||||
// Get old title if only one photo is selected
|
||||
if (photo.json) oldTitle = photo.json.title;
|
||||
else if (album.json) oldTitle = album.json.content[photoIDs].title;
|
||||
oldTitle = oldTitle.replace("'", "'");
|
||||
}
|
||||
|
||||
buttons = [
|
||||
["Set Title", function() {
|
||||
|
||||
newTitle = $(".message input.text").val();
|
||||
|
||||
if (visible.photo()) {
|
||||
photo.json.title = (newTitle==="") ? "Untitled" : newTitle;
|
||||
view.photo.title();
|
||||
}
|
||||
|
||||
photoIDs.forEach(function(id, index, array) {
|
||||
album.json.content[id].title = newTitle;
|
||||
view.album.content.title(id);
|
||||
});
|
||||
|
||||
params = "setPhotoTitle&photoIDs=" + photoIDs + "&title=" + escape(encodeURI(newTitle));
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
}],
|
||||
["Cancel", function() {}]
|
||||
];
|
||||
|
||||
if (photoIDs.length===1) modal.show("Set Title", "Enter a new title for this photo: <input class='text' type='text' maxlength='30' placeholder='Title' value='" + oldTitle + "'>", buttons);
|
||||
else modal.show("Set Titles", "Enter a title for all " + photoIDs.length + " selected photos: <input class='text' type='text' maxlength='30' placeholder='Title' value=''>", buttons);
|
||||
|
||||
},
|
||||
|
||||
setAlbum: function(photoIDs, albumID) {
|
||||
|
||||
var params,
|
||||
nextPhoto,
|
||||
previousPhoto;
|
||||
|
||||
if (!photoIDs) return false;
|
||||
if (visible.photo) lychee.goto(album.getID());
|
||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs];
|
||||
|
||||
photoIDs.forEach(function(id, index, array) {
|
||||
|
||||
// Change reference for the next and previous photo
|
||||
if (album.json.content[id].nextPhoto!==""||album.json.content[id].previousPhoto!=="") {
|
||||
|
||||
nextPhoto = album.json.content[id].nextPhoto;
|
||||
previousPhoto = album.json.content[id].previousPhoto;
|
||||
|
||||
album.json.content[previousPhoto].nextPhoto = nextPhoto;
|
||||
album.json.content[nextPhoto].previousPhoto = previousPhoto;
|
||||
|
||||
}
|
||||
|
||||
album.json.content[id] = null;
|
||||
view.album.content.delete(id);
|
||||
|
||||
});
|
||||
|
||||
params = "setPhotoAlbum&photoIDs=" + photoIDs + "&albumID=" + albumID;
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
setStar: function(photoIDs) {
|
||||
|
||||
var params;
|
||||
|
||||
if (!photoIDs) return false;
|
||||
if (visible.photo()) {
|
||||
photo.json.star = (photo.json.star==0) ? 1 : 0;
|
||||
view.photo.star();
|
||||
}
|
||||
|
||||
photoIDs.forEach(function(id, index, array) {
|
||||
album.json.content[id].star = (album.json.content[id].star==0) ? 1 : 0;
|
||||
view.album.content.star(id);
|
||||
});
|
||||
|
||||
params = "setPhotoStar&photoIDs=" + photoIDs;
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
setPublic: function(photoID, e) {
|
||||
|
||||
var params;
|
||||
|
||||
if (photo.json.public==2) {
|
||||
|
||||
modal.show("Public Album", "This photo is located in a public album. To make this photo private or public, edit the visibility of the associated album.", [["Show Album", function() { lychee.goto(photo.json.original_album) }], ["Close", function() {}]]);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (visible.photo()) {
|
||||
|
||||
photo.json.public = (photo.json.public==0) ? 1 : 0;
|
||||
view.photo.public();
|
||||
if (photo.json.public==1) contextMenu.sharePhoto(photoID, e);
|
||||
|
||||
}
|
||||
|
||||
album.json.content[photoID].public = (album.json.content[photoID].public==0) ? 1 : 0;
|
||||
view.album.content.public(photoID);
|
||||
|
||||
params = "setPhotoPublic&photoID=" + photoID + "&url=" + photo.getViewLink(photoID);
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
setDescription: function(photoID) {
|
||||
|
||||
var oldDescription = photo.json.description.replace("'", "'"),
|
||||
description,
|
||||
params,
|
||||
buttons;
|
||||
|
||||
buttons = [
|
||||
["Set Description", function() {
|
||||
|
||||
description = $(".message input.text").val();
|
||||
|
||||
if (visible.photo()) {
|
||||
photo.json.description = description;
|
||||
view.photo.description();
|
||||
}
|
||||
|
||||
params = "setPhotoDescription&photoID=" + photoID + "&description=" + escape(description);
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
}],
|
||||
["Cancel", function() {}]
|
||||
];
|
||||
|
||||
modal.show("Set Description", "Enter a description for this photo: <input class='text' type='text' maxlength='800' placeholder='Description' value='" + oldDescription + "'>", buttons);
|
||||
|
||||
},
|
||||
|
||||
editTags: function(photoIDs) {
|
||||
|
||||
var oldTags = "",
|
||||
tags = "";
|
||||
|
||||
if (!photoIDs) return false;
|
||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs];
|
||||
|
||||
// Get tags
|
||||
if (visible.photo()) oldTags = photo.json.tags;
|
||||
if (visible.album()&&photoIDs.length===1) oldTags = album.json.content[photoIDs].tags;
|
||||
if (visible.album()&&photoIDs.length>1) {
|
||||
var same = true;
|
||||
photoIDs.forEach(function(id, index, array) {
|
||||
if(album.json.content[id].tags===album.json.content[photoIDs[0]].tags&&same===true) same = true;
|
||||
else same = false;
|
||||
});
|
||||
if (same) oldTags = album.json.content[photoIDs[0]].tags;
|
||||
}
|
||||
|
||||
// Improve tags
|
||||
oldTags = oldTags.replace(/,/g, ', ');
|
||||
|
||||
buttons = [
|
||||
["Set Tags", function() {
|
||||
|
||||
tags = $(".message input.text").val();
|
||||
|
||||
photo.setTags(photoIDs, tags);
|
||||
|
||||
}],
|
||||
["Cancel", function() {}]
|
||||
];
|
||||
|
||||
if (photoIDs.length===1) modal.show("Set Tags", "Enter your tags for this photo. You can add multiple tags by separating them with a comma: <input class='text' type='text' maxlength='800' placeholder='Tags' value='" + oldTags + "'>", buttons);
|
||||
else modal.show("Set Tags", "Enter your tags for all " + photoIDs.length + " selected photos. Existing tags will be overwritten. You can add multiple tags by separating them with a comma: <input class='text' type='text' maxlength='800' placeholder='Tags' value='" + oldTags + "'>", buttons);
|
||||
|
||||
},
|
||||
|
||||
setTags: function(photoIDs, tags) {
|
||||
|
||||
var params;
|
||||
|
||||
if (!photoIDs) return false;
|
||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs];
|
||||
|
||||
// Parse tags
|
||||
tags = tags.replace(/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/g, ',');
|
||||
tags = tags.replace(/,$|^,/g, '');
|
||||
|
||||
if (visible.photo()) {
|
||||
photo.json.tags = tags;
|
||||
view.photo.tags();
|
||||
}
|
||||
|
||||
photoIDs.forEach(function(id, index, array) {
|
||||
album.json.content[id].tags = tags;
|
||||
});
|
||||
|
||||
params = "setPhotoTags&photoIDs=" + photoIDs + "&tags=" + tags;
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
deleteTag: function(photoID, index) {
|
||||
|
||||
var tags;
|
||||
|
||||
// Remove
|
||||
tags = photo.json.tags.split(',');
|
||||
tags.splice(index, 1);
|
||||
|
||||
// Save
|
||||
photo.json.tags = tags.toString();
|
||||
photo.setTags([photoID], photo.json.tags);
|
||||
|
||||
},
|
||||
|
||||
share: function(photoID, service) {
|
||||
|
||||
var link = "",
|
||||
url = photo.getViewLink(photoID),
|
||||
filename = "unknown";
|
||||
|
||||
switch (service) {
|
||||
case 0:
|
||||
link = "https://twitter.com/share?url=" + encodeURI(url);
|
||||
break;
|
||||
case 1:
|
||||
link = "http://www.facebook.com/sharer.php?u=" + encodeURI(url) + "&t=" + encodeURI(photo.json.title);
|
||||
break;
|
||||
case 2:
|
||||
link = "mailto:?subject=" + encodeURI(photo.json.title) + "&body=" + encodeURI(url);
|
||||
break;
|
||||
case 3:
|
||||
lychee.loadDropbox(function() {
|
||||
filename = photo.json.title + "." + photo.getDirectLink().split('.').pop();
|
||||
Dropbox.save(photo.getDirectLink(), filename);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
link = "";
|
||||
break;
|
||||
}
|
||||
|
||||
if (link.length>5) location.href = link;
|
||||
|
||||
},
|
||||
|
||||
isSmall: function() {
|
||||
|
||||
var size = {
|
||||
width: false,
|
||||
height: false
|
||||
};
|
||||
|
||||
if (photo.json.width<$(window).width()-60) size.width = true;
|
||||
if (photo.json.height<$(window).height()-100) size.height = true;
|
||||
|
||||
if (size.width&&size.height) return true;
|
||||
else return false;
|
||||
|
||||
},
|
||||
|
||||
getArchive: function(photoID) {
|
||||
|
||||
var link;
|
||||
|
||||
if (location.href.indexOf("index.html")>0) link = location.href.replace(location.hash, "").replace("index.html", "php/api.php?function=getPhotoArchive&photoID=" + photoID);
|
||||
else link = location.href.replace(location.hash, "") + "php/api.php?function=getPhotoArchive&photoID=" + photoID;
|
||||
|
||||
if (lychee.publicMode) link += "&password=" + password.value;
|
||||
|
||||
location.href = link;
|
||||
|
||||
},
|
||||
|
||||
getDirectLink: function() {
|
||||
|
||||
return $("#imageview #image").css("background-image").replace(/"/g,"").replace(/url\(|\)$/ig, "");
|
||||
|
||||
},
|
||||
|
||||
getViewLink: function(photoID) {
|
||||
|
||||
if (location.href.indexOf("index.html")>0) return location.href.replace("index.html" + location.hash, "view.php?p=" + photoID);
|
||||
else return location.href.replace(location.hash, "view.php?p=" + photoID);
|
||||
|
||||
}
|
||||
|
||||
};
|
@ -1,112 +1,474 @@
|
||||
/**
|
||||
* @name View
|
||||
* @description Used to view single photos with view.php
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
* @name UI View
|
||||
* @description Responsible to reflect data changes to the UI.
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
var header = $("header"),
|
||||
headerTitle = $("#title"),
|
||||
imageview = $("#imageview"),
|
||||
api_path = "php/api.php",
|
||||
infobox = $("#infobox");
|
||||
view = {
|
||||
|
||||
header: {
|
||||
|
||||
show: function() {
|
||||
|
||||
clearTimeout($(window).data("timeout"));
|
||||
|
||||
if (visible.photo()) {
|
||||
lychee.imageview.removeClass("full");
|
||||
lychee.loadingBar.css("opacity", 1);
|
||||
lychee.header.removeClass("hidden");
|
||||
if ($("#imageview #image.small").length>0) {
|
||||
$("#imageview #image").css({
|
||||
marginTop: -1*($("#imageview #image").height()/2)+20
|
||||
});
|
||||
} else {
|
||||
$("#imageview #image").css({
|
||||
top: 60,
|
||||
right: 30,
|
||||
bottom: 30,
|
||||
left: 30
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
},
|
||||
|
||||
/* Event Name */
|
||||
if (mobileBrowser()) event_name = "touchend";
|
||||
else event_name = "click";
|
||||
hide: function() {
|
||||
|
||||
/* Window */
|
||||
$(window).keydown(key);
|
||||
if (visible.photo()&&!visible.infobox()&&!visible.contextMenu()&&!visible.message()) {
|
||||
clearTimeout($(window).data("timeout"));
|
||||
$(window).data("timeout", setTimeout(function() {
|
||||
lychee.imageview.addClass("full");
|
||||
lychee.loadingBar.css("opacity", 0);
|
||||
lychee.header.addClass("hidden");
|
||||
if ($("#imageview #image.small").length>0) {
|
||||
$("#imageview #image").css({
|
||||
marginTop: -1*($("#imageview #image").height()/2)
|
||||
});
|
||||
} else {
|
||||
$("#imageview #image").css({
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0
|
||||
});
|
||||
}
|
||||
}, 500));
|
||||
}
|
||||
|
||||
/* Infobox */
|
||||
$(document).on(event_name, "#infobox .header a", function() { hideInfobox() });
|
||||
$(document).on(event_name, "#infobox_overlay", function() { hideInfobox() });
|
||||
$("#button_info").on(event_name, function() { showInfobox() });
|
||||
},
|
||||
|
||||
/* Direct Link */
|
||||
$("#button_direct").on(event_name, function() {
|
||||
mode: function(mode) {
|
||||
|
||||
link = $("#imageview #image").css("background-image").replace(/"/g,"").replace(/url\(|\)$/ig, "");
|
||||
window.open(link,"_newtab");
|
||||
var albumID = album.getID();
|
||||
|
||||
});
|
||||
switch (mode) {
|
||||
case "albums":
|
||||
lychee.header.removeClass("view");
|
||||
$("#tools_album, #tools_photo").hide();
|
||||
$("#tools_albums").show();
|
||||
break;
|
||||
case "album":
|
||||
lychee.header.removeClass("view");
|
||||
$("#tools_albums, #tools_photo").hide();
|
||||
$("#tools_album").show();
|
||||
album.json.content === false ? $("#button_archive").hide() : $("#button_archive").show();
|
||||
if (albumID==="s"||albumID==="f") {
|
||||
$("#button_info_album, #button_trash_album, #button_share_album").hide();
|
||||
} else if (albumID==="0") {
|
||||
$("#button_info_album, #button_share_album").hide();
|
||||
$("#button_trash_album").show();
|
||||
} else {
|
||||
$("#button_info_album, #button_trash_album, #button_share_album").show();
|
||||
}
|
||||
break;
|
||||
case "photo":
|
||||
lychee.header.addClass("view");
|
||||
$("#tools_albums, #tools_album").hide();
|
||||
$("#tools_photo").show();
|
||||
break;
|
||||
|
||||
loadPhotoInfo(gup("p"));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function key(e) {
|
||||
},
|
||||
|
||||
code = (e.keyCode ? e.keyCode : e.which);
|
||||
if (code===27&&visibleInfobox()) { hideInfobox(); e.preventDefault(); }
|
||||
infobox: {
|
||||
|
||||
}
|
||||
show: function() {
|
||||
|
||||
function visibleInfobox() {
|
||||
if (!visible.infobox()) $("body").append("<div id='infobox_overlay' class='fadeIn'></div>");
|
||||
lychee.infobox.addClass("active");
|
||||
|
||||
if (parseInt(infobox.css("right").replace("px", ""))<0) return false;
|
||||
else return true;
|
||||
},
|
||||
|
||||
}
|
||||
hide: function() {
|
||||
|
||||
function isPhotoSmall(photo) {
|
||||
lychee.animate("#infobox_overlay", "fadeOut");
|
||||
setTimeout(function() { $("#infobox_overlay").remove() }, 300);
|
||||
lychee.infobox.removeClass("active");
|
||||
|
||||
size = [
|
||||
["width", false],
|
||||
["height", false]
|
||||
];
|
||||
}
|
||||
|
||||
if (photo.width<$(window).width()-60) size["width"] = true;
|
||||
if (photo.height<$(window).height()-100) size["height"] = true;
|
||||
},
|
||||
|
||||
if (size["width"]&&size["height"]) return true;
|
||||
else return false;
|
||||
albums: {
|
||||
|
||||
}
|
||||
init: function() {
|
||||
|
||||
function showInfobox() {
|
||||
view.albums.title();
|
||||
view.albums.content.init();
|
||||
|
||||
$("body").append("<div id='infobox_overlay' class='fadeIn'></div>");
|
||||
infobox.addClass("active");
|
||||
},
|
||||
|
||||
}
|
||||
title: function() {
|
||||
|
||||
function hideInfobox() {
|
||||
lychee.setTitle("Albums", false);
|
||||
|
||||
$("#infobox_overlay").removeClass("fadeIn").addClass("fadeOut");
|
||||
setTimeout(function() { $("#infobox_overlay").remove() }, 300);
|
||||
infobox.removeClass("active");
|
||||
},
|
||||
|
||||
}
|
||||
content: {
|
||||
|
||||
function loadPhotoInfo(photoID) {
|
||||
init: function() {
|
||||
|
||||
params = "function=getPhoto&photoID=" + photoID + "&albumID=0&password=''";
|
||||
$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
|
||||
var smartData = "",
|
||||
albumsData = "";
|
||||
|
||||
if (!data.title) data.title = "Untitled";
|
||||
document.title = "Lychee - " + data.title;
|
||||
headerTitle.html(data.title);
|
||||
/* Smart Albums */
|
||||
albums.parse(albums.json.unsortedAlbum);
|
||||
albums.parse(albums.json.publicAlbum);
|
||||
albums.parse(albums.json.starredAlbum);
|
||||
if (!lychee.publicMode) smartData = build.divider("Smart Albums") + build.album(albums.json.unsortedAlbum) + build.album(albums.json.starredAlbum) + build.album(albums.json.publicAlbum);
|
||||
|
||||
data.url = "uploads/big/" + data.url;
|
||||
/* Albums */
|
||||
if (albums.json.content) {
|
||||
|
||||
imageview.attr("data-id", photoID);
|
||||
if (isPhotoSmall(data)) imageview.html("<div id='image' class='small' style='background-image: url(" + data.url + "); width: " + data.width + "px; height: " + data.height + "px; margin-top: -" + parseInt((data.height/2)-20) + "px; margin-left: -" + data.width/2 + "px;'></div>");
|
||||
else imageview.html("<div id='image' style='background-image: url(" + data.url + ");'></div>");
|
||||
imageview.removeClass("fadeOut").addClass("fadeIn").show();
|
||||
if (!lychee.publicMode) albumsData = build.divider("Albums");
|
||||
$.each(albums.json.content, function() {
|
||||
albums.parse(this);
|
||||
albumsData += build.album(this);
|
||||
});
|
||||
|
||||
infobox.html(build.infoboxPhoto(data, true)).show();
|
||||
}
|
||||
|
||||
}, error: ajaxError });
|
||||
if (smartData===""&&albumsData==="") $("body").append(build.no_content("picture"));
|
||||
else lychee.content.html(smartData + albumsData);
|
||||
|
||||
}
|
||||
$("img[data-type!='svg']").retina();
|
||||
|
||||
function ajaxError(jqXHR, textStatus, errorThrown) {
|
||||
},
|
||||
|
||||
console.log(jqXHR);
|
||||
console.log(textStatus);
|
||||
console.log(errorThrown);
|
||||
title: function(albumID) {
|
||||
|
||||
}
|
||||
var prefix = "",
|
||||
longTitle = "",
|
||||
title = albums.json.content[albumID].title;
|
||||
|
||||
if (albums.json.content[albumID].password) prefix = "<span class='icon-lock'></span> ";
|
||||
if (title.length>18) {
|
||||
longTitle = title;
|
||||
title = title.substr(0, 18) + "...";
|
||||
}
|
||||
|
||||
$(".album[data-id='" + albumID + "'] .overlay h1")
|
||||
.html(prefix + title)
|
||||
.attr("title", longTitle);
|
||||
|
||||
},
|
||||
|
||||
delete: function(albumID) {
|
||||
|
||||
$(".album[data-id='" + albumID + "']").css("opacity", 0).animate({
|
||||
width: 0,
|
||||
marginLeft: 0
|
||||
}, 300, function() {
|
||||
$(this).remove();
|
||||
if (albums.json.num<=0) lychee.animate(".divider:last-of-type", "fadeOut");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
album: {
|
||||
|
||||
init: function() {
|
||||
|
||||
album.parse();
|
||||
|
||||
view.album.infobox();
|
||||
view.album.title();
|
||||
view.album.public();
|
||||
view.album.content.init();
|
||||
|
||||
album.json.init = 1;
|
||||
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
|
||||
view.infobox.hide();
|
||||
|
||||
},
|
||||
|
||||
title: function() {
|
||||
|
||||
if ((visible.album()||!album.json.init)&&!visible.photo()) {
|
||||
|
||||
switch (album.getID()) {
|
||||
case "f":
|
||||
lychee.setTitle("Starred", false);
|
||||
break;
|
||||
case "s":
|
||||
lychee.setTitle("Public", false);
|
||||
break;
|
||||
case "0":
|
||||
lychee.setTitle("Unsorted", false);
|
||||
break;
|
||||
default:
|
||||
if (album.json.init) $("#infobox .attr_name").html(album.json.title + " " + build.editIcon("edit_title_album"));
|
||||
lychee.setTitle(album.json.title, true);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
description: function() {
|
||||
|
||||
$("#infobox .attr_description").html(album.json.description + " " + build.editIcon("edit_description_album"));
|
||||
|
||||
},
|
||||
|
||||
content: {
|
||||
|
||||
init: function() {
|
||||
|
||||
var photosData = "";
|
||||
|
||||
$.each(album.json.content, function() {
|
||||
album.parse(this);
|
||||
photosData += build.photo(this);
|
||||
});
|
||||
lychee.content.html(photosData);
|
||||
|
||||
$("img[data-type!='svg']").retina();
|
||||
|
||||
},
|
||||
|
||||
title: function(photoID) {
|
||||
|
||||
var longTitle = "",
|
||||
title = album.json.content[photoID].title;
|
||||
|
||||
if (title.length>18) {
|
||||
longTitle = title;
|
||||
title = title.substr(0, 18) + "...";
|
||||
}
|
||||
|
||||
$(".photo[data-id='" + photoID + "'] .overlay h1")
|
||||
.html(title)
|
||||
.attr("title", longTitle);
|
||||
|
||||
},
|
||||
|
||||
star: function(photoID) {
|
||||
|
||||
$(".photo[data-id='" + photoID + "'] .icon-star").remove();
|
||||
if (album.json.content[photoID].star==1) $(".photo[data-id='" + photoID + "']").append("<a class='badge red icon-star'></a>");
|
||||
|
||||
},
|
||||
|
||||
public: function(photoID) {
|
||||
|
||||
$(".photo[data-id='" + photoID + "'] .icon-share").remove();
|
||||
if (album.json.content[photoID].public==1) $(".photo[data-id='" + photoID + "']").append("<a class='badge red icon-share'></a>");
|
||||
|
||||
},
|
||||
|
||||
delete: function(photoID) {
|
||||
|
||||
$(".photo[data-id='" + photoID + "']").css("opacity", 0).animate({
|
||||
width: 0,
|
||||
marginLeft: 0
|
||||
}, 300, function() {
|
||||
$(this).remove();
|
||||
// Only when search is not active
|
||||
if (!visible.albums()) {
|
||||
album.json.num--;
|
||||
view.album.num();
|
||||
view.album.title();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
num: function() {
|
||||
|
||||
$("#infobox .attr_images").html(album.json.num);
|
||||
|
||||
},
|
||||
|
||||
public: function() {
|
||||
|
||||
if (album.json.public==1) {
|
||||
$("#button_share_album a").addClass("active");
|
||||
$("#button_share_album").attr("title", "Share Album");
|
||||
$(".photo .icon-share").remove();
|
||||
if (album.json.init) $("#infobox .attr_visibility").html("Public");
|
||||
} else {
|
||||
$("#button_share_album a").removeClass("active");
|
||||
$("#button_share_album").attr("title", "Make Public");
|
||||
if (album.json.init) $("#infobox .attr_visibility").html("Private");
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
password: function() {
|
||||
|
||||
if (album.json.password==1) $("#infobox .attr_password").html("Yes");
|
||||
else $("#infobox .attr_password").html("No");
|
||||
|
||||
},
|
||||
|
||||
infobox: function() {
|
||||
|
||||
if ((visible.album()||!album.json.init)&&!visible.photo()) lychee.infobox.html(build.infoboxAlbum(album.json)).show();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
photo: {
|
||||
|
||||
init: function() {
|
||||
|
||||
photo.parse();
|
||||
|
||||
view.photo.infobox();
|
||||
view.photo.title();
|
||||
view.photo.star();
|
||||
view.photo.public();
|
||||
view.photo.photo();
|
||||
|
||||
photo.json.init = 1;
|
||||
|
||||
},
|
||||
|
||||
show: function() {
|
||||
|
||||
// Change header
|
||||
lychee.content.addClass("view");
|
||||
view.header.mode("photo");
|
||||
|
||||
// Make body not scrollable
|
||||
$("body").css("overflow", "hidden");
|
||||
|
||||
// Fullscreen
|
||||
$(document)
|
||||
.bind("mouseenter", view.header.show)
|
||||
.bind("mouseleave", view.header.hide);
|
||||
|
||||
lychee.animate(lychee.imageview, "fadeIn");
|
||||
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
|
||||
if (!visible.controls()) view.header.show();
|
||||
if (visible.infobox) view.infobox.hide();
|
||||
|
||||
lychee.content.removeClass("view");
|
||||
view.header.mode("album");
|
||||
|
||||
// Make body scrollable
|
||||
$("body").css("overflow", "auto");
|
||||
|
||||
// Disable Fullscreen
|
||||
$(document)
|
||||
.unbind("mouseenter")
|
||||
.unbind("mouseleave");
|
||||
|
||||
// Hide Photo
|
||||
lychee.animate(lychee.imageview, "fadeOut");
|
||||
setTimeout(function() {
|
||||
lychee.imageview.hide();
|
||||
view.album.infobox();
|
||||
}, 300);
|
||||
|
||||
},
|
||||
|
||||
title: function() {
|
||||
|
||||
if (photo.json.init) $("#infobox .attr_name").html(photo.json.title + " " + build.editIcon("edit_title"));
|
||||
lychee.setTitle(photo.json.title, true);
|
||||
|
||||
},
|
||||
|
||||
description: function() {
|
||||
|
||||
if (photo.json.init) $("#infobox .attr_description").html(photo.json.description + " " + build.editIcon("edit_description"));
|
||||
|
||||
},
|
||||
|
||||
star: function() {
|
||||
|
||||
$("#button_star a").removeClass("icon-star-empty icon-star");
|
||||
if (photo.json.star==1) {
|
||||
// Starred
|
||||
$("#button_star a").addClass("icon-star");
|
||||
$("#button_star").attr("title", "Unstar Photo");
|
||||
} else {
|
||||
// Unstarred
|
||||
$("#button_star a").addClass("icon-star-empty");
|
||||
$("#button_star").attr("title", "Star Photo");
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
public: function() {
|
||||
|
||||
if (photo.json.public==1||photo.json.public==2) {
|
||||
// Photo public
|
||||
$("#button_share a").addClass("active");
|
||||
$("#button_share").attr("title", "Share Photo");
|
||||
if (photo.json.init) $("#infobox .attr_visibility").html("Public");
|
||||
} else {
|
||||
// Photo private
|
||||
$("#button_share a").removeClass("active");
|
||||
$("#button_share").attr("title", "Make Public");
|
||||
if (photo.json.init) $("#infobox .attr_visibility").html("Private");
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
tags: function() {
|
||||
|
||||
$("#infobox #tags").html(build.tags(photo.json.tags));
|
||||
|
||||
},
|
||||
|
||||
photo: function() {
|
||||
|
||||
lychee.imageview.html(build.imageview(photo.json, photo.isSmall(), visible.controls()));
|
||||
|
||||
if ((album.json&&album.json.content&&album.json.content[photo.getID()]&&album.json.content[photo.getID()].nextPhoto==="")||lychee.viewMode) $("a#next").hide();
|
||||
if ((album.json&&album.json.content&&album.json.content[photo.getID()]&&album.json.content[photo.getID()].previousPhoto==="")||lychee.viewMode) $("a#previous").hide();
|
||||
|
||||
},
|
||||
|
||||
infobox: function() {
|
||||
|
||||
lychee.infobox.html(build.infoboxPhoto(photo.json)).show();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,112 @@
|
||||
/**
|
||||
* @name Main
|
||||
* @description Used to view single photos with view.php
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
var header = $("header"),
|
||||
headerTitle = $("#title"),
|
||||
imageview = $("#imageview"),
|
||||
api_path = "php/api.php",
|
||||
infobox = $("#infobox");
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
/* Event Name */
|
||||
if (mobileBrowser()) event_name = "touchend";
|
||||
else event_name = "click";
|
||||
|
||||
/* Window */
|
||||
$(window).keydown(key);
|
||||
|
||||
/* Infobox */
|
||||
$(document).on(event_name, "#infobox .header a", function() { hideInfobox() });
|
||||
$(document).on(event_name, "#infobox_overlay", function() { hideInfobox() });
|
||||
$("#button_info").on(event_name, function() { showInfobox() });
|
||||
|
||||
/* Direct Link */
|
||||
$("#button_direct").on(event_name, function() {
|
||||
|
||||
link = $("#imageview #image").css("background-image").replace(/"/g,"").replace(/url\(|\)$/ig, "");
|
||||
window.open(link,"_newtab");
|
||||
|
||||
});
|
||||
|
||||
loadPhotoInfo(gup("p"));
|
||||
|
||||
});
|
||||
|
||||
function key(e) {
|
||||
|
||||
code = (e.keyCode ? e.keyCode : e.which);
|
||||
if (code===27&&visibleInfobox()) { hideInfobox(); e.preventDefault(); }
|
||||
|
||||
}
|
||||
|
||||
function visibleInfobox() {
|
||||
|
||||
if (parseInt(infobox.css("right").replace("px", ""))<0) return false;
|
||||
else return true;
|
||||
|
||||
}
|
||||
|
||||
function isPhotoSmall(photo) {
|
||||
|
||||
size = [
|
||||
["width", false],
|
||||
["height", false]
|
||||
];
|
||||
|
||||
if (photo.width<$(window).width()-60) size["width"] = true;
|
||||
if (photo.height<$(window).height()-100) size["height"] = true;
|
||||
|
||||
if (size["width"]&&size["height"]) return true;
|
||||
else return false;
|
||||
|
||||
}
|
||||
|
||||
function showInfobox() {
|
||||
|
||||
$("body").append("<div id='infobox_overlay' class='fadeIn'></div>");
|
||||
infobox.addClass("active");
|
||||
|
||||
}
|
||||
|
||||
function hideInfobox() {
|
||||
|
||||
$("#infobox_overlay").removeClass("fadeIn").addClass("fadeOut");
|
||||
setTimeout(function() { $("#infobox_overlay").remove() }, 300);
|
||||
infobox.removeClass("active");
|
||||
|
||||
}
|
||||
|
||||
function loadPhotoInfo(photoID) {
|
||||
|
||||
params = "function=getPhoto&photoID=" + photoID + "&albumID=0&password=''";
|
||||
$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
|
||||
|
||||
if (!data.title) data.title = "Untitled";
|
||||
document.title = "Lychee - " + data.title;
|
||||
headerTitle.html(data.title);
|
||||
|
||||
data.url = "uploads/big/" + data.url;
|
||||
|
||||
imageview.attr("data-id", photoID);
|
||||
if (isPhotoSmall(data)) imageview.html("<div id='image' class='small' style='background-image: url(" + data.url + "); width: " + data.width + "px; height: " + data.height + "px; margin-top: -" + parseInt((data.height/2)-20) + "px; margin-left: -" + data.width/2 + "px;'></div>");
|
||||
else imageview.html("<div id='image' style='background-image: url(" + data.url + ");'></div>");
|
||||
imageview.removeClass("fadeOut").addClass("fadeIn").show();
|
||||
|
||||
infobox.html(build.infoboxPhoto(data, true)).show();
|
||||
|
||||
}, error: ajaxError });
|
||||
|
||||
}
|
||||
|
||||
function ajaxError(jqXHR, textStatus, errorThrown) {
|
||||
|
||||
console.log(jqXHR);
|
||||
console.log(textStatus);
|
||||
console.log(errorThrown);
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @name Visible Module
|
||||
* @description This module is used to check if elements are visible or not.
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
visible = {
|
||||
|
||||
albums: function() {
|
||||
if ($('#tools_albums').css('display')==='block') return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
album: function() {
|
||||
if ($('#tools_album').css('display')==='block') return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
photo: function() {
|
||||
if ($('#imageview.fadeIn').length>0) return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
search: function() {
|
||||
if (search.code!==null&&search.code!=='') return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
infobox: function() {
|
||||
if ($('#infobox.active').length>0) return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
controls: function() {
|
||||
if (lychee.loadingBar.css('opacity')<1) return false;
|
||||
else return true;
|
||||
},
|
||||
|
||||
message: function() {
|
||||
if ($('.message').length>0) return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
signin: function() {
|
||||
if ($('.message .sign_in').length>0) return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
contextMenu: function() {
|
||||
if ($('.contextmenu').length>0) return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
multiselect: function() {
|
||||
if ($('#multiselect').length>0) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
@ -0,0 +1,20 @@
|
||||
### Dependencies
|
||||
|
||||
First you have to install the following dependencies:
|
||||
|
||||
- [CSS Optimizer](https://github.com/css/csso) `csso`
|
||||
- [UglifyJS](https://github.com/mishoo/UglifyJS2) `uglifyjs`
|
||||
|
||||
These dependencies can be installed using `npm`:
|
||||
|
||||
npm install csso uglify-js -g;
|
||||
|
||||
### Build
|
||||
|
||||
The Makefile is located in `etc/` and can be easily executed, using the following command. Make sure your run this from the root of Lychee:
|
||||
|
||||
make -f etc/Makefile
|
||||
|
||||
### Use uncompressed files
|
||||
|
||||
While developing, you might want to use the uncompressed files. This is possible by editing the `index.html`. Simply change the linked CSS and JS files. There are already out-commented link-tags for development and production.
|
@ -1,3 +1,20 @@
|
||||
## v2.1
|
||||
|
||||
Released March 4, 2014
|
||||
|
||||
- `New` Multi-select (#32)
|
||||
- `New` Multi-folder import from server (#47)
|
||||
- `New` Tagging (#5)
|
||||
- `New` Import of original image name (#39)
|
||||
- `New` Makefile
|
||||
- `Improved` Upload-process
|
||||
- `Improved` Documentation
|
||||
- `Improved` Overlay for photos
|
||||
- `Fixed` Dropbox import (#84)
|
||||
- `Fixed` Wrong login or password annotation (#71)
|
||||
- `Fixed` Escaping issue (#89)
|
||||
- `Moved` Config now located in `data/`
|
||||
|
||||
## v2.0.3
|
||||
|
||||
Released February 26, 2014
|
@ -0,0 +1,47 @@
|
||||
### Database Details
|
||||
|
||||
Your MySQL details are stored in `data/config.php`. This file doesn't exist until you installed Lychee. If you need to change your connection details, you can edit this file manually.
|
||||
|
||||
|
||||
|
||||
$dbHost = Your MySQL host (in most cases you can use localhost)
|
||||
$dbUser = Your MySQL username
|
||||
$dbPassword = Your MySQL password
|
||||
$dbName = The name of the database you want to use
|
||||
|
||||
Fill these properties with your MySQL information. Lychee will create the database and tables for you, if they doesn't exist.
|
||||
|
||||
### Settings
|
||||
|
||||
All settings are stored in the database. You can change the properties manually, but we recommend to use the menu in Lychee. You can find this menu on the top left corner after you signed in. Some of these settings are only changeable directly in the database.
|
||||
|
||||
#### Login
|
||||
|
||||
username = Username for Lychee
|
||||
password = Password for Lychee, saved as an md5 hash
|
||||
|
||||
Your photos and albums are protected by an username and password you need to set. If both rows are empty, Lychee will prompt you to set them.
|
||||
|
||||
#### Thumb Quality
|
||||
|
||||
thumbQuality = [0-100]
|
||||
|
||||
Less means an inferiority quality of your thumbs, but faster loading. More means a better quality of your thumbs, but slower loading. The default value is 90. The allowed values are between 0 and 100.
|
||||
|
||||
#### Check For Updates
|
||||
|
||||
checkForUpdates = [0|1]
|
||||
|
||||
If `1`, Lychee will check if you are using the latest version. The notice will be displayed beside the version-number when you sign in.
|
||||
|
||||
#### Sorting
|
||||
|
||||
sorting = ORDER BY [row] [ASC|DESC]
|
||||
|
||||
A typical part of a MySQL statement. This string will be appended to mostly every MySQL query.
|
||||
|
||||
#### Dropbox Key
|
||||
|
||||
This key is required to use the Dropbox import feature from your server. Lychee will ask you for this key, the first time you try to use the import. You can get your personal drop-ins app key from [their website](https://www.dropbox.com/developers/apps/create).
|
||||
|
||||
dropboxKey = Your personal App Key
|
@ -0,0 +1,11 @@
|
||||
### Update with `git`
|
||||
|
||||
The easiest way to update Lychee is with `git`:
|
||||
|
||||
git pull
|
||||
|
||||
### Update manually
|
||||
|
||||
1. Download the [newest Version](https://github.com/electerious/Lychee/archive/master.zip)
|
||||
2. Replace all existing files, excluding `uploads/` and `data/`
|
||||
3. Open Lychee (and enter your database details)
|
@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
folderCSS="../assets/css"
|
||||
folderJS="../assets/js"
|
||||
|
||||
if [ -e "$folderCSS/modules/" ]
|
||||
then
|
||||
|
||||
echo "Compiling CSS ..."
|
||||
awk 'FNR==1{print ""}1' $folderCSS/modules/*.css > $folderCSS/min/main.css
|
||||
csso $folderCSS/min/main.css $folderCSS/min/main.css
|
||||
echo "CSS compiled!"
|
||||
|
||||
else
|
||||
|
||||
echo "CSS files not found in $folderCSS"
|
||||
|
||||
fi
|
||||
|
||||
if [ -e "$folderJS/modules/" ]
|
||||
then
|
||||
|
||||
echo "Compiling JS ..."
|
||||
awk 'FNR==1{print ""}1' $folderJS/modules/*.js > $folderJS/min/main.js
|
||||
uglifyjs $folderJS/min/main.js -o $folderJS/min/main.js
|
||||
echo "JS compiled!"
|
||||
|
||||
else
|
||||
|
||||
echo "JS files not found in $folderJS"
|
||||
|
||||
fi
|
@ -1,40 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
VERSION='2.0'
|
||||
|
||||
echo 'Press ENTER to continue or any other key to abort'
|
||||
read -s -n 1 key
|
||||
|
||||
if [[ "$key" = "" ]]
|
||||
then
|
||||
|
||||
if [ -e Lychee-$VERSION ]
|
||||
then
|
||||
|
||||
echo "The folder 'Lychee-$VERSION' already exists. Please delete it before you try to install Lychee."
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
if [ -e lychee ]
|
||||
then
|
||||
|
||||
echo "The folder 'lychee' already exists. Please delete it before you try to install Lychee."
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
echo 'Downloading and installing Lychee...' && \
|
||||
curl -sS https://codeload.github.com/electerious/Lychee/zip/v$VERSION > lychee.zip && \
|
||||
echo 'Downloaded.' && \
|
||||
echo 'Unzipping...' && \
|
||||
unzip lychee.zip && \
|
||||
rm lychee.zip && \
|
||||
mv Lychee-$VERSION lychee && \
|
||||
cd lychee && \
|
||||
echo 'The required directories will be made writable and executable for others. Please enter your password if prompted to do so.' && \
|
||||
sudo chmod -R 777 uploads php && \
|
||||
echo 'Installation successful!' && \
|
||||
exit 0
|
||||
|
||||
fi
|
@ -1,15 +0,0 @@
|
||||
### Import from server
|
||||
|
||||
To import photos from your server (photos you have uploaded via FTP to your server), sign in and click the add-icon on the top right. Then choose 'Import from Server'.
|
||||
|
||||
### Upload and share single photos [Depreciated]
|
||||
|
||||
Important: This feature is depreciated and will be removed with the next major version. Do not use it anymore! It will be replaced by a plugin.
|
||||
|
||||
You can upload photos directly with every FTP client into Lychee. This feature helps you to share single images quickly with others.
|
||||
|
||||
1. Upload an image to `uploads/import/`
|
||||
2. Navigate your browser to the place where Lychee is located (e.g. `http://example.com/view.php?p=filename.png`). `filename.png` must be replaced with the filename of your uploaded file.
|
||||
3. Share the link.
|
||||
|
||||
Lychee will import the file as an public image, delete the original (unused) file and display it in the browser. [Sample FTP configuration](http://l.electerious.com/view.php?p=13657692738813).
|
@ -1,41 +0,0 @@
|
||||
### Database Details
|
||||
|
||||
Your MySQL details are stored in `php/config.php`. This file doesn't exist until you installed Lychee. If you need to change your connection details, you can edit this file manually.
|
||||
|
||||
|
||||
|
||||
$dbHost = Your MySQL host (in most cases you can use localhost)
|
||||
$dbUser = Your MySQL username
|
||||
$dbPassword = Your MySQL password
|
||||
$dbName = The name of the database you want to use
|
||||
|
||||
Fill these properties with your MySQL information. Lychee will create the database and tables for you, if they doesn't exist.
|
||||
|
||||
### Settings
|
||||
|
||||
All settings are stored in the database. You can change the properties manually, but we recommend to use the menu in Lychee. You can find this menu on the top left corner after you signed in.
|
||||
|
||||
#### Login
|
||||
|
||||
username = Username for Lychee
|
||||
password = Password for Lychee, saved as an md5 hash
|
||||
|
||||
Your photos and albums are protected by a username and password you need to set. If both rows are empty, Lychee will prompt you to set them.
|
||||
|
||||
#### Thumb Quality
|
||||
|
||||
thumbQuality = [0-100]
|
||||
|
||||
Less means a inferiority quality of your thumbs, but faster loading. More means a better quality of your thumbs, but slower loading. The default value is 90. The allowed values are between 0 and 100.
|
||||
|
||||
#### Check For Updates
|
||||
|
||||
checkForUpdates = [0|1]
|
||||
|
||||
If `1`, Lychee will check if you are using the latest version. The notice will be displayed beside the version-number when you sign in.
|
||||
|
||||
#### Sorting
|
||||
|
||||
sorting = ORDER BY [row] [ASC|DESC]
|
||||
|
||||
A typical part of an MySQL statement. This string will be appended to mostly every MySQL query.
|
@ -0,0 +1,35 @@
|
||||
NO_COLOR=\x1b[0m
|
||||
OK_COLOR=\x1b[32;01m
|
||||
ERROR_COLOR=\x1b[31;01m
|
||||
WARN_COLOR=\x1b[33;01m
|
||||
|
||||
OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)
|
||||
ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)
|
||||
RUN_STRING=$(WARN_COLOR)[RUN]$(NO_COLOR)
|
||||
|
||||
ROOT = .
|
||||
CSS = '$(ROOT)/assets/css'
|
||||
JS = '$(ROOT)/assets/js'
|
||||
BUILD = '$(ROOT)/assets/build'
|
||||
|
||||
all: clean create css js
|
||||
|
||||
clean:
|
||||
rm -f -R $(BUILD)
|
||||
@echo "$(OK_STRING) Clean build"
|
||||
|
||||
create: clean
|
||||
mkdir $(BUILD)
|
||||
@echo "$(OK_STRING) Create build"
|
||||
|
||||
css: create
|
||||
@echo "$(RUN_STRING) Compiling CSS"
|
||||
awk 'FNR==1{print ""}1' $(CSS)/*.css > $(BUILD)/main.css
|
||||
csso $(BUILD)/main.css $(BUILD)/main.css
|
||||
@echo "$(OK_STRING) CSS compiled"
|
||||
|
||||
js: create
|
||||
@echo "$(RUN_STRING) Compiling JS"
|
||||
awk 'FNR==1{print ""}1' $(JS)/*.js > $(BUILD)/main.js
|
||||
uglifyjs $(BUILD)/main.js -o $(BUILD)/main.js
|
||||
@echo "$(OK_STRING) JS compiled"
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @name Admin Access
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
||||
if (!defined('LYCHEE_ACCESS_ADMIN')) exit('Error: You are not allowed to access this area!');
|
||||
|
||||
switch ($_POST['function']) {
|
||||
|
||||
// Album Functions
|
||||
|
||||
case 'getAlbums': echo json_encode(getAlbums(false));
|
||||
break;
|
||||
|
||||
case 'getAlbum': if (isset($_POST['albumID']))
|
||||
echo json_encode(getAlbum($_POST['albumID']));
|
||||
break;
|
||||
|
||||
case 'addAlbum': if (isset($_POST['title']))
|
||||
echo addAlbum($_POST['title']);
|
||||
break;
|
||||
|
||||
case 'setAlbumTitle': if (isset($_POST['albumIDs'])&&isset($_POST['title']))
|
||||
echo setAlbumTitle($_POST['albumIDs'], $_POST['title']);
|
||||
break;
|
||||
|
||||
case 'setAlbumDescription': if (isset($_POST['albumID'])&&isset($_POST['description']))
|
||||
echo setAlbumDescription($_POST['albumID'], $_POST['description']);
|
||||
break;
|
||||
|
||||
case 'setAlbumPublic': if (isset($_POST['albumID']))
|
||||
if (!isset($_POST['password'])) $_POST['password'] = '';
|
||||
echo setAlbumPublic($_POST['albumID'], $_POST['password']);
|
||||
break;
|
||||
|
||||
case 'setAlbumPassword': if (isset($_POST['albumID'])&&isset($_POST['password']))
|
||||
echo setAlbumPassword($_POST['albumID'], $_POST['password']);
|
||||
break;
|
||||
|
||||
case 'deleteAlbum': if (isset($_POST['albumIDs']))
|
||||
echo deleteAlbum($_POST['albumIDs']);
|
||||
break;
|
||||
|
||||
// Photo Functions
|
||||
|
||||
case 'getPhoto': if (isset($_POST['photoID'])&&isset($_POST['albumID']))
|
||||
echo json_encode(getPhoto($_POST['photoID'], $_POST['albumID']));
|
||||
break;
|
||||
|
||||
case 'deletePhoto': if (isset($_POST['photoIDs']))
|
||||
echo deletePhoto($_POST['photoIDs']);
|
||||
break;
|
||||
|
||||
case 'setPhotoAlbum': if (isset($_POST['photoIDs'])&&isset($_POST['albumID']))
|
||||
echo setPhotoAlbum($_POST['photoIDs'], $_POST['albumID']);
|
||||
break;
|
||||
|
||||
case 'setPhotoTitle': if (isset($_POST['photoIDs'])&&isset($_POST['title']))
|
||||
echo setPhotoTitle($_POST['photoIDs'], $_POST['title']);
|
||||
break;
|
||||
|
||||
case 'setPhotoStar': if (isset($_POST['photoIDs']))
|
||||
echo setPhotoStar($_POST['photoIDs']);
|
||||
break;
|
||||
|
||||
case 'setPhotoPublic': if (isset($_POST['photoID'])&&isset($_POST['url']))
|
||||
echo setPhotoPublic($_POST['photoID'], $_POST['url']);
|
||||
break;
|
||||
|
||||
case 'setPhotoDescription': if (isset($_POST['photoID'])&&isset($_POST['description']))
|
||||
echo setPhotoDescription($_POST['photoID'], $_POST['description']);
|
||||
break;
|
||||
|
||||
case 'setPhotoTags': if (isset($_POST['photoIDs'])&&isset($_POST['tags']))
|
||||
echo setPhotoTags($_POST['photoIDs'], $_POST['tags']);
|
||||
break;
|
||||
|
||||
// Add Functions
|
||||
|
||||
case 'upload': if (isset($_FILES)&&isset($_POST['albumID']))
|
||||
echo upload($_FILES, $_POST['albumID']);
|
||||
break;
|
||||
|
||||
case 'importUrl': if (isset($_POST['url'])&&isset($_POST['albumID']))
|
||||
echo importUrl($_POST['url'], $_POST['albumID']);
|
||||
break;
|
||||
|
||||
case 'importServer': if (isset($_POST['albumID']))
|
||||
echo importServer($_POST['albumID']);
|
||||
break;
|
||||
|
||||
// Search Function
|
||||
|
||||
case 'search': if (isset($_POST['term']))
|
||||
echo json_encode(search($_POST['term']));
|
||||
break;
|
||||
|
||||
// Session Function
|
||||
|
||||
case 'init': echo json_encode(init('admin', $_POST['version']));
|
||||
break;
|
||||
|
||||
case 'login': if (isset($_POST['user'])&&isset($_POST['password']))
|
||||
echo login($_POST['user'], $_POST['password']);
|
||||
break;
|
||||
|
||||
case 'logout': logout();
|
||||
break;
|
||||
|
||||
// Settings
|
||||
|
||||
case 'setLogin': if (isset($_POST['username'])&&isset($_POST['password']))
|
||||
if (!isset($_POST['oldPassword'])) $_POST['oldPassword'] = '';
|
||||
echo setLogin($_POST['oldPassword'], $_POST['username'], $_POST['password']);
|
||||
break;
|
||||
|
||||
case 'setSorting': if (isset($_POST['type'])&&isset($_POST['order']))
|
||||
echo setSorting($_POST['type'], $_POST['order']);
|
||||
break;
|
||||
|
||||
case 'setDropboxKey': if (isset($_POST['key']))
|
||||
echo setDropboxKey($_POST['key']);
|
||||
break;
|
||||
|
||||
// Miscellaneous
|
||||
|
||||
default: switch ($_GET['function']) {
|
||||
|
||||
case 'getFeed': if (isset($_GET['albumID']))
|
||||
echo getFeed($_GET['albumID']);
|
||||
break;
|
||||
|
||||
case 'getAlbumArchive': if (isset($_GET['albumID']))
|
||||
getAlbumArchive($_GET['albumID']);
|
||||
break;
|
||||
|
||||
case 'getPhotoArchive': if (isset($_GET['photoID']))
|
||||
getPhotoArchive($_GET['photoID']);
|
||||
break;
|
||||
|
||||
case 'update': echo update();
|
||||
break;
|
||||
|
||||
default: exit('Error: Function not found! Please check the spelling of the called function.');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @name Guest Access (Public Mode)
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
||||
if (!defined('LYCHEE_ACCESS_GUEST')) exit('Error: You are not allowed to access this area!');
|
||||
|
||||
switch ($_POST['function']) {
|
||||
|
||||
// Album Functions
|
||||
|
||||
case 'getAlbums': echo json_encode(getAlbums(true));
|
||||
break;
|
||||
|
||||
case 'getAlbum': if (isset($_POST['albumID'])&&isset($_POST['password'])) {
|
||||
if (isAlbumPublic($_POST['albumID'])) {
|
||||
// Album Public
|
||||
if (checkAlbumPassword($_POST['albumID'], $_POST['password']))
|
||||
echo json_encode(getAlbum($_POST['albumID']));
|
||||
else
|
||||
echo 'Warning: Wrong password!';
|
||||
} else {
|
||||
// Album Private
|
||||
echo 'Warning: Album private!';
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'checkAlbumAccess':if (isset($_POST['albumID'])&&isset($_POST['password'])) {
|
||||
if (isAlbumPublic($_POST['albumID'])) {
|
||||
// Album Public
|
||||
if (checkAlbumPassword($_POST['albumID'], $_POST['password']))
|
||||
echo true;
|
||||
else
|
||||
echo false;
|
||||
} else {
|
||||
// Album Private
|
||||
echo false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// Photo Functions
|
||||
|
||||
case 'getPhoto': if (isset($_POST['photoID'])&&isset($_POST['albumID'])&&isset($_POST['password'])) {
|
||||
if (isPhotoPublic($_POST['photoID'], $_POST['password']))
|
||||
echo json_encode(getPhoto($_POST['photoID'], $_POST['albumID']));
|
||||
else
|
||||
echo 'Warning: Wrong password!';
|
||||
}
|
||||
break;
|
||||
|
||||
// Session Functions
|
||||
|
||||
case 'init': echo json_encode(init('public', $_POST['version']));
|
||||
break;
|
||||
|
||||
case 'login': if (isset($_POST['user'])&&isset($_POST['password']))
|
||||
echo login($_POST['user'], $_POST['password']);
|
||||
break;
|
||||
|
||||
// Miscellaneous
|
||||
|
||||
default: switch ($_GET['function']) {
|
||||
|
||||
case 'getFeed': if (isset($_GET['albumID'])&&isset($_GET['password'])) {
|
||||
|
||||
// Album Feed
|
||||
if (isAlbumPublic($_GET['albumID'])) {
|
||||
// Album Public
|
||||
if (checkAlbumPassword($_GET['albumID'], $_GET['password']))
|
||||
echo getFeed($_GET['albumID']);
|
||||
else
|
||||
exit('Warning: Wrong password!');
|
||||
} else {
|
||||
// Album Private
|
||||
exit('Warning: Album private!');
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'getAlbumArchive': if (isset($_GET['albumID'])&&isset($_GET['password'])) {
|
||||
|
||||
// Album Download
|
||||
if (isAlbumPublic($_GET['albumID'])) {
|
||||
// Album Public
|
||||
if (checkAlbumPassword($_GET['albumID'], $_GET['password']))
|
||||
getAlbumArchive($_GET['albumID']);
|
||||
else
|
||||
exit('Warning: Wrong password!');
|
||||
} else {
|
||||
// Album Private
|
||||
exit('Warning: Album private or not downloadable!');
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'getPhotoArchive': if (isset($_GET['photoID'])&&isset($_GET['password'])) {
|
||||
|
||||
// Photo Download
|
||||
if (isPhotoPublic($_GET['photoID'], $_GET['password']))
|
||||
// Photo Public
|
||||
getPhotoArchive($_GET['photoID']);
|
||||
else
|
||||
// Photo Private
|
||||
exit('Warning: Photo private or not downloadable!');
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default: exit('Error: Function not found! Please check the spelling of the called function.');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @name Installation Access
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
||||
if (!defined('LYCHEE_ACCESS_INSTALLATION')) exit('Error: You are not allowed to access this area!');
|
||||
|
||||
switch ($_POST['function']) {
|
||||
|
||||
case 'dbCreateConfig': if (isset($_POST['dbHost'])&&isset($_POST['dbUser'])&&isset($_POST['dbPassword'])&&isset($_POST['dbName'])&&isset($_POST['version']))
|
||||
echo dbCreateConfig($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['version']);
|
||||
break;
|
||||
|
||||
default: echo 'Warning: No configuration!';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|