Lychee 1.2
- Share whole albums - Public Mode - Import images via URL - New Share-Button - Improved Toolbar - Check for updates (see config.php) - ASC or DESC sorting (see config.php) - Download album fixed - Code optimizations (thanks @tibounise) - Changes and enhancements Update from version 1.0 or 1.1: 1. Replace all files, excluding `uploads/` 2. Open php/config.php and reconfigure your installation (We added new settings) 3. Open php/update.php in your browser
This commit is contained in:
parent
b0dccfb3e0
commit
4e5c836b8d
171
css/style.css
171
css/style.css
@ -25,10 +25,10 @@ html, body {
|
|||||||
body { background-color: #222; background-image: url(../img/background.jpg); font-family:'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; -webkit-font-smoothing: antialiased; }
|
body { background-color: #222; background-image: url(../img/background.jpg); font-family:'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; -webkit-font-smoothing: antialiased; }
|
||||||
.center { left: 50%; top:50%; position: absolute; }
|
.center { left: 50%; top:50%; position: absolute; }
|
||||||
* {
|
* {
|
||||||
-webkit-transition: opacity .3s ease-out, -webkit-transform .3s ease-out, box-shadow .3s;
|
-webkit-transition: color .3s, opacity .3s ease-out, -webkit-transform .3s ease-out, box-shadow .3s;
|
||||||
-moz-transition: opacity .3s ease-out, -moz-transform .3s ease-out, box-shadow .3s;
|
-moz-transition: opacity .3s ease-out, -moz-transform .3s ease-out, box-shadow .3s;
|
||||||
-o-transition: opacity .3s ease-out, -o-transform .3s ease-out, box-shadow .3s;
|
-o-transition: opacity .3s ease-out, -o-transform .3s ease-out, box-shadow .3s;
|
||||||
transition: opacity .3s ease-out, transform .3s ease-out, box-shadow .3s;
|
transition: color .3s, opacity .3s ease-out, transform .3s ease-out, box-shadow .3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tooltip ------------------------------------------------*/
|
/* Tooltip ------------------------------------------------*/
|
||||||
@ -193,6 +193,7 @@ body { background-color: #222; background-image: url(../img/background.jpg); fon
|
|||||||
background-color: #2f0d0e;
|
background-color: #2f0d0e;
|
||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
display: none;
|
||||||
|
|
||||||
/* Animation */
|
/* Animation */
|
||||||
-webkit-animation-name: moveBackground;
|
-webkit-animation-name: moveBackground;
|
||||||
@ -235,7 +236,7 @@ body { background-color: #222; background-image: url(../img/background.jpg); fon
|
|||||||
/* Header ------------------------------------------------*/
|
/* Header ------------------------------------------------*/
|
||||||
header {
|
header {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
height: 40px;
|
height: 41px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
@ -279,7 +280,7 @@ header {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
margin: 0px 30%;
|
margin: 0px 30%;
|
||||||
width: 40%;
|
width: 40%;
|
||||||
margin-top: 11px;
|
padding: 11px 0px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -345,23 +346,17 @@ header {
|
|||||||
font-family: 'FontAwesome';
|
font-family: 'FontAwesome';
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
#tools_albums, #tools_album, #tools_photo {
|
#tools_albums, #tools_album, #tools_photo, #button_signin {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Button Custom ------------------------------------------------*/
|
|
||||||
header .button.icon-refresh {
|
|
||||||
padding: 7px 10px 4px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Button Divider ------------------------------------------------*/
|
/* Button Divider ------------------------------------------------*/
|
||||||
header .button_divider {
|
header .button_divider {
|
||||||
float: right;
|
float: right;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-right: 11px;
|
margin: 1px 12px 0px 0px;
|
||||||
margin-top: 1px;
|
|
||||||
width: 1px;
|
width: 1px;
|
||||||
height: 39px;
|
height: 40px;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(68, 68, 68)), to(rgb(37, 37, 37)));
|
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(68, 68, 68)), to(rgb(37, 37, 37)));
|
||||||
background-image: -webkit-linear-gradient(top, rgba(68, 68, 68, 0), rgb(25, 25, 25));
|
background-image: -webkit-linear-gradient(top, rgba(68, 68, 68, 0), rgb(25, 25, 25));
|
||||||
@ -372,7 +367,7 @@ header {
|
|||||||
border-right: 1px solid #555;
|
border-right: 1px solid #555;
|
||||||
}
|
}
|
||||||
header .button_divider.less {
|
header .button_divider.less {
|
||||||
margin-right: 8px;
|
margin: 1px 6px 0px 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -380,7 +375,7 @@ header {
|
|||||||
#search {
|
#search {
|
||||||
float: right;
|
float: right;
|
||||||
width: 80px;
|
width: 80px;
|
||||||
margin: 7px 8px 0px 0px;
|
margin: 7px 12px 0px 0px;
|
||||||
padding: 5px 10px 7px 10px;
|
padding: 5px 10px 7px 10px;
|
||||||
background-color: #444;
|
background-color: #444;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@ -398,31 +393,28 @@ header {
|
|||||||
#search:focus {
|
#search:focus {
|
||||||
box-shadow: 0px 1px 0px #555, inset 0px 0px 2px #333;
|
box-shadow: 0px 1px 0px #555, inset 0px 0px 2px #333;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
width: 150px;
|
width: 140px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tools ------------------------------------------------*/
|
/* Tools ------------------------------------------------*/
|
||||||
|
.tools:first-of-type {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
.tools {
|
.tools {
|
||||||
float: right;
|
float: right;
|
||||||
padding: 5px 5px 5px 5px;
|
padding: 10px 8px;
|
||||||
margin: 5px 8px 0px 0px;
|
|
||||||
font-family: 'IconicStroke';
|
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
font-size: 21px;
|
font-size: 21px;
|
||||||
text-shadow: 0px -1px 0px #222;
|
text-shadow: 0px -1px 0px #222;
|
||||||
border-radius: 3px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.tools a.list {
|
|
||||||
line-height: 21px;
|
|
||||||
}
|
|
||||||
.tools:hover a {
|
.tools:hover a {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
.tools .icon-star {
|
.tools .icon-star {
|
||||||
color: #f0ef77;
|
color: #f0ef77;
|
||||||
}
|
}
|
||||||
.tools .icon-rss.active {
|
.tools .icon-share.active {
|
||||||
color: #ff9737;
|
color: #ff9737;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,8 +548,13 @@ header {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
text-shadow: 0px 1px 0px #000;
|
text-shadow: 0px 1px 0px #000;
|
||||||
font-family: 'IconicStroke';
|
opacity: .9;
|
||||||
opacity: 0.9;
|
}
|
||||||
|
.album .badge.icon-star, .photo .badge.icon-star {
|
||||||
|
padding: 12px 8px 3px 8px;
|
||||||
|
}
|
||||||
|
.album .badge.icon-share, .photo .badge.icon-share {
|
||||||
|
padding: 12px 6px 3px 8px;
|
||||||
}
|
}
|
||||||
.album .badge::after, .photo .badge::after {
|
.album .badge::after, .photo .badge::after {
|
||||||
content: "";
|
content: "";
|
||||||
@ -566,7 +563,6 @@ header {
|
|||||||
margin-left: -26px;
|
margin-left: -26px;
|
||||||
width: 34px;
|
width: 34px;
|
||||||
height: 5px;
|
height: 5px;
|
||||||
/* inset 0px 1px 1px rgba(0,0,0,.3); */
|
|
||||||
background: -moz-linear-gradient(top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%); /* FF3.6+ */
|
background: -moz-linear-gradient(top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%); /* FF3.6+ */
|
||||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,1)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
|
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,1)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
|
||||||
background: -webkit-linear-gradient(top, rgba(0,0,0,1) 0%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
|
background: -webkit-linear-gradient(top, rgba(0,0,0,1) 0%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
|
||||||
@ -580,12 +576,16 @@ header {
|
|||||||
margin-left: -28px;
|
margin-left: -28px;
|
||||||
width: 36px;
|
width: 36px;
|
||||||
}
|
}
|
||||||
|
.album .badge.icon-share::after, .photo .badge.icon-share::after {
|
||||||
|
margin-left: -30px;
|
||||||
|
width: 38px;
|
||||||
|
}
|
||||||
.album .badge.icon-reorder::after {
|
.album .badge.icon-reorder::after {
|
||||||
margin-left: -30px;
|
margin-left: -30px;
|
||||||
width: 38px;
|
width: 38px;
|
||||||
}
|
}
|
||||||
.album .badge:nth-child(2n), .photo .badge:nth-child(2n) {
|
.album .badge:nth-child(2n), .photo .badge:nth-child(2n) {
|
||||||
margin-left: 55px;
|
margin-left: 57px;
|
||||||
}
|
}
|
||||||
.album .badge.red, .photo .badge.red {
|
.album .badge.red, .photo .badge.red {
|
||||||
background: #d64b4b;
|
background: #d64b4b;
|
||||||
@ -608,7 +608,7 @@ header {
|
|||||||
.divider {
|
.divider {
|
||||||
float: left;
|
float: left;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 31px;
|
height: 32px;
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
||||||
@ -623,9 +623,10 @@ header {
|
|||||||
box-shadow: 0px 1px 0px #111, inset 0px 1px 0px rgba(255, 255, 255, .1);
|
box-shadow: 0px 1px 0px #111, inset 0px 1px 0px rgba(255, 255, 255, .1);
|
||||||
}
|
}
|
||||||
.divider:first-child {
|
.divider:first-child {
|
||||||
margin-top: 1px;
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
.divider h1 {
|
.divider h1 {
|
||||||
|
float: left;
|
||||||
margin: 8px 0px 0px 30px;
|
margin: 8px 0px 0px 30px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@ -633,6 +634,29 @@ header {
|
|||||||
text-shadow: 0px -1px 0px #000;
|
text-shadow: 0px -1px 0px #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* No Content ------------------------------------------------*/
|
||||||
|
.no_content {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
height: 160px;
|
||||||
|
width: 180px;
|
||||||
|
margin-top: -80px;
|
||||||
|
margin-left: -90px;
|
||||||
|
padding-top: 20px;
|
||||||
|
color: rgba(20, 20, 20, 1);
|
||||||
|
text-shadow: 0px 1px 0px rgba(255, 255, 255, .05);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no_content .icon {
|
||||||
|
font-size: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no_content p {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Overlay ------------------------------------------------*/
|
/* Overlay ------------------------------------------------*/
|
||||||
.message_overlay {
|
.message_overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@ -683,9 +707,6 @@ header {
|
|||||||
animation-timing-function: ease-out;
|
animation-timing-function: ease-out;
|
||||||
animation-fill-mode: forwards;
|
animation-fill-mode: forwards;
|
||||||
}
|
}
|
||||||
.message.add {
|
|
||||||
margin-top: -155px;
|
|
||||||
}
|
|
||||||
.message h1 {
|
.message h1 {
|
||||||
float: left;
|
float: left;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -698,13 +719,17 @@ header {
|
|||||||
}
|
}
|
||||||
.message .close {
|
.message .close {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 0px;
|
||||||
right: 12px;
|
right: 0px;
|
||||||
|
padding: 12px 14px 6px 7px;
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
text-shadow: 0px -1px 0px #111;
|
text-shadow: 0px -1px 0px #111;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.message .close:hover {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
.message p {
|
.message p {
|
||||||
float: left;
|
float: left;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
@ -764,15 +789,21 @@ header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add Album ------------------------------------------------*/
|
/* Add Album ------------------------------------------------*/
|
||||||
|
.message.add {
|
||||||
|
width: 588px;
|
||||||
|
margin-top: -152px;
|
||||||
|
margin-left: -294px;
|
||||||
|
}
|
||||||
.add_album {
|
.add_album {
|
||||||
float: left;
|
float: left;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 200px;
|
width: 150px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
margin: 30px 0px 30px 30px;
|
margin: 30px 0px 30px 30px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
border: 3px dashed #777;
|
border: 3px dashed #777;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
text-align: center;
|
||||||
-webkit-transition: border .3s;
|
-webkit-transition: border .3s;
|
||||||
-moz-transition: border .3s;
|
-moz-transition: border .3s;
|
||||||
-o-transition: border .3s;
|
-o-transition: border .3s;
|
||||||
@ -782,15 +813,11 @@ header {
|
|||||||
border: 3px dashed #fff;
|
border: 3px dashed #fff;
|
||||||
}
|
}
|
||||||
.add_album .icon {
|
.add_album .icon {
|
||||||
margin: 55px 65px 0px 65px;
|
margin-top: 55px;
|
||||||
color: #777;
|
color: #777;
|
||||||
font-family: 'FontAwesome';
|
font-family: 'FontAwesome';
|
||||||
font-size: 80px;
|
font-size: 80px;
|
||||||
text-shadow: 0px 1px 2px #000;
|
text-shadow: 0px 1px 2px #000;
|
||||||
-webkit-transition: color .3s;
|
|
||||||
-moz-transition: color .3s;
|
|
||||||
-o-transition: color .3s;
|
|
||||||
transition: color .3s;
|
|
||||||
}
|
}
|
||||||
.add_album:hover .icon {
|
.add_album:hover .icon {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@ -802,11 +829,6 @@ header {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-shadow: 0px 1px 0px #000;
|
text-shadow: 0px 1px 0px #000;
|
||||||
text-align: center;
|
|
||||||
-webkit-transition: color .3s;
|
|
||||||
-moz-transition: color .3s;
|
|
||||||
-o-transition: color .3s;
|
|
||||||
transition: color .3s;
|
|
||||||
}
|
}
|
||||||
.add_album:hover a {
|
.add_album:hover a {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@ -853,8 +875,14 @@ header {
|
|||||||
color: #888;
|
color: #888;
|
||||||
text-shadow: 0px -1px 0px #111;
|
text-shadow: 0px -1px 0px #111;
|
||||||
}
|
}
|
||||||
|
.message #version span {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.message #version span a {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
|
||||||
/* Sign in ------------------------------------------------*/
|
/* Copy Link ------------------------------------------------*/
|
||||||
.copylink {
|
.copylink {
|
||||||
float: left;
|
float: left;
|
||||||
width: 95%;
|
width: 95%;
|
||||||
@ -1018,9 +1046,8 @@ header {
|
|||||||
text-shadow: 0px -1px 0px #000;
|
text-shadow: 0px -1px 0px #000;
|
||||||
}
|
}
|
||||||
#infobox .header a {
|
#infobox .header a {
|
||||||
position: absolute;
|
float: right;
|
||||||
right: 15px;
|
padding: 10px 15px;
|
||||||
margin: 10px 0px;
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 21px;
|
font-size: 21px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -1126,6 +1153,19 @@ header {
|
|||||||
background-image: -ms-linear-gradient(top, #6a84f2, #3959ef);
|
background-image: -ms-linear-gradient(top, #6a84f2, #3959ef);
|
||||||
background-image: linear-gradient(top, #6a84f2, #3959ef);
|
background-image: linear-gradient(top, #6a84f2, #3959ef);
|
||||||
}
|
}
|
||||||
|
.contextmenu tr.separator {
|
||||||
|
float: left;
|
||||||
|
height: 1px;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #222;
|
||||||
|
box-shadow: 0px 1px 0px #555;
|
||||||
|
margin: 4px 0px 5px 0px;
|
||||||
|
cursor: inherit;
|
||||||
|
}
|
||||||
|
.contextmenu tr.separator:hover {
|
||||||
|
background-color: #222;
|
||||||
|
background-image: none;
|
||||||
|
}
|
||||||
.contextmenu tr td {
|
.contextmenu tr td {
|
||||||
padding: 5px 20px 5px 10px;
|
padding: 5px 20px 5px 10px;
|
||||||
-webkit-transition: none;
|
-webkit-transition: none;
|
||||||
@ -1287,10 +1327,7 @@ header {
|
|||||||
/* Screen behavior -------------------------------------------------*/
|
/* Screen behavior -------------------------------------------------*/
|
||||||
@media only screen and (max-width: 900px) {
|
@media only screen and (max-width: 900px) {
|
||||||
|
|
||||||
#title {
|
#title { margin: 0px 30%; width: 50%; }
|
||||||
margin: 11px 30% 0px 20%;
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
#title.view { margin: 11px 20% 0px 20%; width: 60%; }
|
#title.view { margin: 11px 20% 0px 20%; width: 60%; }
|
||||||
#title span { display: none; }
|
#title span { display: none; }
|
||||||
|
|
||||||
@ -1302,10 +1339,10 @@ header {
|
|||||||
#button_move { display: none; }
|
#button_move { display: none; }
|
||||||
#button_archive { display: none; }
|
#button_archive { display: none; }
|
||||||
|
|
||||||
.center {
|
.center { top: 0px; left: 0px; }
|
||||||
top: 0px;
|
|
||||||
left: 0px;
|
.album { margin: 40px 0px 0px 50px; }
|
||||||
}
|
.photo { margin: 40px 0px 0px 50px; }
|
||||||
|
|
||||||
.message {
|
.message {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@ -1325,20 +1362,20 @@ header {
|
|||||||
animation-duration: .3s;
|
animation-duration: .3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.album {
|
|
||||||
margin: 40px 0px 0px 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo {
|
|
||||||
margin: 40px 0px 0px 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message.add {
|
.message.add {
|
||||||
|
width: 100%;
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.add_album {
|
.add_album {
|
||||||
margin: 30px 0px -10px 55px;
|
width: 88%;
|
||||||
|
height: 100px;
|
||||||
|
margin: 30px 5% -10px 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add_album .icon {
|
||||||
|
margin-top: 18px;
|
||||||
|
font-size: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
0
img/no_images.png
Normal file → Executable file
0
img/no_images.png
Normal file → Executable file
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
0
img/no_images@2x.png
Normal file → Executable file
0
img/no_images@2x.png
Normal file → Executable file
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
BIN
img/password.png
Executable file
BIN
img/password.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
img/password@2x.png
Executable file
BIN
img/password@2x.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
12
index.html
12
index.html
@ -31,6 +31,7 @@
|
|||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
<div id="tools_albums">
|
<div id="tools_albums">
|
||||||
<a class="button" id="button_signout">Sign Out</a>
|
<a class="button" id="button_signout">Sign Out</a>
|
||||||
|
<a class="button" id="button_signin">Sign In</a>
|
||||||
<a class="button icon icon-plus-sign button_add"></a>
|
<a class="button icon icon-plus-sign button_add"></a>
|
||||||
<a class="button_divider"></a>
|
<a class="button_divider"></a>
|
||||||
<input id="search" type="text" name="search" placeholder="Search …">
|
<input id="search" type="text" name="search" placeholder="Search …">
|
||||||
@ -38,21 +39,22 @@
|
|||||||
<div id="tools_album">
|
<div id="tools_album">
|
||||||
<a class="button" id="button_back_home">Back</a>
|
<a class="button" id="button_back_home">Back</a>
|
||||||
<a class="button icon icon-plus-sign button_add"></a>
|
<a class="button icon icon-plus-sign button_add"></a>
|
||||||
<a class="button icon icon-circle-arrow-down" id="button_archive"></a>
|
|
||||||
<a class="button_divider"></a>
|
<a class="button_divider"></a>
|
||||||
<div class="tools" id="button_trash_album" title="Delete Album"><a class="icon-trash"></a></div>
|
<div class="tools" id="button_trash_album" title="Delete Album"><a class="icon-trash"></a></div>
|
||||||
|
<div class="tools" id="button_archive" title="Download Album"><a class="icon-circle-arrow-down"></a></div>
|
||||||
<div class="tools" id="button_edit_album" title="Edit Title"><a class="icon-edit"></a></div>
|
<div class="tools" id="button_edit_album" title="Edit Title"><a class="icon-edit"></a></div>
|
||||||
|
<div class="tools" id="button_share_album" title="Share Album"><a class="icon-share"></a></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="tools_photo">
|
<div id="tools_photo">
|
||||||
<a class="button" id="button_back">Back</a>
|
<a class="button" id="button_back">Back</a>
|
||||||
<div class="tools" id="button_trash" title="Delete"><a class="icon-trash"></a></div>
|
<div class="tools" id="button_trash" title="Delete"><a class="icon-trash"></a></div>
|
||||||
<div class="tools" id="button_move" title="Move to Album"><a class="icon-folder-open"></a></div>
|
<div class="tools" id="button_move" title="Move to Album"><a class="icon-folder-open"></a></div>
|
||||||
<div class="tools" id="button_download" title="Full Photo"><a class="icon-resize-full"></a></div>
|
|
||||||
<a class="button_divider less"></a>
|
|
||||||
<div class="tools" id="button_info" title="Show Info"><a class="icon-info-sign"></a></div>
|
|
||||||
<div class="tools" id="button_edit" title="Edit Title"><a class="icon-edit"></a></div>
|
<div class="tools" id="button_edit" title="Edit Title"><a class="icon-edit"></a></div>
|
||||||
<a class="button_divider less"></a>
|
<a class="button_divider less"></a>
|
||||||
<div class="tools" id="button_share" title="Share Photo"><a class="icon-rss"></a></div>
|
<div class="tools" id="button_download" title="Full Photo"><a class="icon-resize-full"></a></div>
|
||||||
|
<div class="tools" id="button_info" title="Show Info"><a class="icon-info-sign"></a></div>
|
||||||
|
<a class="button_divider less"></a>
|
||||||
|
<div class="tools" id="button_share" title="Share Photo"><a class="icon-share"></a></div>
|
||||||
<div class="tools" id="button_star" title="Star Photo"><a class="icon-star-empty"></a></div>
|
<div class="tools" id="button_star" title="Star Photo"><a class="icon-star-empty"></a></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
37
js/main.js
37
js/main.js
@ -15,10 +15,7 @@ $(document).ready(function(){
|
|||||||
else event_name = "click";
|
else event_name = "click";
|
||||||
|
|
||||||
/* Toolbar */
|
/* Toolbar */
|
||||||
$("#button_signout").on(event_name, function() {
|
$("#button_signout").on(event_name, lychee.logout);
|
||||||
modal = build.modal("Sign Out", "Are you sure you want to leave and log out?", ["Sign out", "Stay here"], ["lychee.logout();", ""]);
|
|
||||||
$("body").append(modal);
|
|
||||||
});
|
|
||||||
$("#button_download").on(event_name, function() {
|
$("#button_download").on(event_name, function() {
|
||||||
link = $("#image_view #image").css("background-image").replace(/"/g,"").replace(/url\(|\)$/ig, "");
|
link = $("#image_view #image").css("background-image").replace(/"/g,"").replace(/url\(|\)$/ig, "");
|
||||||
window.open(link,"_newtab");
|
window.open(link,"_newtab");
|
||||||
@ -27,11 +24,15 @@ $(document).ready(function(){
|
|||||||
if ($("#button_share a.active").length) contextMenu.share(lychee.image_view.attr("data-id"), e.pageX, e.pageY);
|
if ($("#button_share a.active").length) contextMenu.share(lychee.image_view.attr("data-id"), e.pageX, e.pageY);
|
||||||
else photos.setPublic(e);
|
else photos.setPublic(e);
|
||||||
});
|
});
|
||||||
|
$("#button_share_album").on(event_name, function(e) {
|
||||||
|
if ($("#button_share_album a.active").length) contextMenu.share_album(lychee.content.attr("data-id"), e.pageX, e.pageY);
|
||||||
|
else albums.setPublic(e);
|
||||||
|
});
|
||||||
$("#button_trash_album").on(event_name, function() { albums.deleteDialog(lychee.content.attr("data-id")) });
|
$("#button_trash_album").on(event_name, function() { albums.deleteDialog(lychee.content.attr("data-id")) });
|
||||||
$("#button_move").on(event_name, function(e) { contextMenu.move(lychee.image_view.attr("data-id"), e.pageX, e.pageY) });
|
$("#button_move").on(event_name, function(e) { contextMenu.move(lychee.image_view.attr("data-id"), e.pageX, e.pageY) });
|
||||||
$("#button_trash").on(event_name, function() { photos.deleteDialog() });
|
$("#button_trash").on(event_name, function() { photos.deleteDialog() });
|
||||||
$("#button_edit_album").on(event_name, function() { albums.rename() });
|
$("#button_edit_album").on(event_name, function() { albums.setTitle() });
|
||||||
$("#button_edit").on(event_name, function() { photos.rename() });
|
$("#button_edit").on(event_name, function() { photos.setTitle() });
|
||||||
$("#button_info").on(event_name, function() { photos.showInfobox() });
|
$("#button_info").on(event_name, function() { photos.showInfobox() });
|
||||||
$("#button_archive").on(event_name, function() { albums.getArchive() });
|
$("#button_archive").on(event_name, function() { albums.getArchive() });
|
||||||
$("#button_star").on(event_name, function() { photos.setStar() });
|
$("#button_star").on(event_name, function() { photos.setStar() });
|
||||||
@ -52,7 +53,7 @@ $(document).ready(function(){
|
|||||||
/* Infobox */
|
/* Infobox */
|
||||||
$("#infobox")
|
$("#infobox")
|
||||||
.on(event_name, ".header a", function() { photos.hideInfobox() })
|
.on(event_name, ".header a", function() { photos.hideInfobox() })
|
||||||
.on(event_name, "#edit_title", function() { photos.rename() })
|
.on(event_name, "#edit_title", function() { photos.setTitle() })
|
||||||
.on(event_name, "#edit_description", function() { photos.setDescription() });
|
.on(event_name, "#edit_description", function() { photos.setDescription() });
|
||||||
|
|
||||||
/* Keyboard */
|
/* Keyboard */
|
||||||
@ -72,7 +73,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
Mousetrap.bindGlobal('esc', function(e) {
|
Mousetrap.bindGlobal('esc', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if ($(".message").length&&$(".sign_in").length==0) lychee.closeModal();
|
if ($(".message").length) lychee.closeModal();
|
||||||
else if (visible.infobox()) photos.hideInfobox();
|
else if (visible.infobox()) photos.hideInfobox();
|
||||||
else if (visible.imageview()) lychee.goto("a" + lychee.content.attr("data-id"));
|
else if (visible.imageview()) lychee.goto("a" + lychee.content.attr("data-id"));
|
||||||
else if (visible.albums()&&$("#search").val().length!=0) search.reset();
|
else if (visible.albums()&&$("#search").val().length!=0) search.reset();
|
||||||
@ -82,10 +83,11 @@ $(document).ready(function(){
|
|||||||
$(document)
|
$(document)
|
||||||
|
|
||||||
/* Login */
|
/* Login */
|
||||||
|
.on(event_name, "#button_signin", function() { lychee.showLogin() })
|
||||||
.on("keyup", "#password", function() { if ($(this).val().length>0) $(this).removeClass("error") })
|
.on("keyup", "#password", function() { if ($(this).val().length>0) $(this).removeClass("error") })
|
||||||
|
|
||||||
/* Toolbar */
|
/* Toolbar */
|
||||||
.on(event_name, "#title.editable", function() { if (visible.imageview()) photos.rename(); else albums.rename(); })
|
.on(event_name, "#title.editable", function() { if (visible.imageview()) photos.setTitle(); else albums.setTitle(); })
|
||||||
|
|
||||||
/* Navigation */
|
/* Navigation */
|
||||||
.on("click", ".album", function() { lychee.goto("a" + $(this).attr("data-id")) })
|
.on("click", ".album", function() { lychee.goto("a" + $(this).attr("data-id")) })
|
||||||
@ -100,6 +102,7 @@ $(document).ready(function(){
|
|||||||
/* Add Dialog */
|
/* Add Dialog */
|
||||||
.on(event_name, ".button_add", function() { $("body").append(build.addModal) })
|
.on(event_name, ".button_add", function() { $("body").append(build.addModal) })
|
||||||
.on(event_name, "#add_album", albums.add)
|
.on(event_name, "#add_album", albums.add)
|
||||||
|
.on(event_name, "#add_link", lychee.importUrl)
|
||||||
.on(event_name, "#add_photo", function() { $("#auswahl").html(""); $("#upload_files").click() })
|
.on(event_name, "#add_photo", function() { $("#auswahl").html(""); $("#upload_files").click() })
|
||||||
|
|
||||||
/* Upload */
|
/* Upload */
|
||||||
@ -115,14 +118,18 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
/* Controls */
|
/* Controls */
|
||||||
.bind("mouseenter", lychee.showControls)
|
.bind("mouseenter", lychee.showControls)
|
||||||
.bind("mouseleave", lychee.hideControls);
|
.bind("mouseleave", lychee.hideControls)
|
||||||
|
|
||||||
/* Upload */
|
/* Upload */
|
||||||
$(document.documentElement)
|
.on("dragover", function(e) { e.preventDefault(); }, false)
|
||||||
.on("dragover", function(e) { e.preventDefault();}, false)
|
.on("drop", function(e) {
|
||||||
.on("drop", function (e) { e.stopPropagation(); e.preventDefault(); lychee.upload(e.originalEvent.dataTransfer.files); return true; });
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
lychee.upload(e.originalEvent.dataTransfer.files);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
/* Init */
|
/* Init */
|
||||||
lychee.ready();
|
lychee.ready();
|
||||||
|
|
||||||
});
|
});
|
152
js/modules/albums.js
Normal file → Executable file
152
js/modules/albums.js
Normal file → Executable file
@ -12,7 +12,6 @@ albums = {
|
|||||||
|
|
||||||
load: function() {
|
load: function() {
|
||||||
|
|
||||||
loadingBar.show();
|
|
||||||
lychee.animate(".album, .photo", "contentZoomOut");
|
lychee.animate(".album, .photo", "contentZoomOut");
|
||||||
|
|
||||||
/* Search */
|
/* Search */
|
||||||
@ -59,7 +58,8 @@ albums = {
|
|||||||
if (data.publicThumb1) publicAlbum.thumb1 = lychee.upload_path + data.publicThumb1; else publicAlbum.thumb1 = "";
|
if (data.publicThumb1) publicAlbum.thumb1 = lychee.upload_path + data.publicThumb1; else publicAlbum.thumb1 = "";
|
||||||
if (data.publicThumb2) publicAlbum.thumb2 = lychee.upload_path + data.publicThumb2; else publicAlbum.thumb2 = "";
|
if (data.publicThumb2) publicAlbum.thumb2 = lychee.upload_path + data.publicThumb2; else publicAlbum.thumb2 = "";
|
||||||
|
|
||||||
smartData = build.divider("Smart Albums") + build.album(unsortedAlbum) + build.album(starredAlbum) + build.album(publicAlbum);
|
if (lychee.publicMode) smartData = "";
|
||||||
|
else smartData = build.divider("Smart Albums") + build.album(unsortedAlbum) + build.album(starredAlbum) + build.album(publicAlbum);
|
||||||
|
|
||||||
/* Albums */
|
/* Albums */
|
||||||
if (data.albums) {
|
if (data.albums) {
|
||||||
@ -69,66 +69,80 @@ albums = {
|
|||||||
|
|
||||||
} else albumsData = "";
|
} else albumsData = "";
|
||||||
|
|
||||||
lychee.content.html(smartData + albumsData);
|
if (smartData==""&&albumsData=="") $("body").append(build.no_content("picture"));
|
||||||
lychee.animate(".album, .photo", "contentZoomIn");
|
else {
|
||||||
|
lychee.content.html(smartData + albumsData);
|
||||||
|
lychee.animate(".album, .photo", "contentZoomIn");
|
||||||
|
}
|
||||||
|
|
||||||
document.title = "Lychee";
|
document.title = "Lychee";
|
||||||
lychee.headerTitle.html("Albums").removeClass("editable");
|
lychee.headerTitle.html("Albums").removeClass("editable");
|
||||||
|
|
||||||
$("img").retina();
|
$("img").retina();
|
||||||
|
|
||||||
loadingBar.hide();
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
loadInfo: function(albumID) {
|
loadInfo: function(albumID, password) {
|
||||||
|
|
||||||
if (albumID=="f"||albumID=="s"||albumID==0) {
|
if (albumID=="f"||albumID=="s"||albumID==0) {
|
||||||
|
|
||||||
lychee.headerTitle.removeClass("editable");
|
lychee.headerTitle.removeClass("editable");
|
||||||
|
|
||||||
|
$("#button_edit_album, #button_trash_album, #button_share_album").hide();
|
||||||
|
|
||||||
lychee.api("getSmartInfo", "json", function(data) {
|
lychee.api("getSmartInfo", "json", function(data) {
|
||||||
|
|
||||||
switch (albumID) {
|
switch (albumID) {
|
||||||
case "f":
|
case "f":
|
||||||
document.title = "Lychee - Starred";
|
document.title = "Lychee - Starred";
|
||||||
lychee.headerTitle.html("Starred<span> - " + data.starredNum + " photos</span>");
|
lychee.headerTitle.html("Starred<span> - " + data.starredNum + " photos</span>");
|
||||||
$("#button_edit_album, #button_trash_album, .button_divider").hide();
|
|
||||||
break;
|
break;
|
||||||
case "s":
|
case "s":
|
||||||
document.title = "Lychee - Public";
|
document.title = "Lychee - Public";
|
||||||
lychee.headerTitle.html("Public<span> - " + data.publicNum + " photos</span>");
|
lychee.headerTitle.html("Public<span> - " + data.publicNum + " photos</span>");
|
||||||
$("#button_edit_album, #button_trash_album, .button_divider").hide();
|
|
||||||
break;
|
break;
|
||||||
case "0":
|
case "0":
|
||||||
document.title = "Lychee - Unsorted";
|
document.title = "Lychee - Unsorted";
|
||||||
lychee.headerTitle.html("Unsorted<span> - " + data.unsortNum + " photos</span>");
|
lychee.headerTitle.html("Unsorted<span> - " + data.unsortNum + " photos</span>");
|
||||||
$("#button_edit_album").hide();
|
$("#button_trash_album").show();
|
||||||
$("#button_trash_album, .button_divider").show();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadingBar.hide();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
params = "getAlbumInfo&albumID=" + albumID;
|
/*if (lychee.publicMode&&password==undefined) {
|
||||||
lychee.api(params, "json", function(data) {
|
password = localStorage.getItem("album" + albumID);
|
||||||
|
if (password==null) {
|
||||||
|
if (lychee.publicMode) password = prompt("Please enter a password for this album:", ""); else password = "";
|
||||||
|
if (password!="") password = hex_md5(password);
|
||||||
|
localStorage.setItem("album" + albumID, password);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
$("#button_edit_album, #button_trash_album, .button_divider").show();
|
password = "";
|
||||||
|
|
||||||
|
$("#button_edit_album, #button_trash_album, #button_share_album, .button_divider").show();
|
||||||
|
|
||||||
|
params = "getAlbumInfo&albumID=" + albumID + "&password=" + password;
|
||||||
|
lychee.api(params, "json", function(data) {
|
||||||
|
|
||||||
if (!data.title) data.title = "Untitled";
|
if (!data.title) data.title = "Untitled";
|
||||||
document.title = "Lychee - " + data.title;
|
document.title = "Lychee - " + data.title;
|
||||||
lychee.headerTitle.html(data.title + "<span> - " + data.num + " photos</span>").addClass("editable");
|
lychee.headerTitle.html(data.title + "<span> - " + data.num + " photos</span>").addClass("editable");
|
||||||
|
|
||||||
loadingBar.hide();
|
if (data.public=="1") {
|
||||||
|
$("#button_share_album a").addClass("active");
|
||||||
|
$("#button_share_album").attr("title", "Share Album");
|
||||||
|
} else {
|
||||||
|
$("#button_share_album a").removeClass("active");
|
||||||
|
$("#button_share_album").attr("title", "Make Public");
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -141,9 +155,7 @@ albums = {
|
|||||||
title = prompt("Please enter a title for this album:", "Untitled");
|
title = prompt("Please enter a title for this album:", "Untitled");
|
||||||
lychee.closeModal();
|
lychee.closeModal();
|
||||||
|
|
||||||
if (title.length>2&&title.length<31) {
|
if (title.length>0&&title.length<31) {
|
||||||
|
|
||||||
loadingBar.show();
|
|
||||||
|
|
||||||
params = "addAlbum&title=" + escape(title);
|
params = "addAlbum&title=" + escape(title);
|
||||||
lychee.api(params, "text", function(data) {
|
lychee.api(params, "text", function(data) {
|
||||||
@ -170,19 +182,13 @@ albums = {
|
|||||||
|
|
||||||
delete: function(albumID, delAll) {
|
delete: function(albumID, delAll) {
|
||||||
|
|
||||||
loadingBar.show();
|
|
||||||
|
|
||||||
params = "deleteAlbum&albumID=" + albumID + "&delAll=" + delAll;
|
params = "deleteAlbum&albumID=" + albumID + "&delAll=" + delAll;
|
||||||
lychee.api(params, "text", function(data) {
|
lychee.api(params, "text", function(data) {
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|
||||||
if (visible.albums()) {
|
if (visible.albums()) albums.hide(albumID);
|
||||||
|
else lychee.goto("");
|
||||||
albums.hide(albumID);
|
|
||||||
loadingBar.hide();
|
|
||||||
|
|
||||||
} else lychee.goto("");
|
|
||||||
|
|
||||||
} else loadingBar.show("error");
|
} else loadingBar.show("error");
|
||||||
|
|
||||||
@ -213,16 +219,14 @@ albums = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
rename: function(albumID) {
|
setTitle: function(albumID) {
|
||||||
|
|
||||||
if (!albumID) oldTitle = lychee.title(); else oldTitle = "";
|
if (!albumID) oldTitle = lychee.title(); else oldTitle = "";
|
||||||
if (!albumID) albumID = lychee.content.attr("data-id");
|
if (!albumID) albumID = lychee.content.attr("data-id");
|
||||||
|
|
||||||
newTitle = prompt("Please enter a new title for this album:", oldTitle);
|
newTitle = prompt("Please enter a new title for this album:", oldTitle);
|
||||||
|
|
||||||
if (albumID!=""&&albumID!=null&&albumID&&newTitle.length>2&&newTitle.length<31) {
|
if (albumID!=""&&albumID!=null&&albumID&&newTitle.length>0&&newTitle.length<31) {
|
||||||
|
|
||||||
loadingBar.show();
|
|
||||||
|
|
||||||
params = "setAlbumTitle&albumID=" + albumID + "&title=" + encodeURI(newTitle);
|
params = "setAlbumTitle&albumID=" + albumID + "&title=" + encodeURI(newTitle);
|
||||||
lychee.api(params, "text", function(data) {
|
lychee.api(params, "text", function(data) {
|
||||||
@ -233,7 +237,6 @@ albums = {
|
|||||||
lychee.headerTitle.html(newTitle + "<span>" + $("#title span").html() + "</span>");
|
lychee.headerTitle.html(newTitle + "<span>" + $("#title span").html() + "</span>");
|
||||||
document.title = "Lychee - " + newTitle;
|
document.title = "Lychee - " + newTitle;
|
||||||
}
|
}
|
||||||
loadingBar.hide();
|
|
||||||
} else loadingBar.show("error");
|
} else loadingBar.show("error");
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -242,6 +245,87 @@ albums = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setPublic: function(e) {
|
||||||
|
|
||||||
|
albumID = lychee.content.attr("data-id");
|
||||||
|
|
||||||
|
params = "setAlbumPublic&albumID=" + albumID;
|
||||||
|
lychee.api(params, "text", function(data) {
|
||||||
|
|
||||||
|
if (data) {
|
||||||
|
|
||||||
|
if ($("#button_share_album a.active").length) {
|
||||||
|
$("#button_share_album a").removeClass("active");
|
||||||
|
$("#button_share_album").attr("title", "Make Public");
|
||||||
|
} else {
|
||||||
|
$("#button_share_album a").addClass("active");
|
||||||
|
$("#button_share_album").attr("title", "Share Album");
|
||||||
|
contextMenu.share_album(albumID, e.pageX, e.pageY);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else loadingBar.show("error");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
setPassword: function(albumID, password) {
|
||||||
|
|
||||||
|
if (!albumID) albumID = lychee.content.attr("data-id");
|
||||||
|
if (!password) password = prompt("Please enter a password for this album:", "");
|
||||||
|
if (password!="") password = hex_md5(password);
|
||||||
|
|
||||||
|
params = "setAlbumPassword&albumID=" + albumID + "&password=" + password;
|
||||||
|
lychee.api(params, "text", function(data) {
|
||||||
|
|
||||||
|
if (!data) loadingBar.show("error");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/*checkAlbumPassword: function(albumID, password) {
|
||||||
|
|
||||||
|
params = "checkAlbumPassword&albumID=" + albumID + "&password=" + hex_md5(password);
|
||||||
|
lychee.api(params, "text", function(data) {
|
||||||
|
if (data) {
|
||||||
|
if (password!="") password = hex_md5(password);
|
||||||
|
localStorage.setItem("album" + albumID, password);
|
||||||
|
return true;
|
||||||
|
} else return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
},*/
|
||||||
|
|
||||||
|
share: function(service, albumID) {
|
||||||
|
|
||||||
|
link = "";
|
||||||
|
url = location.href;
|
||||||
|
|
||||||
|
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(lychee.title());
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
link = "mailto:?subject=" + encodeURI(lychee.title()) + "&body=" + encodeURI("Hi! Check this out: " + url);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
modal = build.modal("Copy Link", "Everyone can view your public albums, but only you can edit them. Use this link to share your album with others: <input class='copylink' value='" + url + "'>", ["Close"], [""]);
|
||||||
|
$("body").append(modal);
|
||||||
|
$(".copylink").focus();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
link = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (link.length>5) location.href = link;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
getArchive: function() {
|
getArchive: function() {
|
||||||
|
|
||||||
albumID = lychee.content.attr("data-id");
|
albumID = lychee.content.attr("data-id");
|
||||||
|
@ -18,26 +18,38 @@ build = {
|
|||||||
|
|
||||||
album: function(albumJSON) {
|
album: function(albumJSON) {
|
||||||
|
|
||||||
|
var album = "";
|
||||||
|
|
||||||
if(!albumJSON) return "";
|
if(!albumJSON) return "";
|
||||||
if(!albumJSON.thumb0) albumJSON.thumb0 = "img/no_images.png";
|
|
||||||
if(!albumJSON.thumb1) albumJSON.thumb1 = "img/no_images.png";
|
if (albumJSON.password&&lychee.publicMode) {
|
||||||
if(!albumJSON.thumb2) albumJSON.thumb2 = "img/no_images.png";
|
albumJSON.thumb0 = "img/password.png";
|
||||||
|
albumJSON.thumb1 = "img/password.png";
|
||||||
|
albumJSON.thumb2 = "img/password.png";
|
||||||
|
} else {
|
||||||
|
if(!albumJSON.thumb0) albumJSON.thumb0 = "img/no_images.png";
|
||||||
|
if(!albumJSON.thumb1) albumJSON.thumb1 = "img/no_images.png";
|
||||||
|
if(!albumJSON.thumb2) albumJSON.thumb2 = "img/no_images.png";
|
||||||
|
}
|
||||||
|
|
||||||
if(!albumJSON.title) albumJSON.title = "Untitled";
|
if(!albumJSON.title) albumJSON.title = "Untitled";
|
||||||
if(albumJSON.title.length>18) albumJSON.title = albumJSON.title.substr(0, 18) + "...";
|
if(albumJSON.title.length>18) albumJSON.title = albumJSON.title.substr(0, 18) + "...";
|
||||||
|
|
||||||
var album = "";
|
album += "<div class='album' data-id='" + albumJSON.id + "' data-password='" + albumJSON.password + "'>";
|
||||||
album += "<div class='album' data-id='" + albumJSON.id + "'>";
|
|
||||||
album += "<img src='" + lychee.upload_path + albumJSON.thumb2 + "' width='200' height='200' alt='thumb'>";
|
album += "<img src='" + lychee.upload_path + albumJSON.thumb2 + "' width='200' height='200' alt='thumb'>";
|
||||||
album += "<img src='" + lychee.upload_path + albumJSON.thumb1 + "' width='200' height='200' alt='thumb'>";
|
album += "<img src='" + lychee.upload_path + albumJSON.thumb1 + "' width='200' height='200' alt='thumb'>";
|
||||||
album += "<img src='" + lychee.upload_path + albumJSON.thumb0 + "' width='200' height='200' alt='thumb'>";
|
album += "<img src='" + lychee.upload_path + albumJSON.thumb0 + "' width='200' height='200' alt='thumb'>";
|
||||||
album += "<div class='overlay'>";
|
album += "<div class='overlay'>";
|
||||||
album += "<h1>" + albumJSON.title + "</h1>";
|
|
||||||
|
if (albumJSON.password&&!lychee.publicMode) album += "<h1><span class='icon-lock' title='Public album with password'></span> " + albumJSON.title + "</h1>";
|
||||||
|
else album += "<h1>" + albumJSON.title + "</h1>";
|
||||||
|
|
||||||
album += "<a>" + albumJSON.sysdate + "</a>";
|
album += "<a>" + albumJSON.sysdate + "</a>";
|
||||||
album += "</div>";
|
album += "</div>";
|
||||||
|
|
||||||
if(albumJSON.star=="1") album += "<a class='badge red icon-star'></a>";
|
if(!lychee.publicMode&&albumJSON.star=="1") album += "<a class='badge red icon-star'></a>";
|
||||||
if(albumJSON.public=="1") album += "<a class='badge red icon-rss'></a>";
|
if(!lychee.publicMode&&albumJSON.public=="1") album += "<a class='badge red icon-share'></a>";
|
||||||
if(albumJSON.unsorted=="1") album += "<a class='badge red icon-reorder'></a>";
|
if(!lychee.publicMode&&albumJSON.unsorted=="1") album += "<a class='badge red icon-reorder'></a>";
|
||||||
|
|
||||||
album += "</div>";
|
album += "</div>";
|
||||||
|
|
||||||
@ -47,12 +59,13 @@ build = {
|
|||||||
|
|
||||||
photo: function(photoJSON) {
|
photo: function(photoJSON) {
|
||||||
|
|
||||||
|
var photo = "";
|
||||||
|
|
||||||
if(photoJSON=="") return "";
|
if(photoJSON=="") return "";
|
||||||
if(!photoJSON.title) photoJSON.title = "";
|
if(!photoJSON.title) photoJSON.title = "";
|
||||||
if(!photoJSON.thumbUrl) photoJSON.thumbUrl = "img/no_image.png";
|
if(!photoJSON.thumbUrl) photoJSON.thumbUrl = "img/no_image.png";
|
||||||
if(photoJSON.title.length>18) photoJSON.title = photoJSON.title.substr(0, 18) + "...";
|
if(photoJSON.title.length>18) photoJSON.title = photoJSON.title.substr(0, 18) + "...";
|
||||||
|
|
||||||
var photo = "";
|
|
||||||
photo += "<div class='photo' data-album-id='" + photoJSON.album + "' data-id='" + photoJSON.id + "'>";
|
photo += "<div class='photo' data-album-id='" + photoJSON.album + "' data-id='" + photoJSON.id + "'>";
|
||||||
photo += "<img src='" + lychee.upload_path + photoJSON.thumbUrl + "' width='200' height='200' alt='thumb'>";
|
photo += "<img src='" + lychee.upload_path + photoJSON.thumbUrl + "' width='200' height='200' alt='thumb'>";
|
||||||
photo += "<div class='overlay'>";
|
photo += "<div class='overlay'>";
|
||||||
@ -61,7 +74,7 @@ build = {
|
|||||||
photo += "</div>";
|
photo += "</div>";
|
||||||
|
|
||||||
if(photoJSON.star=="1") photo += "<a class='badge red icon-star'></a>";
|
if(photoJSON.star=="1") photo += "<a class='badge red icon-star'></a>";
|
||||||
if(photoJSON.public=="1") photo += "<a class='badge red icon-rss'></a>";
|
if(!lychee.publicMode&&photoJSON.public=="1") photo += "<a class='badge red icon-share'></a>";
|
||||||
|
|
||||||
photo += "</div>";
|
photo += "</div>";
|
||||||
|
|
||||||
@ -69,9 +82,26 @@ build = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
no_content: function(typ) {
|
||||||
|
|
||||||
|
var no_content = "";
|
||||||
|
|
||||||
|
no_content += "<div class='no_content fadeIn'>";
|
||||||
|
no_content += "<a class='icon icon-" + typ + "'></a>";
|
||||||
|
|
||||||
|
if (typ=="search") no_content += "<p>No results</p>";
|
||||||
|
else if (typ=="picture") no_content += "<p>No public albums</p>";
|
||||||
|
|
||||||
|
no_content += "</div>";
|
||||||
|
|
||||||
|
return no_content;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
modal: function(title, text, button, func) {
|
modal: function(title, text, button, func) {
|
||||||
|
|
||||||
var modal = "";
|
var modal = "";
|
||||||
|
|
||||||
modal += "<div class='message_overlay fadeIn'>";
|
modal += "<div class='message_overlay fadeIn'>";
|
||||||
modal += "<div class='message center'>";
|
modal += "<div class='message center'>";
|
||||||
modal += "<h1>" + title + "</h1>";
|
modal += "<h1>" + title + "</h1>";
|
||||||
@ -117,11 +147,15 @@ build = {
|
|||||||
modal += "<a class='close icon-remove-sign'></a>";
|
modal += "<a class='close icon-remove-sign'></a>";
|
||||||
modal += "<div id='add_album' class='add_album'>";
|
modal += "<div id='add_album' class='add_album'>";
|
||||||
modal += "<div class='icon icon-folder-close'></div>";
|
modal += "<div class='icon icon-folder-close'></div>";
|
||||||
modal += "<a>Add new Album</a>";
|
modal += "<a>New Album</a>";
|
||||||
|
modal += "</div>";
|
||||||
|
modal += "<div id='add_link' class='add_album'>";
|
||||||
|
modal += "<div class='icon icon-link'></div>";
|
||||||
|
modal += "<a>Import Link</a>";
|
||||||
modal += "</div>";
|
modal += "</div>";
|
||||||
modal += "<div id='add_photo' class='add_album'>";
|
modal += "<div id='add_photo' class='add_album'>";
|
||||||
modal += "<div class='icon icon-picture'></div>";
|
modal += "<div class='icon icon-picture'></div>";
|
||||||
modal += "<a>Upload new Photo</a>";
|
modal += "<a>Upload Photo</a>";
|
||||||
modal += "</div>";
|
modal += "</div>";
|
||||||
modal += "</div>";
|
modal += "</div>";
|
||||||
modal += "</div>";
|
modal += "</div>";
|
||||||
@ -135,13 +169,13 @@ build = {
|
|||||||
var modal = "";
|
var modal = "";
|
||||||
modal += "<div class='message_overlay'>";
|
modal += "<div class='message_overlay'>";
|
||||||
modal += "<div class='message center'>";
|
modal += "<div class='message center'>";
|
||||||
modal += "<h1><a class='icon-lock'></a> Sign in</h1>";
|
modal += "<h1><a class='icon-lock'></a> Sign In</h1>";
|
||||||
modal += "<div class='sign_in'>";
|
modal += "<div class='sign_in'>";
|
||||||
modal += "<input id='username' type='text' name='' value='' placeholder='username'>";
|
modal += "<input id='username' type='text' name='' value='' placeholder='username'>";
|
||||||
modal += "<input id='password' type='password' name='' value='' placeholder='password'>";
|
modal += "<input id='password' type='password' name='' value='' placeholder='password'>";
|
||||||
modal += "</div>";
|
modal += "</div>";
|
||||||
modal += "<div id='version'>Version " + lychee.version + "</div>";
|
modal += "<div id='version'>Version " + lychee.version + "<span> – <a target='_blank' href='" + lychee.updateURL + "'>Update available!</a><span></div>";
|
||||||
modal += "<a onclick='lychee.login()' class='button active'>Sign in</a>";
|
modal += "<a onclick='lychee.login()' class='button active'>Sign in</a>";
|
||||||
modal += "</div>";
|
modal += "</div>";
|
||||||
modal += "</div>";
|
modal += "</div>";
|
||||||
|
|
||||||
@ -173,9 +207,8 @@ build = {
|
|||||||
|
|
||||||
$.each(items, function(index) {
|
$.each(items, function(index) {
|
||||||
|
|
||||||
if (items[index][1].length!=0) {
|
if (items[index][0]=="separator"&&items[index][1].length==0) menu += "<tr class='separator'></tr>";
|
||||||
menu += "<tr><td onclick='" + items[index][1] + "; contextMenu.close();'>" + items[index][0] + "</td></tr>";
|
else if (items[index][1].length!=0) menu += "<tr><td onclick='" + items[index][1] + "; contextMenu.close();'>" + items[index][0] + "</td></tr>";
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -194,8 +227,8 @@ build = {
|
|||||||
infobox += "<div class='wrapper'>";
|
infobox += "<div class='wrapper'>";
|
||||||
|
|
||||||
if (photo.public==1) photo.public = "Public"; else photo.public = "Private";
|
if (photo.public==1) photo.public = "Public"; else photo.public = "Private";
|
||||||
if (forView==true) editTitleHTML = ""; else editTitleHTML = " <div id='edit_title'><a class='icon-pencil'></a></div>";
|
if (forView==true||lychee.publicMode) editTitleHTML = ""; else editTitleHTML = " <div id='edit_title'><a class='icon-pencil'></a></div>";
|
||||||
if (forView==true) editDescriptionHTML = ""; else editDescriptionHTML = " <div id='edit_description'><a class='icon-pencil'></a></div>";
|
if (forView==true||lychee.publicMode) editDescriptionHTML = ""; else editDescriptionHTML = " <div id='edit_description'><a class='icon-pencil'></a></div>";
|
||||||
|
|
||||||
infos = [
|
infos = [
|
||||||
["", "Basics"],
|
["", "Basics"],
|
||||||
@ -215,7 +248,7 @@ build = {
|
|||||||
["Focal Length", photo.focal],
|
["Focal Length", photo.focal],
|
||||||
["ISO", photo.iso],
|
["ISO", photo.iso],
|
||||||
["", "Share"],
|
["", "Share"],
|
||||||
["Privacy", photo.public],
|
["Visibility", photo.public],
|
||||||
["Short Link", photo.shortlink]
|
["Short Link", photo.shortlink]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
65
js/modules/contextMenu.js
Normal file → Executable file
65
js/modules/contextMenu.js
Normal file → Executable file
@ -22,7 +22,7 @@ contextMenu = {
|
|||||||
mouse_y -= $(document).scrollTop();
|
mouse_y -= $(document).scrollTop();
|
||||||
|
|
||||||
items = [
|
items = [
|
||||||
["Rename", "albums.rename(" + albumID + ")"],
|
["Rename", "albums.setTitle(" + albumID + ")"],
|
||||||
["Delete", "albums.deleteDialog(" + albumID + ")"]
|
["Delete", "albums.deleteDialog(" + albumID + ")"]
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ contextMenu = {
|
|||||||
mouse_y -= $(document).scrollTop();
|
mouse_y -= $(document).scrollTop();
|
||||||
|
|
||||||
items = [
|
items = [
|
||||||
["Rename", "photos.rename(" + photoID + ")"],
|
["Rename", "photos.setTitle(" + photoID + ")"],
|
||||||
["Move to Album", "contextMenu.move(" + photoID + ", " + (mouse_x+150) + ", " + (mouse_y+$(document).scrollTop()) + ")"],
|
["Move to Album", "contextMenu.move(" + photoID + ", " + (mouse_x+150) + ", " + (mouse_y+$(document).scrollTop()) + ")"],
|
||||||
["Delete", "photos.deleteDialog(" + photoID + ")"]
|
["Delete", "photos.deleteDialog(" + photoID + ")"]
|
||||||
];
|
];
|
||||||
@ -67,25 +67,30 @@ contextMenu = {
|
|||||||
|
|
||||||
mouse_y -= $(document).scrollTop();
|
mouse_y -= $(document).scrollTop();
|
||||||
|
|
||||||
|
if (!mouse_x||!mouse_y) {
|
||||||
|
mouse_x = "10px";
|
||||||
|
mouse_y = "10px";
|
||||||
|
}
|
||||||
|
|
||||||
lychee.api("getAlbums", "json", function(data) {
|
lychee.api("getAlbums", "json", function(data) {
|
||||||
|
|
||||||
if (lychee.content.attr("data-id")==0) {
|
if (lychee.content.attr("data-id")==0) {
|
||||||
items = [];
|
items = [];
|
||||||
} else {
|
} else {
|
||||||
items = [
|
items = [
|
||||||
["Unsorted", "photos.move(" + photoID + ", 0)"]
|
["Unsorted", "photos.setAlbum(" + photoID + ", 0)"]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.albums) {
|
if (!data.albums) {
|
||||||
items = [
|
items = [
|
||||||
["Create new Album", "albums.add()"]
|
["New Album", "albums.add()"]
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$.each(data.album, function(index) {
|
$.each(data.album, function(index) {
|
||||||
if (this.id!=lychee.content.attr("data-id")) {
|
if (this.id!=lychee.content.attr("data-id")) {
|
||||||
if(!this.title) this.title = "Untitled";
|
if(!this.title) this.title = "Untitled";
|
||||||
items[items.length] = new Array(this.title, "photos.move(" + photoID + ", " + this.id + ")");
|
items[items.length] = new Array(this.title, "photos.setAlbum(" + photoID + ", " + this.id + ")");
|
||||||
} else {
|
} else {
|
||||||
items[items.length] = new Array("", "");
|
items[items.length] = new Array("", "");
|
||||||
}
|
}
|
||||||
@ -98,7 +103,7 @@ contextMenu = {
|
|||||||
$("body").append(build.contextMenu(items));
|
$("body").append(build.contextMenu(items));
|
||||||
$(".contextmenu").css({
|
$(".contextmenu").css({
|
||||||
"top": mouse_y,
|
"top": mouse_y,
|
||||||
"left": mouse_x-150
|
"left": mouse_x-$(".contextmenu").width()
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -109,19 +114,57 @@ contextMenu = {
|
|||||||
|
|
||||||
mouse_y -= $(document).scrollTop();
|
mouse_y -= $(document).scrollTop();
|
||||||
|
|
||||||
|
if (!mouse_x||!mouse_y) {
|
||||||
|
mouse_x = "10px";
|
||||||
|
mouse_y = "10px";
|
||||||
|
}
|
||||||
|
|
||||||
items = [
|
items = [
|
||||||
["<a class='icon-eye-close'></a> Make Private", "photos.setPublic()"],
|
["<a class='icon-eye-close'></a> Make Private", "photos.setPublic()"],
|
||||||
|
["separator", ""],
|
||||||
["<a class='icon-twitter'></a> Twitter", "photos.share(0, " + photoID + ")"],
|
["<a class='icon-twitter'></a> Twitter", "photos.share(0, " + photoID + ")"],
|
||||||
["<a class='icon-facebook'></a> Facebook", "photos.share(1, " + photoID + ")"],
|
["<a class='icon-facebook'></a> Facebook", "photos.share(1, " + photoID + ")"],
|
||||||
["<a class='icon-envelope'></a> Mail", "photos.share(2, " + photoID + ")"],
|
["<a class='icon-envelope'></a> Mail", "photos.share(2, " + photoID + ")"],
|
||||||
["<a class='icon-link'></a> Copy Link", "photos.share(3, " + photoID + ")"],
|
["<a class='icon-link'></a> Copy Link", "photos.share(3, " + photoID + ")"]
|
||||||
["<a class='icon-link'></a> Copy Shortlink", "photos.share(4, " + photoID + ")"]
|
];
|
||||||
|
|
||||||
|
if (lychee.bitlyUsername!="") items.push(["<a class='icon-link'></a> Copy Shortlink", "photos.share(4, " + photoID + ")"]);
|
||||||
|
|
||||||
|
contextMenu.close();
|
||||||
|
$("body")
|
||||||
|
.css("overflow", "hidden")
|
||||||
|
.append(build.contextMenu(items));
|
||||||
|
$(".photo[data-id='" + photoID + "']").addClass("active");
|
||||||
|
$(".contextmenu").css({
|
||||||
|
"top": mouse_y,
|
||||||
|
"left": mouse_x
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
share_album: function(albumID, mouse_x, mouse_y) {
|
||||||
|
|
||||||
|
mouse_y -= $(document).scrollTop();
|
||||||
|
|
||||||
|
if (!mouse_x||!mouse_y) {
|
||||||
|
mouse_x = "10px";
|
||||||
|
mouse_y = "10px";
|
||||||
|
}
|
||||||
|
|
||||||
|
items = [
|
||||||
|
["<a class='icon-eye-close'></a> Make Private", "albums.setPublic()"],
|
||||||
|
//["<a class='icon-key'></a> Set Password", "albums.setPassword()"],
|
||||||
|
["separator", ""],
|
||||||
|
["<a class='icon-twitter'></a> Twitter", "albums.share(0, " + albumID + ")"],
|
||||||
|
["<a class='icon-facebook'></a> Facebook", "albums.share(1, " + albumID + ")"],
|
||||||
|
["<a class='icon-envelope'></a> Mail", "albums.share(2, " + albumID + ")"],
|
||||||
|
["<a class='icon-link'></a> Copy Link", "albums.share(3, " + albumID + ")"]
|
||||||
];
|
];
|
||||||
|
|
||||||
contextMenu.close();
|
contextMenu.close();
|
||||||
$("body").css("overflow", "hidden");
|
$("body")
|
||||||
$(".photo[data-id='" + photoID + "']").addClass("active");
|
.css("overflow", "hidden")
|
||||||
$("body").append(build.contextMenu(items));
|
.append(build.contextMenu(items));
|
||||||
$(".contextmenu").css({
|
$(".contextmenu").css({
|
||||||
"top": mouse_y,
|
"top": mouse_y,
|
||||||
"left": mouse_x
|
"left": mouse_x
|
||||||
|
68
js/modules/loadingBar.js
Normal file → Executable file
68
js/modules/loadingBar.js
Normal file → Executable file
@ -10,48 +10,56 @@
|
|||||||
|
|
||||||
loadingBar = {
|
loadingBar = {
|
||||||
|
|
||||||
|
status: null,
|
||||||
|
|
||||||
show: function(status, errorTitle, errorText) {
|
show: function(status, errorTitle, errorText) {
|
||||||
|
|
||||||
if (!status) status = "loading";
|
clearTimeout(lychee.loadingBar.data("timeout"));
|
||||||
|
|
||||||
switch (status) {
|
if (status=="error"&&loadingBar.status!="error") {
|
||||||
|
|
||||||
case "error":
|
loadingBar.status = "error";
|
||||||
if (!errorTitle||!errorText) {
|
|
||||||
errorTitle = "Error";
|
if (!errorTitle) errorTitle = "Error";
|
||||||
errorText = "Whoops, it looks like something went wrong. Please reload the site and try again!"
|
if (!errorText) errorText = "Whoops, it looks like something went wrong. Please reload the site and try again!"
|
||||||
}
|
|
||||||
|
lychee.loadingBar
|
||||||
|
.removeClass("loading uploading error")
|
||||||
|
.addClass(status)
|
||||||
|
.html("<h1>" + errorTitle + ": <span>" + errorText + "</span></h1>")
|
||||||
|
.show()
|
||||||
|
.css("height", "40px");
|
||||||
|
if (visible.controls()) lychee.header.css("margin-Top", "40px");
|
||||||
|
|
||||||
|
lychee.loadingBar.data("timeout", setTimeout(function () { loadingBar.hide(true) }, 3000));
|
||||||
|
|
||||||
|
} else if (loadingBar.status==null) {
|
||||||
|
|
||||||
|
loadingBar.status = "loading";
|
||||||
|
|
||||||
|
lychee.loadingBar.data("timeout", setTimeout(function () {
|
||||||
lychee.loadingBar
|
lychee.loadingBar
|
||||||
.removeClass("loading uploading error")
|
|
||||||
.addClass(status)
|
|
||||||
.html("<h1>" + errorTitle + ": <span>" + errorText + "</span></h1>")
|
|
||||||
.show()
|
.show()
|
||||||
.css("height", "40px");
|
.removeClass("loading uploading error")
|
||||||
lychee.header.css("margin-Top", "40px");
|
.addClass("loading");
|
||||||
$.timer(3000,function(){ loadingBar.hide() });
|
if (visible.controls()) lychee.header.css("margin-Top", "3px");
|
||||||
break;
|
}, 1000));
|
||||||
|
|
||||||
case "loading":
|
|
||||||
clearTimeout(lychee.loadingBar.data("timeout"));
|
|
||||||
lychee.loadingBar.data("timeout", setTimeout(function () {
|
|
||||||
lychee.loadingBar
|
|
||||||
.show()
|
|
||||||
.removeClass("loading uploading error")
|
|
||||||
.addClass(status);
|
|
||||||
if (visible.controls()) lychee.header.css("margin-Top", "3px");
|
|
||||||
}, 1000));
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide: function(force_hide) {
|
||||||
|
|
||||||
clearTimeout(lychee.loadingBar.data("timeout"));
|
if ((loadingBar.status!="error"&&loadingBar.status!=null)||force_hide) {
|
||||||
lychee.loadingBar.html("").css("height", "3px");
|
|
||||||
if (visible.controls()) lychee.header.css("marginTop", "0px");
|
loadingBar.status = null;
|
||||||
$.timer(300,function(){ lychee.loadingBar.hide(); });
|
clearTimeout(lychee.loadingBar.data("timeout"));
|
||||||
|
lychee.loadingBar.html("").css("height", "3px");
|
||||||
|
if (visible.controls()) lychee.header.css("marginTop", "0px");
|
||||||
|
$.timer(300,function(){ lychee.loadingBar.hide(); });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
118
js/modules/lychee.js
Normal file → Executable file
118
js/modules/lychee.js
Normal file → Executable file
@ -12,9 +12,15 @@ lychee = {
|
|||||||
|
|
||||||
init: function(api_path, upload_path) {
|
init: function(api_path, upload_path) {
|
||||||
|
|
||||||
this.version = "1.1";
|
this.version = "1.2";
|
||||||
this.api_path = api_path;
|
this.api_path = api_path;
|
||||||
this.upload_path = upload_path;
|
this.upload_path = upload_path;
|
||||||
|
this.update_path = "http://lychee.electerious.com/version/index.php";
|
||||||
|
this.updateURL = "https://github.com/electerious/Lychee";
|
||||||
|
this.publicMode = false;
|
||||||
|
|
||||||
|
this.checkForUpdates = false;
|
||||||
|
this.bitlyUsername = "";
|
||||||
|
|
||||||
this.loadingBar = $("#loading");
|
this.loadingBar = $("#loading");
|
||||||
this.header = $("header");
|
this.header = $("header");
|
||||||
@ -27,41 +33,70 @@ lychee = {
|
|||||||
|
|
||||||
ready: function() {
|
ready: function() {
|
||||||
|
|
||||||
$("#tools_albums").show();
|
|
||||||
if (!mobileBrowser()) $(".tools").tipsy({gravity: 'n'});
|
if (!mobileBrowser()) $(".tools").tipsy({gravity: 'n'});
|
||||||
if (window.webkitNotifications) { window.webkitNotifications.requestPermission() };
|
if (window.webkitNotifications) window.webkitNotifications.requestPermission();
|
||||||
|
|
||||||
lychee.api("loggedIn", "text", function(data) {
|
lychee.api("init", "json", function(data) {
|
||||||
if (data!=1) {
|
lychee.checkForUpdates = data.config.checkForUpdates;
|
||||||
$("body").append(build.signInModal());
|
lychee.bitlyUsername = data.config.bitlyUsername;
|
||||||
$("#username").focus();
|
if (!data.loggedIn) lychee.setPublicMode();
|
||||||
if (localStorage) {
|
$(window).bind("popstate", lychee.load);
|
||||||
local_username = localStorage.getItem("username");
|
lychee.load();
|
||||||
if (local_username==null) return false;
|
|
||||||
if (local_username.length>1) $("#username").val(local_username);
|
|
||||||
$("#password").focus();
|
|
||||||
}
|
|
||||||
} else if (data) {
|
|
||||||
$(window).bind("popstate", lychee.load);
|
|
||||||
lychee.load();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
api: function(params, type, callback) {
|
setPublicMode: function() {
|
||||||
|
|
||||||
|
this.publicMode = true;
|
||||||
|
|
||||||
|
$("#button_signout, #search, #button_trash_album, #button_share_album, #button_edit_album, .button_add, #button_archive, .button_divider").remove();
|
||||||
|
$("#button_trash, #button_move, #button_edit, #button_share, #button_star").remove();
|
||||||
|
|
||||||
|
$(document)
|
||||||
|
.on("mouseenter", "#title.editable", function() { $(this).removeClass("editable") })
|
||||||
|
.off(event_name, "#title.editable")
|
||||||
|
.off("contextmenu", ".photo")
|
||||||
|
.off("contextmenu", ".album")
|
||||||
|
.off("drop");
|
||||||
|
|
||||||
|
$("#button_signin").show();
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
api: function(params, type, callback, loading) {
|
||||||
|
|
||||||
|
if (loading==undefined) loadingBar.show();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: lychee.api_path,
|
url: lychee.api_path,
|
||||||
data: "function=" + params,
|
data: "function=" + params,
|
||||||
dataType: type,
|
dataType: type,
|
||||||
success: callback,
|
success:
|
||||||
|
function(data) {
|
||||||
|
$.timer(100, function(){ loadingBar.hide() });
|
||||||
|
callback(data);
|
||||||
|
},
|
||||||
error: lychee.error
|
error: lychee.error
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showLogin: function() {
|
||||||
|
|
||||||
|
$("body").append(build.signInModal());
|
||||||
|
$("#username").focus();
|
||||||
|
if (localStorage) {
|
||||||
|
local_username = localStorage.getItem("username");
|
||||||
|
if (local_username==null) return false;
|
||||||
|
if (local_username.length>0) $("#username").val(local_username);
|
||||||
|
$("#password").focus();
|
||||||
|
}
|
||||||
|
if (lychee.checkForUpdates) lychee.update();
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
login: function() {
|
login: function() {
|
||||||
|
|
||||||
user = $("input#username").val();
|
user = $("input#username").val();
|
||||||
@ -70,10 +105,8 @@ lychee = {
|
|||||||
params = "login&user=" + user + "&password=" + password;
|
params = "login&user=" + user + "&password=" + password;
|
||||||
lychee.api(params, "text", function(data) {
|
lychee.api(params, "text", function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
if (localStorage) { localStorage.setItem("username", user); }
|
localStorage.setItem("username", user);
|
||||||
$(window).bind("popstate", lychee.load);
|
window.location.reload();
|
||||||
lychee.load();
|
|
||||||
lychee.closeModal();
|
|
||||||
} else {
|
} else {
|
||||||
$("#password").val("").addClass("error");
|
$("#password").val("").addClass("error");
|
||||||
$(".message .button.active").removeClass("pressed");
|
$(".message .button.active").removeClass("pressed");
|
||||||
@ -90,6 +123,15 @@ lychee = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
update: function() {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: lychee.update_path,
|
||||||
|
success: function(data) { if (data!=lychee.version) $("#version span").show(); }
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
upload: function(files) {
|
upload: function(files) {
|
||||||
|
|
||||||
pre_progress = 0;
|
pre_progress = 0;
|
||||||
@ -151,6 +193,30 @@ lychee = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
importUrl: function() {
|
||||||
|
|
||||||
|
link = prompt("Please enter the direct link to a photo to import it:", "");
|
||||||
|
if (lychee.content.attr("data-id")=="") albumID = 0;
|
||||||
|
else albumID = lychee.content.attr("data-id");
|
||||||
|
|
||||||
|
lychee.closeModal();
|
||||||
|
|
||||||
|
if (link.length>3) {
|
||||||
|
|
||||||
|
params = "importUrl&url=" + escape(link) + "&albumID=" + albumID;
|
||||||
|
lychee.api(params, "text", function(data) {
|
||||||
|
|
||||||
|
if (data) {
|
||||||
|
if (lychee.content.attr("data-id")=="") lychee.goto("a0");
|
||||||
|
else photos.load(lychee.content.attr("data-id"));
|
||||||
|
} else loadingBar.show("error");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
} else if (link.length>0) loadingBar.show("error", "Error", "Link to short or too long. Please try another one!");
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
load: function() {
|
load: function() {
|
||||||
|
|
||||||
contextMenu.close();
|
contextMenu.close();
|
||||||
@ -168,11 +234,11 @@ lychee = {
|
|||||||
if (albumID&&photoID) {
|
if (albumID&&photoID) {
|
||||||
|
|
||||||
// Show ImageView
|
// Show ImageView
|
||||||
if (lychee.content.html()==""||$("#search").val().length!=0) {
|
if (lychee.content.html()==""||($("#search").length&&$("#search").val().length!=0)) {
|
||||||
lychee.content.hide();
|
lychee.content.hide();
|
||||||
photos.load(albumID, true);
|
photos.load(albumID, true);
|
||||||
}
|
}
|
||||||
photos.loadInfo(photoID);
|
photos.loadInfo(photoID, albumID);
|
||||||
|
|
||||||
} else if (albumID) {
|
} else if (albumID) {
|
||||||
|
|
||||||
@ -232,7 +298,7 @@ lychee = {
|
|||||||
|
|
||||||
hideControls: function() {
|
hideControls: function() {
|
||||||
|
|
||||||
if (visible.imageview()) {
|
if (visible.imageview()&&!visible.infobox()) {
|
||||||
clearTimeout($(window).data("timeout"));
|
clearTimeout($(window).data("timeout"));
|
||||||
$(window).data("timeout", setTimeout(function() {
|
$(window).data("timeout", setTimeout(function() {
|
||||||
lychee.image_view.addClass("full");
|
lychee.image_view.addClass("full");
|
||||||
|
144
js/modules/photos.js
Normal file → Executable file
144
js/modules/photos.js
Normal file → Executable file
@ -14,6 +14,15 @@ photos = {
|
|||||||
|
|
||||||
// If refresh is true the function will only refresh the content and not change the toolbar buttons either the title
|
// If refresh is true the function will only refresh the content and not change the toolbar buttons either the title
|
||||||
|
|
||||||
|
/*password = localStorage.getItem("album" + albumID);
|
||||||
|
if (password==null) {
|
||||||
|
if (lychee.publicMode) password = prompt("Please enter a password for this album:", ""); else password = "";
|
||||||
|
if (password!="") password = hex_md5(password);
|
||||||
|
localStorage.setItem("album" + albumID, password);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
password = "";
|
||||||
|
|
||||||
if (!refresh) {
|
if (!refresh) {
|
||||||
loadingBar.show();
|
loadingBar.show();
|
||||||
if (visible.imageview()) photos.hideView();
|
if (visible.imageview()) photos.hideView();
|
||||||
@ -23,9 +32,15 @@ photos = {
|
|||||||
|
|
||||||
startTime = new Date().getTime();
|
startTime = new Date().getTime();
|
||||||
|
|
||||||
params = "getPhotos&albumID=" + albumID;
|
params = "getPhotos&albumID=" + albumID + "&password=" + password;
|
||||||
lychee.api(params, "json", function(data) {
|
lychee.api(params, "json", function(data) {
|
||||||
|
|
||||||
|
if (data=="HTTP/1.1 403 Wrong password!") {
|
||||||
|
localStorage.removeItem("album" + albumID);
|
||||||
|
photos.load(albumID, refresh);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
durationTime = (new Date().getTime() - startTime);
|
durationTime = (new Date().getTime() - startTime);
|
||||||
if (durationTime>300) waitTime = 0; else if (refresh) waitTime = 0; else waitTime = 300 - durationTime;
|
if (durationTime>300) waitTime = 0; else if (refresh) waitTime = 0; else waitTime = 300 - durationTime;
|
||||||
|
|
||||||
@ -42,25 +57,38 @@ photos = {
|
|||||||
$("#tools_album").show();
|
$("#tools_album").show();
|
||||||
$("img").retina();
|
$("img").retina();
|
||||||
|
|
||||||
albums.loadInfo(albumID);
|
albums.loadInfo(albumID, password);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
}, false);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
loadInfo: function(photoID) {
|
loadInfo: function(photoID, albumID) {
|
||||||
|
|
||||||
|
/*password = localStorage.getItem("album" + albumID);
|
||||||
|
if (password==null) {
|
||||||
|
if (lychee.publicMode) password = prompt("Please enter a password for this album:", ""); else password = "";
|
||||||
|
if (password!="") password = hex_md5(password);
|
||||||
|
localStorage.setItem("album" + albumID, password);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
password = "";
|
||||||
|
|
||||||
photos.showView();
|
photos.showView();
|
||||||
|
|
||||||
loadingBar.show();
|
params = "getPhotoInfo&photoID=" + photoID + "&password=" + password;
|
||||||
|
|
||||||
params = "getPhotoInfo&photoID=" + photoID;
|
|
||||||
lychee.api(params, "json", function(data) {
|
lychee.api(params, "json", function(data) {
|
||||||
|
|
||||||
|
if (data=="HTTP/1.1 403 Wrong password!") {
|
||||||
|
localStorage.removeItem("album" + albumID);
|
||||||
|
photos.loadInfo(photoID, albumID);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!data.title) data.title = "Untitled";
|
if (!data.title) data.title = "Untitled";
|
||||||
|
|
||||||
document.title = "Lychee - " + data.title;
|
document.title = "Lychee - " + data.title;
|
||||||
@ -77,10 +105,10 @@ photos = {
|
|||||||
|
|
||||||
if (data.public=="1") {
|
if (data.public=="1") {
|
||||||
$("#button_share a").addClass("active");
|
$("#button_share a").addClass("active");
|
||||||
$("#button_share").attr("title", "Make Photo Private");
|
$("#button_share").attr("title", "Share Photo");
|
||||||
} else {
|
} else {
|
||||||
$("#button_share a").removeClass("active");
|
$("#button_share a").removeClass("active");
|
||||||
$("#button_share").attr("title", "Share Photo");
|
$("#button_share").attr("title", "Make Public");
|
||||||
}
|
}
|
||||||
|
|
||||||
data.url = lychee.upload_path + data.url;
|
data.url = lychee.upload_path + data.url;
|
||||||
@ -99,8 +127,6 @@ photos = {
|
|||||||
|
|
||||||
$.timer(300,function(){ lychee.content.show(); });
|
$.timer(300,function(){ lychee.content.show(); });
|
||||||
|
|
||||||
loadingBar.hide();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -180,8 +206,6 @@ photos = {
|
|||||||
|
|
||||||
delete: function(photoID) {
|
delete: function(photoID) {
|
||||||
|
|
||||||
loadingBar.show();
|
|
||||||
|
|
||||||
params = "deletePhoto&photoID=" + photoID;
|
params = "deletePhoto&photoID=" + photoID;
|
||||||
lychee.api(params, "text", function(data) {
|
lychee.api(params, "text", function(data) {
|
||||||
|
|
||||||
@ -189,7 +213,6 @@ photos = {
|
|||||||
|
|
||||||
photos.hide(photoID);
|
photos.hide(photoID);
|
||||||
lychee.goto("a" + lychee.content.attr("data-id"));
|
lychee.goto("a" + lychee.content.attr("data-id"));
|
||||||
loadingBar.hide();
|
|
||||||
|
|
||||||
} else loadingBar.show("error");
|
} else loadingBar.show("error");
|
||||||
|
|
||||||
@ -212,7 +235,7 @@ photos = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
rename: function(photoID) {
|
setTitle: function(photoID) {
|
||||||
|
|
||||||
if (!photoID) oldTitle = lychee.title(); else oldTitle = "";
|
if (!photoID) oldTitle = lychee.title(); else oldTitle = "";
|
||||||
if (!photoID) photoID = lychee.image_view.attr("data-id");
|
if (!photoID) photoID = lychee.image_view.attr("data-id");
|
||||||
@ -221,8 +244,6 @@ photos = {
|
|||||||
|
|
||||||
if (photoID!=null&&photoID&&newTitle.length<31) {
|
if (photoID!=null&&photoID&&newTitle.length<31) {
|
||||||
|
|
||||||
loadingBar.show();
|
|
||||||
|
|
||||||
if (newTitle=="") newTitle = "Untitled";
|
if (newTitle=="") newTitle = "Untitled";
|
||||||
|
|
||||||
params = "setPhotoTitle&photoID=" + photoID + "&title=" + encodeURI(newTitle);
|
params = "setPhotoTitle&photoID=" + photoID + "&title=" + encodeURI(newTitle);
|
||||||
@ -235,7 +256,6 @@ photos = {
|
|||||||
document.title = "Lychee - " + newTitle;
|
document.title = "Lychee - " + newTitle;
|
||||||
}
|
}
|
||||||
$(".photo[data-id='" + photoID + "'] .overlay h1").html(newTitle);
|
$(".photo[data-id='" + photoID + "'] .overlay h1").html(newTitle);
|
||||||
loadingBar.hide();
|
|
||||||
} else loadingBar.show("error");
|
} else loadingBar.show("error");
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -244,19 +264,16 @@ photos = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
move: function(photoID, albumID) {
|
setAlbum: function(photoID, albumID) {
|
||||||
|
|
||||||
if (albumID>=0) {
|
if (albumID>=0) {
|
||||||
|
|
||||||
loadingBar.show();
|
params = "setAlbum&photoID=" + photoID + "&albumID=" + albumID;
|
||||||
|
|
||||||
params = "movePhoto&photoID=" + photoID + "&albumID=" + albumID;
|
|
||||||
lychee.api(params, "text", function(data) {
|
lychee.api(params, "text", function(data) {
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
photos.hide(photoID);
|
photos.hide(photoID);
|
||||||
lychee.goto("a" + lychee.content.attr("data-id"));
|
lychee.goto("a" + lychee.content.attr("data-id"));
|
||||||
loadingBar.hide();
|
|
||||||
} else loadingBar.show("error");
|
} else loadingBar.show("error");
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -267,8 +284,6 @@ photos = {
|
|||||||
|
|
||||||
setStar: function() {
|
setStar: function() {
|
||||||
|
|
||||||
loadingBar.show();
|
|
||||||
|
|
||||||
photoID = lychee.image_view.attr("data-id");
|
photoID = lychee.image_view.attr("data-id");
|
||||||
|
|
||||||
params = "setPhotoStar&photoID=" + photoID;
|
params = "setPhotoStar&photoID=" + photoID;
|
||||||
@ -285,7 +300,6 @@ photos = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
photos.load(lychee.content.attr("data-id"), true);
|
photos.load(lychee.content.attr("data-id"), true);
|
||||||
loadingBar.hide();
|
|
||||||
|
|
||||||
} else loadingBar.show("error");
|
} else loadingBar.show("error");
|
||||||
|
|
||||||
@ -295,8 +309,6 @@ photos = {
|
|||||||
|
|
||||||
setPublic: function(e) {
|
setPublic: function(e) {
|
||||||
|
|
||||||
loadingBar.show();
|
|
||||||
|
|
||||||
photoID = lychee.image_view.attr("data-id");
|
photoID = lychee.image_view.attr("data-id");
|
||||||
|
|
||||||
params = "setPhotoPublic&photoID=" + photoID + "&url=" + photos.getViewLink(photoID);
|
params = "setPhotoPublic&photoID=" + photoID + "&url=" + photos.getViewLink(photoID);
|
||||||
@ -306,15 +318,16 @@ photos = {
|
|||||||
|
|
||||||
if ($("#button_share a.active").length) {
|
if ($("#button_share a.active").length) {
|
||||||
$("#button_share a").removeClass("active");
|
$("#button_share a").removeClass("active");
|
||||||
$("#button_share").attr("title", "Make Private");
|
$("#button_share").attr("title", "Make Public");
|
||||||
|
$("#infobox .attr_visibility").html("Private");
|
||||||
} else {
|
} else {
|
||||||
$("#button_share a").addClass("active");
|
$("#button_share a").addClass("active");
|
||||||
$("#button_share").attr("title", "Share Photo");
|
$("#button_share").attr("title", "Share Photo");
|
||||||
|
$("#infobox .attr_visibility").html("Public");
|
||||||
contextMenu.share(photoID, e.pageX, e.pageY);
|
contextMenu.share(photoID, e.pageX, e.pageY);
|
||||||
}
|
}
|
||||||
|
|
||||||
photos.load(lychee.content.attr("data-id"), true);
|
photos.load(lychee.content.attr("data-id"), true);
|
||||||
loadingBar.hide();
|
|
||||||
|
|
||||||
} else loadingBar.show("error");
|
} else loadingBar.show("error");
|
||||||
|
|
||||||
@ -329,13 +342,12 @@ photos = {
|
|||||||
|
|
||||||
if (description.length>0&&description.length<160) {
|
if (description.length>0&&description.length<160) {
|
||||||
|
|
||||||
loadingBar.show();
|
|
||||||
|
|
||||||
params = "setPhotoDescription&photoID=" + photoID + "&description=" + escape(description);
|
params = "setPhotoDescription&photoID=" + photoID + "&description=" + escape(description);
|
||||||
lychee.api(params, "text", function(data) {
|
lychee.api(params, "text", function(data) {
|
||||||
|
|
||||||
if (data) photos.loadInfo(photoID);
|
if (data) {
|
||||||
else loadingBar.show("error");
|
$("#infobox .attr_description").html(description + " <div id='edit_description'><a class='icon-pencil'></a></div>");
|
||||||
|
} else loadingBar.show("error");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -345,45 +357,39 @@ photos = {
|
|||||||
|
|
||||||
share: function(service, photoID) {
|
share: function(service, photoID) {
|
||||||
|
|
||||||
loadingBar.show();
|
link = "";
|
||||||
|
url = photos.getViewLink(photoID);
|
||||||
|
|
||||||
params = "sharePhoto&photoID=" + photoID + "&url=" + photos.getViewLink(photoID);
|
switch (service) {
|
||||||
lychee.api(params, "json", function(data) {
|
case 0:
|
||||||
|
link = "https://twitter.com/share?url=" + encodeURI(url);
|
||||||
switch (service) {
|
break;
|
||||||
case 0:
|
case 1:
|
||||||
link = data.twitter;
|
link = "http://www.facebook.com/sharer.php?u=" + encodeURI(url) + "&t=" + encodeURI(lychee.title());
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 2:
|
||||||
link = data.facebook;
|
link = "mailto:?subject=" + encodeURI(lychee.title()) + "&body=" + encodeURI("Hi! Check this out: " + url);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 3:
|
||||||
link = data.mail;
|
modal = build.modal("Copy Link", "Everyone can view your public photos, but only you can edit them. Use this link to share your photo with others: <input class='copylink' value='" + url + "'>", ["Close"], [""]);
|
||||||
break;
|
$("body").append(modal);
|
||||||
case 3:
|
$(".copylink").focus();
|
||||||
link = "copy";
|
break;
|
||||||
modal = build.modal("Copy Link", "You can use this link to share your image with other people: <input class='copylink' value='" + photos.getViewLink(photoID) + "'>", ["Close"], [""]);
|
case 4:
|
||||||
|
params = "getShortlink&photoID=" + photoID;
|
||||||
|
lychee.api(params, "text", function(data) {
|
||||||
|
if (data=="") data = "Something went wrong!";
|
||||||
|
modal = build.modal("Copy Shortlink", "Everyone can view your public photos, but only you can edit them. Use this link to share your photo with others: <input class='copylink' value='" + data + "'>", ["Close"], [""]);
|
||||||
$("body").append(modal);
|
$("body").append(modal);
|
||||||
$(".copylink").focus();
|
$(".copylink").focus();
|
||||||
break;
|
});
|
||||||
case 4:
|
break;
|
||||||
link = "copy";
|
default:
|
||||||
modal = build.modal("Copy Shortlink", "You can use this link to share your image with other people: <input class='copylink' value='" + data.shortlink + "'>", ["Close"], [""]);
|
link = "";
|
||||||
$("body").append(modal);
|
break;
|
||||||
$(".copylink").focus();
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
link = "";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (link=="copy") loadingBar.hide();
|
if (link.length>5) location.href = link;
|
||||||
else if (link.length>5) {
|
|
||||||
location.href = link;
|
|
||||||
loadingBar.hide();
|
|
||||||
} else loadingBar.show("error");
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
13
js/modules/search.js
Normal file → Executable file
13
js/modules/search.js
Normal file → Executable file
@ -26,21 +26,27 @@ search = {
|
|||||||
photosData = "";
|
photosData = "";
|
||||||
if (data&&data.photos) $.each(data.photos, function() { photosData += build.photo(this); });
|
if (data&&data.photos) $.each(data.photos, function() { photosData += build.photo(this); });
|
||||||
|
|
||||||
if (albumsData==""&&photosData=="") code = "";
|
if (albumsData==""&&photosData=="") code = "error";
|
||||||
else if (albumsData=="") code = build.divider("Photos")+photosData;
|
else if (albumsData=="") code = build.divider("Photos")+photosData;
|
||||||
else if (photosData=="") code = build.divider("Albums")+albumsData;
|
else if (photosData=="") code = build.divider("Albums")+albumsData;
|
||||||
else code = build.divider("Photos")+photosData+build.divider("Albums")+albumsData;
|
else code = build.divider("Photos")+photosData+build.divider("Albums")+albumsData;
|
||||||
|
|
||||||
if (lychee.content.attr("data-search")!=code) {
|
if (lychee.content.attr("data-search")!=code) {
|
||||||
|
|
||||||
|
$(".no_content").remove();
|
||||||
|
|
||||||
lychee.animate(".album, .photo", "contentZoomOut");
|
lychee.animate(".album, .photo", "contentZoomOut");
|
||||||
lychee.animate(".divider", "fadeOut");
|
lychee.animate(".divider", "fadeOut");
|
||||||
|
|
||||||
$.timer(300,function(){
|
$.timer(300,function(){
|
||||||
|
|
||||||
lychee.content.attr("data-search", code);
|
lychee.content.attr("data-search", code);
|
||||||
lychee.content.html(code);
|
|
||||||
lychee.animate(".album, .photo", "contentZoomIn");
|
if (code=="error") $("body").append(build.no_content("search"));
|
||||||
|
else {
|
||||||
|
lychee.content.html(code);
|
||||||
|
lychee.animate(".album, .photo", "contentZoomIn");
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -57,6 +63,7 @@ search = {
|
|||||||
reset: function() {
|
reset: function() {
|
||||||
|
|
||||||
$("#search").val("");
|
$("#search").val("");
|
||||||
|
$(".no_content").remove();
|
||||||
|
|
||||||
if (lychee.content.attr("data-search")!="") {
|
if (lychee.content.attr("data-search")!="") {
|
||||||
|
|
||||||
|
0
js/modules/visible.js
Normal file → Executable file
0
js/modules/visible.js
Normal file → Executable file
@ -80,7 +80,7 @@ function hideInfobox() {
|
|||||||
|
|
||||||
function loadPhotoInfo(photoID) {
|
function loadPhotoInfo(photoID) {
|
||||||
|
|
||||||
params = "function=getPhotoInfo&photoID=" + photoID;
|
params = "function=getPhotoInfo&photoID=" + photoID + "&password=''";
|
||||||
$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
|
$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
|
||||||
|
|
||||||
if (!data.title) data.title = "Untitled";
|
if (!data.title) data.title = "Untitled";
|
||||||
|
2
lychee.sql
Normal file → Executable file
2
lychee.sql
Normal file → Executable file
@ -10,6 +10,8 @@ CREATE TABLE IF NOT EXISTS `lychee_albums` (
|
|||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`title` varchar(50) NOT NULL,
|
`title` varchar(50) NOT NULL,
|
||||||
`sysdate` varchar(10) NOT NULL,
|
`sysdate` varchar(10) NOT NULL,
|
||||||
|
`public` TINYINT(1) DEFAULT '0',
|
||||||
|
`password` VARCHAR(100),
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||||
|
|
||||||
|
118
php/api.php
Normal file → Executable file
118
php/api.php
Normal file → Executable file
@ -7,79 +7,101 @@
|
|||||||
* @copyright 2013 by Philipp Maurer, Tobias Reich
|
* @copyright 2013 by Philipp Maurer, Tobias Reich
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(floatval(phpversion())<5.2) die("Please upgrade to PHP 5.2 or higher!");
|
if (floatval(phpversion())<5.2) die('Please upgrade to PHP 5.2 or higher!');
|
||||||
|
|
||||||
if((isset($_POST["function"])&&$_POST["function"]!="")||(isset($_GET["function"])&&$_GET["function"]!="")) {
|
if (!empty($_POST['function'])||!empty($_GET['function'])) {
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
define("LYCHEE", true);
|
define('LYCHEE', true);
|
||||||
|
|
||||||
include("array2json.php");
|
require('config.php');
|
||||||
include("config.php");
|
require('functions.php');
|
||||||
include("functions.php");
|
|
||||||
|
|
||||||
// Security
|
// Security
|
||||||
if(isset($_POST["albumID"])&&($_POST["albumID"]==""||$_POST["albumID"]<0)) exit("Wrong parameter type for 'albumID'!");
|
if (isset($_POST['albumID'])&&($_POST['albumID']==''||$_POST['albumID']<0)) exit('Wrong parameter type for albumID!');
|
||||||
if(isset($_POST["photoID"])&&$_POST["photoID"]=="") exit("Wrong parameter type for 'photoID'!");
|
if (isset($_POST['photoID'])&&$_POST['photoID']=='') exit('Wrong parameter type for photoID!');
|
||||||
|
|
||||||
if($_SESSION["login"]==true) {
|
//Connect to DB
|
||||||
|
$database = dbConnect();
|
||||||
|
|
||||||
//Connect to DB
|
if (isset($_SESSION['login'])&&$_SESSION['login']==true) {
|
||||||
$database = dbConnect();
|
|
||||||
|
/**
|
||||||
|
* Admin Mode
|
||||||
|
* Full access to Lychee. Only with correct password.
|
||||||
|
*/
|
||||||
|
|
||||||
// Album Functions
|
// Album Functions
|
||||||
if($_POST["function"]=="getAlbums") echo array2json(getAlbums());
|
if ($_POST['function']=='getAlbums') echo json_encode(getAlbums(false));
|
||||||
if($_POST["function"]=="getSmartInfo") echo array2json(getSmartInfo());
|
if ($_POST['function']=='getSmartInfo') echo json_encode(getSmartInfo());
|
||||||
if($_POST["function"]=="addAlbum"&&isset($_POST["title"])) echo addAlbum($_POST["title"]);
|
if ($_POST['function']=='addAlbum'&&isset($_POST['title'])) echo addAlbum($_POST['title']);
|
||||||
if($_POST["function"]=="getAlbumInfo"&&isset($_POST["albumID"])) echo array2json(getAlbumInfo($_POST["albumID"]));
|
if ($_POST['function']=='getAlbumInfo'&&isset($_POST['albumID'])) echo json_encode(getAlbumInfo($_POST['albumID']));
|
||||||
if($_POST["function"]=="setAlbumTitle"&&isset($_POST["albumID"])&&isset($_POST["title"])) echo setAlbumTitle($_POST["albumID"], $_POST["title"]);
|
if ($_POST['function']=='setAlbumTitle'&&isset($_POST['albumID'])&&isset($_POST['title'])) echo setAlbumTitle($_POST['albumID'], $_POST['title']);
|
||||||
if($_POST["function"]=="deleteAlbum"&&isset($_POST["albumID"])&&isset($_POST["delAll"])) echo deleteAlbum($_POST["albumID"], $_POST["delAll"]);
|
if ($_POST['function']=='setAlbumPublic'&&isset($_POST['albumID'])) echo setAlbumPublic($_POST['albumID']);
|
||||||
if($_GET["function"]=="getAlbumArchive"&&isset($_GET["albumID"])) getAlbumArchive($_GET["albumID"]);
|
if ($_POST['function']=='setAlbumPassword'&&isset($_POST['albumID'])&&isset($_POST['password'])) echo setAlbumPassword($_POST['albumID'], $_POST['password']);
|
||||||
|
if ($_POST['function']=='deleteAlbum'&&isset($_POST['albumID'])&&isset($_POST['delAll'])) echo deleteAlbum($_POST['albumID'], $_POST['delAll']);
|
||||||
|
if (isset($_GET['function'])&&$_GET['function']=='getAlbumArchive'&&isset($_GET['albumID'])) getAlbumArchive($_GET['albumID']);
|
||||||
|
|
||||||
// Photo Functions
|
// Photo Functions
|
||||||
if($_POST["function"]=="getPhotos"&&isset($_POST["albumID"])) echo array2json(getPhotos($_POST["albumID"]));
|
if ($_POST['function']=='getPhotos'&&isset($_POST['albumID'])) echo json_encode(getPhotos($_POST['albumID']));
|
||||||
if($_POST["function"]=="getPhotoInfo"&&isset($_POST["photoID"])) echo array2json(getPhotoInfo($_POST["photoID"]));
|
if ($_POST['function']=='getPhotoInfo'&&isset($_POST['photoID'])) echo json_encode(getPhotoInfo($_POST['photoID']));
|
||||||
if($_POST["function"]=="movePhoto"&&isset($_POST["photoID"])&&isset($_POST["albumID"])) echo movePhoto($_POST["photoID"], $_POST["albumID"]);
|
if ($_POST['function']=='getShortlink'&&isset($_POST['photoID'])) echo getShortlink($_POST['photoID']);
|
||||||
if($_POST["function"]=="deletePhoto"&&isset($_POST["photoID"])) echo deletePhoto($_POST["photoID"]);
|
if ($_POST['function']=='setAlbum'&&isset($_POST['photoID'])&&isset($_POST['albumID'])) echo setAlbum($_POST['photoID'], $_POST['albumID']);
|
||||||
if($_POST["function"]=="setPhotoTitle"&&isset($_POST["photoID"])&&isset($_POST["title"])) echo setPhotoTitle($_POST["photoID"], $_POST["title"]);
|
if ($_POST['function']=='deletePhoto'&&isset($_POST['photoID'])) echo deletePhoto($_POST['photoID']);
|
||||||
if($_POST["function"]=="setPhotoStar"&&isset($_POST["photoID"])) echo setPhotoStar($_POST["photoID"]);
|
if ($_POST['function']=='setPhotoTitle'&&isset($_POST['photoID'])&&isset($_POST['title'])) echo setPhotoTitle($_POST['photoID'], $_POST['title']);
|
||||||
if($_POST["function"]=="setPhotoPublic"&&isset($_POST["photoID"])&&isset($_POST["url"])) echo setPhotoPublic($_POST["photoID"], $_POST["url"]);
|
if ($_POST['function']=='setPhotoStar'&&isset($_POST['photoID'])) echo setPhotoStar($_POST['photoID']);
|
||||||
if($_POST["function"]=="setPhotoDescription"&&isset($_POST["photoID"])&&isset($_POST["description"])) echo setPhotoDescription($_POST["photoID"], $_POST["description"]);
|
if ($_POST['function']=='setPhotoPublic'&&isset($_POST['photoID'])&&isset($_POST['url'])) echo setPhotoPublic($_POST['photoID'], $_POST['url']);
|
||||||
if($_POST["function"]=="sharePhoto"&&isset($_POST["photoID"])&&isset($_POST["url"])) echo array2json(sharePhoto($_POST["photoID"], $_POST["url"]));
|
if ($_POST['function']=='setPhotoDescription'&&isset($_POST['photoID'])&&isset($_POST['description'])) echo setPhotoDescription($_POST['photoID'], $_POST['description']);
|
||||||
if($_POST["function"]=="previousPhoto"&&isset($_POST["photoID"])&&isset($_POST["albumID"])) echo array2json(previousPhoto($_POST["photoID"], $_POST["albumID"]));
|
if ($_POST['function']=='previousPhoto'&&isset($_POST['photoID'])&&isset($_POST['albumID'])) echo json_encode(previousPhoto($_POST['photoID'], $_POST['albumID'], false));
|
||||||
if($_POST["function"]=="nextPhoto"&&isset($_POST["photoID"])&&isset($_POST["albumID"])) echo array2json(nextPhoto($_POST["photoID"], $_POST["albumID"]));
|
if ($_POST['function']=='nextPhoto'&&isset($_POST['photoID'])&&isset($_POST['albumID'])) echo json_encode(nextPhoto($_POST['photoID'], $_POST['albumID'], false));
|
||||||
|
|
||||||
// Upload Function
|
// Add Function
|
||||||
if($_POST["function"]=="upload"&&isset($_FILES)&&isset($_POST["albumID"])) echo upload($_FILES, $_POST["albumID"]);
|
if ($_POST['function']=='upload'&&isset($_FILES)&&isset($_POST['albumID'])) echo upload($_FILES, $_POST['albumID']);
|
||||||
|
if ($_POST['function']=='importUrl'&&isset($_POST['url'])&&isset($_POST['albumID'])) echo importUrl($_POST['url'], $_POST['albumID']);
|
||||||
|
|
||||||
// Search Function
|
// Search Function
|
||||||
if($_POST["function"]=="search"&&isset($_POST["term"])) echo array2json(search($_POST["term"]));
|
if ($_POST['function']=='search'&&isset($_POST['term'])) echo json_encode(search($_POST['term']));
|
||||||
|
|
||||||
// Sync Function
|
|
||||||
if($_POST["function"]=="syncFolder") echo syncFolder();
|
|
||||||
|
|
||||||
// Session Functions
|
// Session Functions
|
||||||
if($_POST["function"]=="login") echo login($_POST['user'], $_POST['password']);
|
if ($_POST['function']=='init') echo json_encode(init('admin'));
|
||||||
if($_POST["function"]=="logout") logout();
|
if ($_POST['function']=='login') echo login($_POST['user'], $_POST['password']);
|
||||||
if($_POST["function"]=="loggedIn") echo true;
|
if ($_POST['function']=='logout') logout();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$database = dbConnect();
|
/**
|
||||||
|
* Public Mode
|
||||||
|
* Access to view all public folders and photos in Lychee.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Album Functions
|
||||||
|
if ($_POST['function']=='getAlbums') echo json_encode(getAlbums(true));
|
||||||
|
if ($_POST['function']=='getAlbumInfo'&&isset($_POST['albumID'])&&isset($_POST['password'])&&isAlbumPublic($_POST['albumID'], $_POST['password'])) echo json_encode(getAlbumInfo($_POST['albumID']));
|
||||||
|
|
||||||
// Photo Functions
|
// Photo Functions
|
||||||
if($_POST["function"]=="getPhotoInfo"&&isset($_POST["photoID"])&&isPhotoPublic($_POST["photoID"])) echo array2json(getPhotoInfo($_POST["photoID"]));
|
if ($_POST['function']=='getPhotos') {
|
||||||
|
if (isset($_POST['albumID'])&&isset($_POST['password'])&&isAlbumPublic($_POST['albumID'], $_POST['password'])) echo json_encode(getPhotos($_POST['albumID']));
|
||||||
|
else echo json_encode('HTTP/1.1 403 Wrong password!');
|
||||||
|
}
|
||||||
|
|
||||||
// Session Functions
|
if ($_POST['function']=='getPhotoInfo') {
|
||||||
if($_POST["function"]=="login") echo login($_POST['user'], $_POST['password']);
|
if (isset($_POST['photoID'])&&isset($_POST['password'])&&isPhotoPublic($_POST['photoID'], $_POST['password'])) echo json_encode(getPhotoInfo($_POST['photoID']));
|
||||||
if($_POST["function"]=="loggedIn") echo false;
|
else echo json_encode('HTTP/1.1 403 Wrong password!');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
if ($_POST['function']=='previousPhoto'&&isset($_POST['photoID'])&&isset($_POST['albumID'])) echo json_encode(previousPhoto($_POST['photoID'], $_POST['albumID'], false));
|
||||||
|
if ($_POST['function']=='nextPhoto'&&isset($_POST['photoID'])&&isset($_POST['albumID'])) echo json_encode(nextPhoto($_POST['photoID'], $_POST['albumID'], false));
|
||||||
|
|
||||||
|
// Session Functions
|
||||||
|
if ($_POST['function']=='init') echo json_encode(init('public'));
|
||||||
|
if ($_POST['function']=='login') echo login($_POST['user'], $_POST['password']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
header('HTTP/1.1 401 Unauthorized');
|
header('HTTP/1.1 401 Unauthorized');
|
||||||
die("Error: No permission!");
|
die('Error: No permission!');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
function array2json($arr) {
|
|
||||||
if(function_exists('json_encode')) return json_encode($arr); //Lastest versions of PHP already has this functionality.
|
|
||||||
$parts = array();
|
|
||||||
$is_list = false;
|
|
||||||
|
|
||||||
//Find out if the given array is a numerical array
|
|
||||||
$keys = array_keys($arr);
|
|
||||||
$max_length = count($arr)-1;
|
|
||||||
if(($keys[0] == 0) and ($keys[$max_length] == $max_length)) {//See if the first key is 0 and last key is length - 1
|
|
||||||
$is_list = true;
|
|
||||||
for($i=0; $i<count($keys); $i++) { //See if each key correspondes to its position
|
|
||||||
if($i != $keys[$i]) { //A key fails at position check.
|
|
||||||
$is_list = false; //It is an associative array.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($arr as $key=>$value) {
|
|
||||||
if(is_array($value)) { //Custom handling for arrays
|
|
||||||
if($is_list) $parts[] = array2json($value); /* :RECURSION: */
|
|
||||||
else $parts[] = '"' . $key . '":' . array2json($value); /* :RECURSION: */
|
|
||||||
} else {
|
|
||||||
$str = '';
|
|
||||||
if(!$is_list) $str = '"' . $key . '":';
|
|
||||||
|
|
||||||
//Custom handling for multiple data types
|
|
||||||
if(is_numeric($value)) $str .= $value; //Numbers
|
|
||||||
elseif($value === false) $str .= 'false'; //The booleans
|
|
||||||
elseif($value === true) $str .= 'true';
|
|
||||||
else $str .= '"' . addslashes($value) . '"'; //All other things
|
|
||||||
// :TODO: Is there any more datatype we should be in the lookout for? (Object?)
|
|
||||||
|
|
||||||
$parts[] = $str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$json = implode(',',$parts);
|
|
||||||
|
|
||||||
if($is_list) return '[' . $json . ']';//Return numerical JSON
|
|
||||||
return '{' . $json . '}';//Return associative JSON
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,39 +1,45 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define("LYCHEE", true);
|
define('LYCHEE', true);
|
||||||
|
|
||||||
// Declare
|
// Declare
|
||||||
$error = "";
|
$error = '';
|
||||||
|
|
||||||
// Include
|
// Include
|
||||||
include("config.php");
|
require('config.php');
|
||||||
|
|
||||||
// PHP Version
|
// PHP Version
|
||||||
if (floatval(phpversion())<5.2) $error .= ("Error 100: Please upgrade to PHP 5.2 or higher!<br>\n");
|
if (floatval(phpversion())<5.2) $error .= ('Error 100: Please upgrade to PHP 5.2 or higher!<br>\n');
|
||||||
|
|
||||||
// Extensions
|
// Extensions
|
||||||
if (!extension_loaded("exif")) $error .= ("Error 200: PHP exif extension not activated.<br>\n");
|
if (!extension_loaded('exif')) $error .= ('Error 200: PHP exif extension not activated.<br>\n');
|
||||||
if (!extension_loaded("mbstring")) $error .= ("Error 201: PHP mbstring extension not activated.<br>\n");
|
if (!extension_loaded('mbstring')) $error .= ('Error 201: PHP mbstring extension not activated.<br>\n');
|
||||||
if (!extension_loaded("gd")) $error .= ("Error 202: PHP gd extension not activated.<br>\n");
|
if (!extension_loaded('gd')) $error .= ('Error 202: PHP gd extension not activated.<br>\n');
|
||||||
if (!extension_loaded("mysqli")) $error .= ("Error 203: PHP mysqli extension not activated.<br>\n");
|
if (!extension_loaded('mysqli')) $error .= ('Error 203: PHP mysqli extension not activated.<br>\n');
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
if (!$db||$db=="") $error .= ("Error 300: No property for \$db in config.php.<br>\n");
|
if (!$db||$db=='') $error .= ('Error 300: No property for \$db in config.php.<br>\n');
|
||||||
if (!$dbUser||$dbUser=="") $error .= ("Error 301: No property for \$dbUser in config.php.<br>\n");
|
if (!$dbUser||$dbUser=='') $error .= ('Error 301: No property for \$dbUser in config.php.<br>\n');
|
||||||
if (!$dbPassword||$dbPassword=="") $error .= ("Error 302: No property for \$dbPassword in config.php.<br>\n");
|
if (!$dbPassword||$dbPassword=='') $error .= ('Error 302: No property for \$dbPassword in config.php.<br>\n');
|
||||||
if (!$dbHost||$dbHost=="") $error .= ("Error 303: No property for \$dbHost in config.php.<br>\n");
|
if (!$dbHost||$dbHost=='') $error .= ('Error 303: No property for \$dbHost in config.php.<br>\n');
|
||||||
if (!$user||$user=="") $error .= ("Error 304: No property for \$user in config.php.<br>\n");
|
if (!$user||$user=='') $error .= ('Error 304: No property for \$user in config.php.<br>\n');
|
||||||
if (!$password||$password=="") $error .= ("Error 305: No property for \$password in config.php.<br>\n");
|
if (!$password||$password=='') $error .= ('Error 305: No property for \$password in config.php.<br>\n');
|
||||||
|
|
||||||
|
// Additional Config
|
||||||
|
//if ($checkForUpdates!=true&&heckForUpdates!=false) $error .= ('Error 306: No property for \$checkForUpdates in config.php.<br>\n');
|
||||||
|
if (!is_numeric($thumbQuality)||$thumbQuality<=0||$thumbQuality>=100) $error .= ('Error 307: Wrong property for \$thumbQuality in config.php.<br>\n');
|
||||||
|
if ($sorting!='ASC'&&$sorting!='DESC') $error .= ('Error 308: Wrong property for \$sorting in config.php.<br>\n');
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
$database = new mysqli($dbHost, $dbUser, $dbPassword, $db);
|
$database = new mysqli($dbHost, $dbUser, $dbPassword, $db);
|
||||||
if (mysqli_connect_errno()!=0) $error .= ("Error 400: " . mysqli_connect_errno() . ": " . mysqli_connect_error() . "<br>\n");
|
if (mysqli_connect_errno()!=0) $error .= ('Error 400: ' . mysqli_connect_errno() . ': ' . mysqli_connect_error() . '<br>\n');
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
if (substr(sprintf('%o', fileperms("../uploads/big/")), -4) != "0777") $error .= ("Error 500: Wrong permissions for \"/uploads/big\" (777 required).<br>\n");
|
if (substr(sprintf('%o', fileperms('../uploads/big/')), -4)!='0777') $error .= ('Error 500: Wrong permissions for \'/uploads/big\' (777 required).<br>\n');
|
||||||
if (substr(sprintf('%o', fileperms("../uploads/thumb/")), -4) != "0777") $error .= ("Error 501: Wrong permissions for \"/uploads/thumb\" (777 required).<br>\n");
|
if (substr(sprintf('%o', fileperms('../uploads/thumb/')), -4)!='0777') $error .= ('Error 501: Wrong permissions for \'/uploads/thumb\' (777 required).<br>\n');
|
||||||
if (substr(sprintf('%o', fileperms("../uploads/import/")), -4) != "0777") $error .= ("Error 502: Wrong permissions for \"/uploads/import\" (777 required).<br>\n");
|
if (substr(sprintf('%o', fileperms('../uploads/import/')), -4)!='0777') $error .= ('Error 502: Wrong permissions for \'/uploads/import\' (777 required).<br>\n');
|
||||||
|
if (substr(sprintf('%o', fileperms('../uploads/')), -4)!='0777') $error .= ('Error 503: Wrong permissions for \'/uploads\' (777 required).<br>\n');
|
||||||
|
|
||||||
if ($error == "") echo("Lychee is ready!"); else echo $error;
|
if ($error=='') echo('Lychee is ready!'); else echo $error;
|
||||||
|
|
||||||
?>
|
?>
|
@ -7,21 +7,23 @@
|
|||||||
* @copyright 2013 by Philipp Maurer, Tobias Reich
|
* @copyright 2013 by Philipp Maurer, Tobias Reich
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!defined('LYCHEE')) die("Direct access is not allowed!");
|
if(!defined('LYCHEE')) die('Direct access is not allowed!');
|
||||||
|
|
||||||
//Database configurations
|
// Database configurations
|
||||||
$db = "lychee"; //Database name
|
$db = 'lychee'; //Database name
|
||||||
$dbUser = "lychee"; //Username of the database
|
$dbUser = 'lychee'; //Username of the database
|
||||||
$dbPassword = "lychee_passwd"; //Password of the Database
|
$dbPassword = 'lychee_passwd'; //Password of the Database
|
||||||
$dbHost = "localhost"; //Host of the Database
|
$dbHost = 'localhost'; //Host of the Database
|
||||||
|
|
||||||
//Lychee user configuration
|
// Admin Login
|
||||||
$user = "lychee"; //lychee username
|
$user = 'lychee'; //Admin Username
|
||||||
$password = "1234"; //lychee password
|
$password = '1234'; //Admin Password
|
||||||
|
|
||||||
//Additional settings
|
// Additional settings
|
||||||
|
$checkForUpdates = true;
|
||||||
$thumbQuality = 95; //Quality of the Thumbs (0-100). Default: 95
|
$thumbQuality = 95; //Quality of the Thumbs (0-100). Default: 95
|
||||||
$bitlyUsername = ""; //Your Bit.ly Username
|
$sorting = 'DESC'; //ASC or DESC sorting of albums and photos
|
||||||
$bitlyApi = ""; //Your Bit.ly API Key
|
$bitlyUsername = ''; //Your Bit.ly Username
|
||||||
|
$bitlyApi = ''; //Your Bit.ly API Key
|
||||||
|
|
||||||
?>
|
?>
|
@ -7,7 +7,7 @@
|
|||||||
* @copyright 2013 by Philipp Maurer, Tobias Reich
|
* @copyright 2013 by Philipp Maurer, Tobias Reich
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!defined('LYCHEE')) die("Direct access is not allowed!");
|
if(!defined('LYCHEE')) die('Direct access is not allowed!');
|
||||||
|
|
||||||
// Database Functions
|
// Database Functions
|
||||||
function dbConnect() {
|
function dbConnect() {
|
||||||
@ -26,16 +26,14 @@ function dbConnect() {
|
|||||||
}
|
}
|
||||||
function dbClose() {
|
function dbClose() {
|
||||||
global $database;
|
global $database;
|
||||||
$close = $database->close();
|
if(!$database->close()) {
|
||||||
if(!$close) {
|
|
||||||
echo "Closing the connection failed!";
|
echo "Closing the connection failed!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function createDatabase($db, $database) {
|
function createDatabase($db, $database) {
|
||||||
$query = "CREATE DATABASE IF NOT EXISTS $db;";
|
$result = $database->query("CREATE DATABASE IF NOT EXISTS $db;");
|
||||||
$result = $database->query($query);
|
|
||||||
$database->select_db($db);
|
$database->select_db($db);
|
||||||
if(!$result) return false;
|
if(!$result) return false;
|
||||||
return true;
|
return true;
|
||||||
@ -45,6 +43,8 @@ function createTables($database) {
|
|||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`title` varchar(50) NOT NULL,
|
`title` varchar(50) NOT NULL,
|
||||||
`sysdate` varchar(10) NOT NULL,
|
`sysdate` varchar(10) NOT NULL,
|
||||||
|
`public` TINYINT(1) DEFAULT '0',
|
||||||
|
`password` VARCHAR(100),
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;";
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;";
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
@ -147,7 +147,6 @@ function upload($files, $albumID) {
|
|||||||
}
|
}
|
||||||
function getCamera($photoID) {
|
function getCamera($photoID) {
|
||||||
global $database;
|
global $database;
|
||||||
$return = array();
|
|
||||||
$url = "../uploads/big/$photoID";
|
$url = "../uploads/big/$photoID";
|
||||||
$type = getimagesize($url);
|
$type = getimagesize($url);
|
||||||
$type = $type['mime'];
|
$type = $type['mime'];
|
||||||
@ -236,17 +235,22 @@ function createThumb($photoName, $width = 200, $width2x = 400, $height = 200, $h
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Session Functions
|
// Session Functions
|
||||||
|
function init($mode) {
|
||||||
|
global $checkForUpdates, $bitlyUsername;
|
||||||
|
$return["config"]["checkForUpdates"] = $checkForUpdates;
|
||||||
|
$return["config"]["bitlyUsername"] = $bitlyUsername;
|
||||||
|
if ($mode=="admin") $return["loggedIn"] = true;
|
||||||
|
else $return["loggedIn"] = false;
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
function login($loginUser, $loginPassword) {
|
function login($loginUser, $loginPassword) {
|
||||||
global $database, $user, $password;
|
global $database, $user, $password;
|
||||||
if(($loginUser == $user) && ($loginPassword == md5($password))){
|
if ($loginUser==$user&&$loginPassword==md5($password)) {
|
||||||
|
// Admin Login
|
||||||
$_SESSION['login'] = true;
|
$_SESSION['login'] = true;
|
||||||
ini_set("session.cookie_lifetime","86400");
|
|
||||||
ini_set("session.gc_maxlifetime", 86400);
|
|
||||||
ini_set("session.gc_probability",1);
|
|
||||||
ini_set("session.gc_divisor",1);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function logout() {
|
function logout() {
|
||||||
@ -258,38 +262,46 @@ function logout() {
|
|||||||
function addAlbum($title) {
|
function addAlbum($title) {
|
||||||
global $database;
|
global $database;
|
||||||
$title = mysqli_real_escape_string($database, $title);
|
$title = mysqli_real_escape_string($database, $title);
|
||||||
|
if(strlen($title)<1||strlen($title)>30) return false;
|
||||||
$sysdate = date("d.m.Y");
|
$sysdate = date("d.m.Y");
|
||||||
$query = "INSERT INTO lychee_albums (title, sysdate) VALUES ('$title', '$sysdate');";
|
$query = "INSERT INTO lychee_albums (title, sysdate) VALUES ('$title', '$sysdate');";
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if(!$result) return false;
|
if(!$result) return false;
|
||||||
return $database->insert_id;
|
return $database->insert_id;
|
||||||
}
|
}
|
||||||
function getAlbums() {
|
function getAlbums($public) {
|
||||||
global $database;
|
global $database, $sorting;
|
||||||
$return = array(array(array()));
|
|
||||||
|
|
||||||
// Smart Albums
|
// Smart Albums
|
||||||
$return = getSmartInfo();
|
if (!$public) $return = getSmartInfo();
|
||||||
|
|
||||||
// Albums
|
// Albums
|
||||||
$query = "SELECT id, title, sysdate FROM lychee_albums ORDER BY id DESC;";
|
if ($public) $query = "SELECT * FROM lychee_albums WHERE public = 1 ORDER BY id $sorting;";
|
||||||
|
else $query = "SELECT * FROM lychee_albums ORDER BY id $sorting;";
|
||||||
$result = $database->query($query) OR die("Error: $result <br>".$database->error);
|
$result = $database->query($query) OR die("Error: $result <br>".$database->error);
|
||||||
$i=0;
|
$i=0;
|
||||||
while($row = $result->fetch_object()) {
|
while($row = $result->fetch_object()) {
|
||||||
$return["album"][$i]['id'] = $row->id;
|
$return["album"][$i]['id'] = $row->id;
|
||||||
$return["album"][$i]['title'] = $row->title;
|
$return["album"][$i]['title'] = $row->title;
|
||||||
|
$return["album"][$i]['public'] = $row->public;
|
||||||
$return["album"][$i]['sysdate'] = $row->sysdate;
|
$return["album"][$i]['sysdate'] = $row->sysdate;
|
||||||
$albumID = $row->id;
|
if ($row->password=="") $return["album"][$i]['password'] = false;
|
||||||
$query = "SELECT thumbUrl FROM lychee_photos WHERE album = '$albumID' ORDER BY id DESC LIMIT 0, 3;";
|
else $return["album"][$i]['password'] = true;
|
||||||
$result2 = $database->query($query);
|
|
||||||
$k = 0;
|
// Thumbs
|
||||||
while($row2 = $result2->fetch_object()){
|
if (($public&&$row->password=="")||(!$public)) {
|
||||||
$return["album"][$i]["thumb$k"] = $row2->thumbUrl;
|
$albumID = $row->id;
|
||||||
$k++;
|
$query = "SELECT thumbUrl FROM lychee_photos WHERE album = '$albumID' ORDER BY id $sorting LIMIT 0, 3;";
|
||||||
|
$result2 = $database->query($query);
|
||||||
|
$k = 0;
|
||||||
|
while($row2 = $result2->fetch_object()){
|
||||||
|
$return["album"][$i]["thumb$k"] = $row2->thumbUrl;
|
||||||
|
$k++;
|
||||||
|
}
|
||||||
|
if(!isset($return["album"][$i]["thumb0"]))$return["album"][$i]["thumb0"]="";
|
||||||
|
if(!isset($return["album"][$i]["thumb1"]))$return["album"][$i]["thumb1"]="";
|
||||||
|
if(!isset($return["album"][$i]["thumb2"]))$return["album"][$i]["thumb2"]="";
|
||||||
}
|
}
|
||||||
if(!isset($return["album"][$i]["thumb0"]))$return[$i]["thumb0"]="";
|
|
||||||
if(!isset($return["album"][$i]["thumb1"]))$return[$i]["thumb1"]="";
|
|
||||||
if(!isset($return["album"][$i]["thumb2"]))$return[$i]["thumb2"]="";
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if($i==0) $return["albums"] = false;
|
if($i==0) $return["albums"] = false;
|
||||||
@ -297,9 +309,8 @@ function getAlbums() {
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
function getSmartInfo() {
|
function getSmartInfo() {
|
||||||
global $database;
|
global $database, $sorting;
|
||||||
$return = array(array());
|
$query = "SELECT * FROM lychee_photos WHERE album = 0 ORDER BY id $sorting;";
|
||||||
$query = "SELECT * FROM lychee_photos WHERE album = 0 ORDER BY id DESC;";
|
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($row = $result->fetch_object()) {
|
while($row = $result->fetch_object()) {
|
||||||
@ -308,7 +319,7 @@ function getSmartInfo() {
|
|||||||
}
|
}
|
||||||
$return['unsortNum'] = $i;
|
$return['unsortNum'] = $i;
|
||||||
|
|
||||||
$query2 = "SELECT * FROM lychee_photos WHERE public = 1 ORDER BY id DESC;";
|
$query2 = "SELECT * FROM lychee_photos WHERE public = 1 ORDER BY id $sorting;";
|
||||||
$result2 = $database->query($query2);
|
$result2 = $database->query($query2);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($row2 = $result2->fetch_object()) {
|
while($row2 = $result2->fetch_object()) {
|
||||||
@ -317,7 +328,7 @@ function getSmartInfo() {
|
|||||||
}
|
}
|
||||||
$return['publicNum'] = $i;
|
$return['publicNum'] = $i;
|
||||||
|
|
||||||
$query3 = "SELECT * FROM lychee_photos WHERE star = 1 ORDER BY id DESC;";
|
$query3 = "SELECT * FROM lychee_photos WHERE star = 1 ORDER BY id $sorting;";
|
||||||
$result3 = $database->query($query3);
|
$result3 = $database->query($query3);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($row3 = $result3->fetch_object()) {
|
while($row3 = $result3->fetch_object()) {
|
||||||
@ -329,13 +340,11 @@ function getSmartInfo() {
|
|||||||
}
|
}
|
||||||
function getAlbumInfo($albumID) {
|
function getAlbumInfo($albumID) {
|
||||||
global $database;
|
global $database;
|
||||||
$return = array();
|
|
||||||
$query = "SELECT * FROM lychee_albums WHERE id = '$albumID';";
|
$query = "SELECT * FROM lychee_albums WHERE id = '$albumID';";
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$row = $result->fetch_object();
|
$row = $result->fetch_object();
|
||||||
$return['title'] = $row->title;
|
$return['title'] = $row->title;
|
||||||
$return['date'] = $row->sysdate;
|
$return['date'] = $row->sysdate;
|
||||||
$return['star'] = $row->star;
|
|
||||||
$return['public'] = $row->public;
|
$return['public'] = $row->public;
|
||||||
$query = "SELECT COUNT(*) AS num FROM lychee_photos WHERE album = '$albumID';";
|
$query = "SELECT COUNT(*) AS num FROM lychee_photos WHERE album = '$albumID';";
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
@ -346,7 +355,7 @@ function getAlbumInfo($albumID) {
|
|||||||
function setAlbumTitle($albumID, $title) {
|
function setAlbumTitle($albumID, $title) {
|
||||||
global $database;
|
global $database;
|
||||||
$title = mysqli_real_escape_string($database, urldecode($title));
|
$title = mysqli_real_escape_string($database, urldecode($title));
|
||||||
if(strlen($title)<3||strlen($title)>30) return false;
|
if(strlen($title)<1||strlen($title)>30) return false;
|
||||||
$query = "UPDATE lychee_albums SET title = '$title' WHERE id = '$albumID';";
|
$query = "UPDATE lychee_albums SET title = '$title' WHERE id = '$albumID';";
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
if(!$result) return false;
|
if(!$result) return false;
|
||||||
@ -400,7 +409,7 @@ function getAlbumArchive($albumID) {
|
|||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$row = $result->fetch_object();
|
$row = $result->fetch_object();
|
||||||
if($albumID!=0&&is_numeric($albumID))$zipTitle = $row->title;
|
if($albumID!=0&&is_numeric($albumID))$zipTitle = $row->title;
|
||||||
$filename = "./".$zipTitle.".zip";
|
$filename = "../uploads/".$zipTitle.".zip";
|
||||||
|
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
|
|
||||||
@ -418,24 +427,57 @@ function getAlbumArchive($albumID) {
|
|||||||
|
|
||||||
header("Content-Type: application/zip");
|
header("Content-Type: application/zip");
|
||||||
header("Content-Disposition: attachment; filename=\"$zipTitle.zip\"");
|
header("Content-Disposition: attachment; filename=\"$zipTitle.zip\"");
|
||||||
|
header("Content-Length: ".filesize($filename));
|
||||||
readfile($filename);
|
readfile($filename);
|
||||||
unlink($filename);
|
unlink($filename);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
function setAlbumPublic($albumID) {
|
||||||
|
global $database;
|
||||||
|
$query = "SELECT public FROM lychee_albums WHERE id = '$albumID';";
|
||||||
|
$result = $database->query($query);
|
||||||
|
$row = $result->fetch_object();
|
||||||
|
if($row->public == 0){
|
||||||
|
$public = 1;
|
||||||
|
}else{
|
||||||
|
$public = 0;
|
||||||
|
}
|
||||||
|
$query = "UPDATE lychee_albums SET public = '$public', password = NULL WHERE id = '$albumID';";
|
||||||
|
$result = $database->query($query);
|
||||||
|
if(!$result) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function setAlbumPassword($albumID, $password) {
|
||||||
|
global $database;
|
||||||
|
$query = "UPDATE lychee_albums SET password = '$password' WHERE id = '$albumID';";
|
||||||
|
$result = $database->query($query);
|
||||||
|
if(!$result) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function isAlbumPublic($albumID, $password) {
|
||||||
|
global $database;
|
||||||
|
$query = "SELECT public, password FROM lychee_albums WHERE id = '$albumID';";
|
||||||
|
$result = $database->query($query);
|
||||||
|
$row = $result->fetch_object();
|
||||||
|
if(($row->public == 1) && ($row->password == $password)){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Photo Functions
|
// Photo Functions
|
||||||
function getPhotos($albumID) {
|
function getPhotos($albumID) {
|
||||||
global $database;
|
global $database, $sorting;
|
||||||
switch($albumID) {
|
switch($albumID) {
|
||||||
case "f": $query = "SELECT * FROM lychee_photos WHERE star = 1 ORDER BY id DESC;";
|
case "f": $query = "SELECT id, title, sysdate, public, star, album, thumbUrl FROM lychee_photos WHERE star = 1 ORDER BY id $sorting;";
|
||||||
break;
|
break;
|
||||||
case "s": $query = "SELECT * FROM lychee_photos WHERE public = 1 ORDER BY id DESC;";
|
case "s": $query = "SELECT id, title, sysdate, public, star, album, thumbUrl FROM lychee_photos WHERE public = 1 ORDER BY id $sorting;";
|
||||||
break;
|
break;
|
||||||
default: $query = "SELECT * FROM lychee_photos WHERE album = '$albumID' ORDER BY id DESC;";
|
default: $query = "SELECT id, title, sysdate, public, star, album, thumbUrl FROM lychee_photos WHERE album = '$albumID' ORDER BY id $sorting;";
|
||||||
}
|
}
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$return = array(array());
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($row = $result->fetch_array()) {
|
while($row = $result->fetch_array()) {
|
||||||
$return[$i] = $row;
|
$return[$i] = $row;
|
||||||
@ -451,10 +493,10 @@ function getPhotoInfo($photoID) {
|
|||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$row = $result->fetch_object();
|
$row = $result->fetch_object();
|
||||||
if($row->quantity == 0) {
|
if($row->quantity == 0) {
|
||||||
importPhoto($photoID);
|
importPhoto($photoID, 's');
|
||||||
}
|
}
|
||||||
if(is_file("../uploads/import/$photoID")) {
|
if(is_file("../uploads/import/$photoID")) {
|
||||||
importPhoto($photoID);
|
importPhoto($photoID, 's');
|
||||||
}
|
}
|
||||||
$query = "SELECT * FROM lychee_photos WHERE import_name = '../uploads/import/$photoID' ORDER BY ID DESC;";
|
$query = "SELECT * FROM lychee_photos WHERE import_name = '../uploads/import/$photoID' ORDER BY ID DESC;";
|
||||||
} else {
|
} else {
|
||||||
@ -488,13 +530,6 @@ function downloadPhoto($photoID) {
|
|||||||
unlink($filename);
|
unlink($filename);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function countPhotos() {
|
|
||||||
global $database;
|
|
||||||
$query = "SELECT COUNT(*) AS num FROM lychee_photos;";
|
|
||||||
$result = $database->query($query);
|
|
||||||
$row = $result->fetch_object();
|
|
||||||
return $row->num;
|
|
||||||
}
|
|
||||||
function setPhotoPublic($photoID, $url) {
|
function setPhotoPublic($photoID, $url) {
|
||||||
global $database;
|
global $database;
|
||||||
$query = "SELECT public, shortlink FROM lychee_photos WHERE id = '$photoID';";
|
$query = "SELECT public, shortlink FROM lychee_photos WHERE id = '$photoID';";
|
||||||
@ -533,8 +568,9 @@ function setPhotoStar($photoID) {
|
|||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function nextPhoto($photoID, $albumID) {
|
function nextPhoto($photoID, $albumID, $innerCall) {
|
||||||
global $database;
|
global $database, $sorting;
|
||||||
|
if (!$innerCall&&$sorting=="ASC") return previousPhoto($photoID, $albumID, true);
|
||||||
switch($albumID) {
|
switch($albumID) {
|
||||||
case 'f': $query = "SELECT * FROM lychee_photos WHERE id < '$photoID' AND star = '1' ORDER BY id DESC LIMIT 0, 1;";
|
case 'f': $query = "SELECT * FROM lychee_photos WHERE id < '$photoID' AND star = '1' ORDER BY id DESC LIMIT 0, 1;";
|
||||||
break;
|
break;
|
||||||
@ -557,14 +593,15 @@ function nextPhoto($photoID, $albumID) {
|
|||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
function previousPhoto($photoID, $albumID) {
|
function previousPhoto($photoID, $albumID, $innerCall) {
|
||||||
global $database;
|
global $database, $sorting;
|
||||||
|
if (!$innerCall&&$sorting=="ASC") return nextPhoto($photoID, $albumID, true);
|
||||||
switch($albumID) {
|
switch($albumID) {
|
||||||
case 'f': $query = "SELECT * FROM lychee_photos WHERE id > '$photoID' AND star = '1' LIMIT 0, 1;";
|
case 'f': $query = "SELECT * FROM lychee_photos WHERE id > '$photoID' AND star = '1' ORDER BY id LIMIT 0, 1;";
|
||||||
break;
|
break;
|
||||||
case 's': $query = "SELECT * FROM lychee_photos WHERE id > '$photoID' AND public = '1' LIMIT 0, 1;";
|
case 's': $query = "SELECT * FROM lychee_photos WHERE id > '$photoID' AND public = '1' ORDER BY id LIMIT 0, 1;";
|
||||||
break;
|
break;
|
||||||
default: $query = "SELECT * FROM lychee_photos WHERE id > '$photoID' AND album = '$albumID' LIMIT 0, 1;";
|
default: $query = "SELECT * FROM lychee_photos WHERE id > '$photoID' AND album = '$albumID' ORDER BY id LIMIT 0, 1;";
|
||||||
}
|
}
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$return = $result->fetch_array();
|
$return = $result->fetch_array();
|
||||||
@ -581,7 +618,7 @@ function previousPhoto($photoID, $albumID) {
|
|||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
function movePhoto($photoID, $newAlbum) {
|
function setAlbum($photoID, $newAlbum) {
|
||||||
global $database;
|
global $database;
|
||||||
$query = "UPDATE lychee_photos SET album = '$newAlbum' WHERE id = '$photoID';";
|
$query = "UPDATE lychee_photos SET album = '$newAlbum' WHERE id = '$photoID';";
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
@ -622,8 +659,7 @@ function deletePhoto($photoID) {
|
|||||||
if(!$result) return false;
|
if(!$result) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function importPhoto($name) {
|
function importPhoto($name, $albumID) {
|
||||||
global $database;
|
|
||||||
$tmp_name = "../uploads/import/$name";
|
$tmp_name = "../uploads/import/$name";
|
||||||
$details = getimagesize($tmp_name);
|
$details = getimagesize($tmp_name);
|
||||||
$size = filesize($tmp_name);
|
$size = filesize($tmp_name);
|
||||||
@ -633,9 +669,20 @@ function importPhoto($name) {
|
|||||||
$nameFile[0]['tmp_name'] = $tmp_name;
|
$nameFile[0]['tmp_name'] = $tmp_name;
|
||||||
$nameFile[0]['error'] = 0;
|
$nameFile[0]['error'] = 0;
|
||||||
$nameFile[0]['size'] = $size;
|
$nameFile[0]['size'] = $size;
|
||||||
if(!upload($nameFile, 's')) return false;
|
if(!upload($nameFile, $albumID)) return false;
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
function importUrl($url, $albumID) {
|
||||||
|
if (@getimagesize($url)) {
|
||||||
|
$pathinfo = pathinfo($url);
|
||||||
|
$filename = $pathinfo['filename'].".".$pathinfo['extension'];
|
||||||
|
$tmp_name = "../uploads/import/$filename";
|
||||||
|
copy($url, $tmp_name);
|
||||||
|
return importPhoto($filename, $albumID);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Share Functions
|
// Share Functions
|
||||||
function urlShortner($url) {
|
function urlShortner($url) {
|
||||||
@ -650,30 +697,12 @@ function urlShortner($url) {
|
|||||||
$shortlink = $xml->results->nodeKeyVal->shortUrl;
|
$shortlink = $xml->results->nodeKeyVal->shortUrl;
|
||||||
return $shortlink;
|
return $shortlink;
|
||||||
}
|
}
|
||||||
function sharePhoto($photoID, $url) {
|
function getShortlink($photoID) {
|
||||||
global $database;
|
global $database;
|
||||||
$query = "SELECT * FROM lychee_photos WHERE id = '$photoID';";
|
$query = "SELECT * FROM lychee_photos WHERE id = '$photoID';";
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$row = $result->fetch_object();
|
$row = $result->fetch_object();
|
||||||
|
return $row->shortlink;
|
||||||
$thumb = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."/../../".$row->thumbUrl;
|
|
||||||
$title = $row->title;
|
|
||||||
$description = $row->description;
|
|
||||||
$shortlink = $row->shortlink;
|
|
||||||
|
|
||||||
$twitterUrl = "https://twitter.com/share?url=".urlencode("$url");
|
|
||||||
$facebookUrl = "http://www.facebook.com/sharer.php?u=".urlencode("$url")."&t=".urlencode($title);
|
|
||||||
$mailUrl = "mailto:?subject=".rawurlencode($title)."&body=".rawurlencode("Hey guy! Check this out: $url");
|
|
||||||
|
|
||||||
$share = array();
|
|
||||||
$share['twitter'] = $twitterUrl;
|
|
||||||
$share['facebook'] = $facebookUrl;
|
|
||||||
$share['tumblr'] = $tumblrUrl;
|
|
||||||
$share['pinterest'] = $pinterestUrl;
|
|
||||||
$share['mail'] = $mailUrl;
|
|
||||||
$share['shortlink'] = $shortlink;
|
|
||||||
|
|
||||||
return $share;
|
|
||||||
}
|
}
|
||||||
function facebookHeader($photoID) {
|
function facebookHeader($photoID) {
|
||||||
$database = dbConnect();
|
$database = dbConnect();
|
||||||
@ -691,7 +720,7 @@ function facebookHeader($photoID) {
|
|||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
function isPhotoPublic($photoID) {
|
function isPhotoPublic($photoID, $password) {
|
||||||
global $database;
|
global $database;
|
||||||
$photoID = mysqli_real_escape_string($database, $photoID);
|
$photoID = mysqli_real_escape_string($database, $photoID);
|
||||||
if(is_numeric($photoID)) {
|
if(is_numeric($photoID)) {
|
||||||
@ -702,16 +731,13 @@ function isPhotoPublic($photoID) {
|
|||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$row = $result->fetch_object();
|
$row = $result->fetch_object();
|
||||||
if (!is_numeric($photoID)&&!$row) return true;
|
if (!is_numeric($photoID)&&!$row) return true;
|
||||||
if($row->public == 1) {
|
if($row->public == 1) return true;
|
||||||
return true;
|
else return isAlbumPublic($row->album, $password);
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search Function
|
// Search Function
|
||||||
function search($term) {
|
function search($term) {
|
||||||
global $database;
|
global $database, $sorting;
|
||||||
$term = mysqli_real_escape_string($database, $term);
|
$term = mysqli_real_escape_string($database, $term);
|
||||||
|
|
||||||
$query = "SELECT * FROM lychee_photos WHERE title like '%$term%' OR description like '%$term%';";
|
$query = "SELECT * FROM lychee_photos WHERE title like '%$term%' OR description like '%$term%';";
|
||||||
@ -725,7 +751,7 @@ function search($term) {
|
|||||||
$i=0;
|
$i=0;
|
||||||
while($row = $result->fetch_array()) {
|
while($row = $result->fetch_array()) {
|
||||||
$return['albums'][$i] = $row;
|
$return['albums'][$i] = $row;
|
||||||
$query2 = "SELECT thumbUrl FROM lychee_photos WHERE album = '".$row['id']."' ORDER BY id DESC LIMIT 0, 3;";
|
$query2 = "SELECT thumbUrl FROM lychee_photos WHERE album = '".$row['id']."' ORDER BY id $sorting LIMIT 0, 3;";
|
||||||
$result2 = $database->query($query2);
|
$result2 = $database->query($query2);
|
||||||
$k = 0;
|
$k = 0;
|
||||||
while($row2 = $result2->fetch_object()){
|
while($row2 = $result2->fetch_object()){
|
||||||
|
16
php/update.php
Normal file
16
php/update.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
define('LYCHEE', true);
|
||||||
|
|
||||||
|
// Include
|
||||||
|
require('check.php');
|
||||||
|
|
||||||
|
if($error=='') {
|
||||||
|
if(!$database->query("SELECT `public` FROM `lychee_albums`;")) $database->query("ALTER TABLE `lychee_albums` ADD `public` TINYINT( 1 ) NOT NULL DEFAULT '0'");
|
||||||
|
if(!$database->query("SELECT `password` FROM `lychee_albums`;")) $database->query("ALTER TABLE `lychee_albums` ADD `password` VARCHAR( 100 ) NULL DEFAULT NULL");
|
||||||
|
echo "\nUpdate complete!";
|
||||||
|
} else {
|
||||||
|
echo "\nCould not Update!";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
121
readme.md
Normal file → Executable file
121
readme.md
Normal file → Executable file
@ -1,58 +1,63 @@
|
|||||||
# Lychee
|
# Lychee
|
||||||
|
|
||||||
#### A great looking and easy-to-use Photo-Management-System.
|
#### A great looking and easy-to-use Photo-Management-System.
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
Lychee is a free, easy to use and great looking photo-management-system you can run on your server to manage and share photos. Just download the source and follow the instructions to install Lychee wherever you want.
|
Lychee is a free, easy to use and great looking photo-management-system you can run on your server to manage and share photos. Just download the source and follow the instructions to install Lychee wherever you want.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
To run Lychee, everything you need is a web-server with PHP 5.3 or later and a MySQL-Database. Follow the instructions to install Lychee on your server. [Installation »](https://github.com/electerious/Lychee/wiki/Installation)
|
To run Lychee, everything you need is a web-server with PHP 5.3 or later and a MySQL-Database. Follow the instructions to install Lychee on your server. [Installation »](https://github.com/electerious/Lychee/wiki/Installation)
|
||||||
|
|
||||||
## Settings
|
## Settings
|
||||||
|
|
||||||
Settings are located inside the `php/config.php`. All settings are optional and doesn't need to be changed. [Settings »](https://github.com/electerious/Lychee/wiki/Settings)
|
Settings are located inside the `php/config.php`. All settings are optional and doesn't need to be changed. [Settings »](https://github.com/electerious/Lychee/wiki/Settings)
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
After the configuration, navigate your browser to the place where Lychee is located. Everything should work now.
|
After the configuration, navigate your browser to the place where Lychee is located. Everything should work now.
|
||||||
|
|
||||||
#### FTP Upload
|
#### FTP Upload
|
||||||
|
|
||||||
You can upload photos directly with every FTP client into Lychee. This feature helps you to share single images quickly with others. [FTP Upload »](https://github.com/electerious/Lychee/wiki/FTP-Upload)
|
You can upload photos directly with every FTP client into Lychee. This feature helps you to share single images quickly with others. [FTP Upload »](https://github.com/electerious/Lychee/wiki/FTP-Upload)
|
||||||
|
|
||||||
#### Keyboard Shortcuts
|
#### Keyboard Shortcuts
|
||||||
|
|
||||||
This shortcuts will help you to use Lychee even faster. [Keyboard Shortcuts »](https://github.com/electerious/Lychee/wiki/Keyboard-Shortcuts)
|
This shortcuts will help you to use Lychee even faster. [Keyboard Shortcuts »](https://github.com/electerious/Lychee/wiki/Keyboard-Shortcuts)
|
||||||
|
|
||||||
## Browser Support
|
## Browser Support
|
||||||
|
|
||||||
Lychee supports the latest versions of Google Chrome, Apple Safari and Mozilla Firefox. Photos you share with others can be viewed from every browser. For the best experience we are recommending to use Google Chrome or Apple Safari.
|
Lychee supports the latest versions of Google Chrome, Apple Safari and Mozilla Firefox. Photos you share with others can be viewed from every browser. For the best experience we are recommending to use Google Chrome or Apple Safari.
|
||||||
|
|
||||||
## Update
|
## Update
|
||||||
|
|
||||||
To update Lychee, simply replace all files, excluding the following ones:
|
####From version 1.0/1.1 to 1.2:
|
||||||
`uploads/`, `php/config.php`
|
1. Replace all files, excluding `uploads/`
|
||||||
|
2. Open `php/config.php` and reconfigure your installation
|
||||||
## Troubleshooting
|
3. Open `php/update.php` in your browser
|
||||||
|
|
||||||
If Lychee is not working properly, try to open `php/check.php`. This file will take a look at your configuration and displays all errors it can find. Everything should work if you can see the message "Lychee is ready!".
|
####From version 1.2 to 1.2.x:
|
||||||
|
Replace all files, excluding `uploads/` and `php/config.php`.
|
||||||
## About
|
|
||||||
|
## Troubleshooting
|
||||||
Lychee is made by [Tobias Reich](http://electerious.com) (HTML, CSS, JS, Design, Website Design and Development) with the help of [Philipp Maurer](http://phinal.net) (PHP, MySQL).
|
|
||||||
|
If Lychee is not working properly, try to open `php/check.php`. This file will take a look at your configuration and displays all errors it can find. Everything should work if you can see the message "Lychee is ready!".
|
||||||
##License
|
|
||||||
|
## About
|
||||||
(MIT License)
|
|
||||||
|
Lychee is made by [Tobias Reich](http://electerious.com) (HTML, CSS, JS, Design, Website Design and Development) with the help of [Philipp Maurer](http://phinal.net) (PHP, MySQL).
|
||||||
Copyright (C) 2013 [Tobias Reich](http://electerious.com)
|
|
||||||
Copyright (C) 2013 [Philipp Maurer](http://phinal.net)
|
##License
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
(MIT License)
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
Copyright (C) 2013 [Tobias Reich](http://electerious.com)
|
||||||
|
Copyright (C) 2013 [Philipp Maurer](http://phinal.net)
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
16
view.php
16
view.php
@ -19,18 +19,18 @@
|
|||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if(isset($_GET['p'])) {
|
if(isset($_GET['p'])) {
|
||||||
|
|
||||||
define("LYCHEE", true);
|
define("LYCHEE", true);
|
||||||
|
|
||||||
include("php/config.php");
|
require("php/config.php");
|
||||||
include("php/functions.php");
|
require("php/functions.php");
|
||||||
|
|
||||||
echo facebookHeader($_GET['p']);
|
echo facebookHeader($_GET['p']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
Loading…
Reference in New Issue
Block a user