Merge branch 'master' into uploader
Conflicts: assets/min/main.css assets/min/main.js assets/min/view.js
This commit is contained in:
commit
b8630538f3
@ -179,7 +179,8 @@
|
||||
/* Radio Buttons ------------------------------------------------*/
|
||||
.message .choice {
|
||||
float: left;
|
||||
padding: 12px 5% 15px;
|
||||
margin: 12px 5%;
|
||||
width: 90%;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
|
@ -285,15 +285,17 @@ album = {
|
||||
|
||||
setPublic: function(albumID, e) {
|
||||
|
||||
var params;
|
||||
var params,
|
||||
password = "",
|
||||
listed = false;
|
||||
|
||||
if (!visible.message()&&album.json.public==0) {
|
||||
|
||||
modal.show("Share Album", "This album will be shared with one of the following properties:</p><form><div class='choice'><input type='radio' value='public' name='choice' checked><h2>Public</h2><p>Visible and accessible for everyone.</p></div><div class='choice'><input type='radio' value='password' name='choice'><h2>Password protected</h2><p>Not visible to visitors and only accessible with a valid password.<input class='text' type='password' placeholder='password' value='' style='display: none;'></p></div></form><p style='display: none;'>", [["Share Album", function() { album.setPublic(album.getID(), e) }], ["Cancel", function() {}]], -160);
|
||||
modal.show("Share Album", "This album will be shared with one of the following properties:</p><form><div class='choice'><input type='checkbox' name='listed' value='listed' checked><h2>Visible</h2><p>Listed to visitors of your Lychee.</p></div><div class='choice'><input type='checkbox' name='password' value='password'><h2>Password protected</h2><p>Only accessible with a valid password.<input class='text' type='password' placeholder='password' value='' style='display: none;'></p></div></form><p style='display: none;'>", [["Share Album", function() { album.setPublic(album.getID(), e) }], ["Cancel", function() {}]], -160);
|
||||
|
||||
$(".message .choice input:radio").on("change", function() {
|
||||
$(".message .choice input[name='password']").on("change", function() {
|
||||
|
||||
if ($(this).val()==="password") $(".message .choice input.text").show();
|
||||
if ($(this).prop('checked')===true) $(".message .choice input.text").show();
|
||||
else $(".message .choice input.text").hide();
|
||||
|
||||
});
|
||||
@ -302,18 +304,22 @@ album = {
|
||||
|
||||
}
|
||||
|
||||
if (visible.message()&&$(".message .choice input:checked").val()==="password") {
|
||||
if (visible.message()) {
|
||||
|
||||
params = "setAlbumPublic&albumID=" + albumID + "&password=" + md5($(".message input.text").val());
|
||||
album.json.password = true;
|
||||
if ($(".message .choice input[name='password']:checked").val()==="password") {
|
||||
password = md5($(".message input.text").val());
|
||||
album.json.password = true;
|
||||
} else {
|
||||
password = "";
|
||||
album.json.password = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
params = "setAlbumPublic&albumID=" + albumID + "&password=";
|
||||
album.json.password = false;
|
||||
if ($(".message .choice input[name='listed']:checked").val()==="listed") listed = true;
|
||||
|
||||
}
|
||||
|
||||
params = "setAlbumPublic&albumID=" + albumID + "&password=" + password + "&visible=" + listed;
|
||||
|
||||
if (visible.album()) {
|
||||
|
||||
album.json.public = (album.json.public==0) ? 1 : 0;
|
||||
|
@ -31,21 +31,20 @@ build = {
|
||||
|
||||
var album = "",
|
||||
longTitle = "",
|
||||
title = albumJSON.title;
|
||||
title = albumJSON.title,
|
||||
typeThumb = "";
|
||||
|
||||
if (title.length>18) {
|
||||
title = albumJSON.title.substr(0, 18) + "...";
|
||||
longTitle = albumJSON.title;
|
||||
}
|
||||
|
||||
typeThumb0 = albumJSON.thumb0.split('.').pop();
|
||||
typeThumb1 = albumJSON.thumb1.split('.').pop();
|
||||
typeThumb2 = albumJSON.thumb2.split('.').pop();
|
||||
if (albumJSON.thumb0.split('.').pop()==="svg") typeThumb = "nonretina";
|
||||
|
||||
album += "<div class='album' data-id='" + albumJSON.id + "' data-password='" + albumJSON.password + "'>";
|
||||
album += "<img src='" + albumJSON.thumb2 + "' width='200' height='200' alt='thumb' data-type='" + typeThumb2 + "'>";
|
||||
album += "<img src='" + albumJSON.thumb1 + "' width='200' height='200' alt='thumb' data-type='" + typeThumb1 + "'>";
|
||||
album += "<img src='" + albumJSON.thumb0 + "' width='200' height='200' alt='thumb' data-type='" + typeThumb0 + "'>";
|
||||
album += "<img src='" + albumJSON.thumb2 + "' width='200' height='200' alt='thumb' data-type='nonretina'>";
|
||||
album += "<img src='" + albumJSON.thumb1 + "' width='200' height='200' alt='thumb' data-type='nonretina'>";
|
||||
album += "<img src='" + albumJSON.thumb0 + "' width='200' height='200' alt='thumb' data-type='" + typeThumb + "'>";
|
||||
album += "<div class='overlay'>";
|
||||
|
||||
if (albumJSON.password&&!lychee.publicMode) album += "<h1><span class='icon-lock'></span> " + title + "</h1>";
|
||||
@ -54,10 +53,14 @@ build = {
|
||||
album += "<a>" + albumJSON.sysdate + "</a>";
|
||||
album += "</div>";
|
||||
|
||||
if(!lychee.publicMode&&albumJSON.star===1) album += "<a class='badge red icon-star'></a>";
|
||||
if(!lychee.publicMode&&albumJSON.public===1) album += "<a class='badge red icon-share'></a>";
|
||||
if(!lychee.publicMode&&albumJSON.unsorted===1) album += "<a class='badge red icon-reorder'></a>";
|
||||
if(!lychee.publicMode&&albumJSON.recent===1) album += "<a class='badge red icon-time'></a>";
|
||||
if (!lychee.publicMode) {
|
||||
|
||||
if(albumJSON.star==1) album += "<a class='badge red icon-star'></a>";
|
||||
if(albumJSON.public==1) album += "<a class='badge red icon-share'></a>";
|
||||
if(albumJSON.unsorted==1) album += "<a class='badge red icon-reorder'></a>";
|
||||
if(albumJSON.recent==1) album += "<a class='badge red icon-time'></a>";
|
||||
|
||||
}
|
||||
|
||||
album += "</div>";
|
||||
|
||||
|
@ -311,7 +311,6 @@ contextMenu = {
|
||||
|
||||
contextMenu.fns = [
|
||||
function() { album.setPublic(albumID) },
|
||||
function() { password.set(albumID) },
|
||||
function() { album.share(0) },
|
||||
function() { album.share(1) },
|
||||
function() { album.share(2) },
|
||||
@ -322,15 +321,12 @@ contextMenu = {
|
||||
["<input readonly id='link' value='" + location.href + "'>", -1],
|
||||
["separator", -1],
|
||||
["<a class='icon-eye-close'></a> Make Private", 0],
|
||||
["<a class='icon-lock'></a> Set Password", 1],
|
||||
["separator", -1],
|
||||
["<a class='icon-twitter'></a> Twitter", 2],
|
||||
["<a class='icon-facebook'></a> Facebook", 3],
|
||||
["<a class='icon-envelope'></a> Mail", 4],
|
||||
["<a class='icon-twitter'></a> Twitter", 1],
|
||||
["<a class='icon-facebook'></a> Facebook", 2],
|
||||
["<a class='icon-envelope'></a> Mail", 3],
|
||||
];
|
||||
|
||||
if (album.json.password==true) items[3] = ["<a class='icon-unlock'></a> Remove Password", 5];
|
||||
|
||||
contextMenu.show(items, mouse_x, mouse_y, "left");
|
||||
$(".contextmenu input").focus().select();
|
||||
|
||||
|
@ -9,33 +9,6 @@ password = {
|
||||
|
||||
value: "",
|
||||
|
||||
set: function(albumID) {
|
||||
|
||||
var buttons,
|
||||
params;
|
||||
|
||||
buttons = [
|
||||
["Set Password", function() {
|
||||
|
||||
if (visible.album()) {
|
||||
album.json.password = true;
|
||||
view.album.password();
|
||||
}
|
||||
|
||||
params = "setAlbumPassword&albumID=" + albumID + "&password=" + md5($(".message input.text").val());
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
}],
|
||||
["Cancel", function() {}]
|
||||
];
|
||||
modal.show("Set Password", "Set a password to protect '" + album.json.title + "' from unauthorized viewers. Only people with this password can view this album. <input class='text' type='password' placeholder='password' value=''>", buttons);
|
||||
|
||||
},
|
||||
|
||||
get: function(albumID, callback) {
|
||||
|
||||
var passwd = $(".message input.text").val(),
|
||||
@ -85,24 +58,6 @@ password = {
|
||||
];
|
||||
modal.show("<a class='icon-lock'></a> Enter Password", "This album is protected by a password. Enter the password below to view the photos of this album: <input class='text' type='password' placeholder='password' value=''>", buttons, -110, false);
|
||||
|
||||
},
|
||||
|
||||
remove: function(albumID) {
|
||||
|
||||
var params;
|
||||
|
||||
if (visible.album()) {
|
||||
album.json.password = false;
|
||||
view.album.password();
|
||||
}
|
||||
|
||||
params = "setAlbumPassword&albumID=" + albumID + "&password=";
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data!==true) lychee.error(null, params, data);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
@ -144,10 +144,14 @@ view = {
|
||||
|
||||
}
|
||||
|
||||
if (smartData===""&&albumsData==="") $("body").append(build.no_content("picture"));
|
||||
else lychee.content.html(smartData + albumsData);
|
||||
if (smartData===""&&albumsData==="") {
|
||||
lychee.content.html('');
|
||||
$("body").append(build.no_content("picture"));
|
||||
} else {
|
||||
lychee.content.html(smartData + albumsData);
|
||||
}
|
||||
|
||||
$("img[data-type!='svg']").retina();
|
||||
$("img[data-type!='nonretina']").retina();
|
||||
|
||||
},
|
||||
|
||||
|
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
@ -22,7 +22,6 @@ class Admin extends Access {
|
||||
case 'setAlbumTitle': $this->setAlbumTitle(); break;
|
||||
case 'setAlbumDescription': $this->setAlbumDescription(); break;
|
||||
case 'setAlbumPublic': $this->setAlbumPublic(); break;
|
||||
case 'setAlbumPassword': $this->setAlbumPassword(); break;
|
||||
case 'deleteAlbum': $this->deleteAlbum(); break;
|
||||
|
||||
# Photo functions
|
||||
@ -110,17 +109,9 @@ class Admin extends Access {
|
||||
|
||||
private function setAlbumPublic() {
|
||||
|
||||
Module::dependencies(isset($_POST['albumID'], $_POST['password']));
|
||||
Module::dependencies(isset($_POST['albumID'], $_POST['password'], $_POST['visible']));
|
||||
$album = new Album($this->database, $this->plugins, $this->settings, $_POST['albumID']);
|
||||
echo $album->setPublic($_POST['password']);
|
||||
|
||||
}
|
||||
|
||||
private function setAlbumPassword() {
|
||||
|
||||
Module::dependencies(isset($_POST['albumID'], $_POST['password']));
|
||||
$album = new Album($this->database, $this->plugins, $this->settings, $_POST['albumID']);
|
||||
echo $album->setPassword($_POST['password']);
|
||||
echo $album->setPublic($_POST['password'], $_POST['visible']);
|
||||
|
||||
}
|
||||
|
||||
|
@ -441,7 +441,7 @@ class Album extends Module {
|
||||
|
||||
}
|
||||
|
||||
public function setPublic($password) {
|
||||
public function setPublic($password, $visible) {
|
||||
|
||||
# Check dependencies
|
||||
self::dependencies(isset($this->database, $this->albumIDs));
|
||||
@ -457,8 +457,11 @@ class Album extends Module {
|
||||
# Invert public
|
||||
$public = ($album->public=='0' ? 1 : 0);
|
||||
|
||||
# Convert visible
|
||||
$visible = ($visible==='true' ? 1 : 0);
|
||||
|
||||
# Set public
|
||||
$result = $this->database->query("UPDATE lychee_albums SET public = '$public', visible = 1, password = NULL WHERE id = '$album->id';");
|
||||
$result = $this->database->query("UPDATE lychee_albums SET public = '$public', visible = '$visible', password = NULL WHERE id = '$album->id';");
|
||||
if (!$result) {
|
||||
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
||||
return false;
|
||||
@ -485,7 +488,7 @@ class Album extends Module {
|
||||
|
||||
}
|
||||
|
||||
public function setPassword($password) {
|
||||
private function setPassword($password) {
|
||||
|
||||
# Check dependencies
|
||||
self::dependencies(isset($this->database, $this->albumIDs));
|
||||
@ -499,12 +502,12 @@ class Album extends Module {
|
||||
$password = get_hashed_password($password);
|
||||
|
||||
# Set hashed password
|
||||
$result = $this->database->query("UPDATE lychee_albums SET visible = 0, password = '$password' WHERE id IN ('$this->albumIDs');");
|
||||
$result = $this->database->query("UPDATE lychee_albums SET password = '$password' WHERE id IN ('$this->albumIDs');");
|
||||
|
||||
} else {
|
||||
|
||||
# Unset password
|
||||
$result = $this->database->query("UPDATE lychee_albums SET visible = 1, password = NULL WHERE id IN ('$this->albumIDs');");
|
||||
$result = $this->database->query("UPDATE lychee_albums SET password = NULL WHERE id IN ('$this->albumIDs');");
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user