Browse Source

V1.0.2

- Better mobile experience
- New Login
- jQuery update
- Small fixes and enhancements
Tobias Reich 11 years ago
parent
commit
b565390419
15 changed files with 370 additions and 307 deletions
  1. 42 0
      css/animations.css
  2. 58 42
      css/font-awesome.css
  3. 6 6
      index.html
  4. 41 41
      js/build.js
  5. 0 1
      js/frameworks.js
  6. 90 88
      js/functions.js
  7. 40 36
      js/main.js
  8. 19 19
      js/upload.js
  9. 9 9
      js/view.js
  10. 26 26
      php/api.php
  11. 31 31
      php/functions.php
  12. 2 2
      readme.md
  13. 0 0
      uploads/big/empty.md
  14. 0 0
      uploads/thumb/empty.md
  15. 6 6
      view.php

+ 42 - 0
css/animations.css

@@ -118,6 +118,48 @@
 	}
 }
 
+/* moveUp ------------------------------------------------*/
+@-webkit-keyframes moveUp {
+	0% {
+		-webkit-transform: translateY(1000px);
+	}
+	100% {
+		-webkit-transform: translateY(0px);
+	}
+}
+@-moz-keyframes moveUp {
+	0% {
+		opacity: 0;
+	}
+	100% {
+		opacity: 1;
+	}
+}
+@-ms-keyframes moveUp {
+	0% {
+		-ms-transform: translateY(1000px);
+	}
+	100% {
+		-ms-transform: translateY(0px);
+	}
+}
+@-o-keyframes moveUp {
+	0% {
+		-o-transform: translateY(1000px);
+	}
+	100% {
+		-o-transform: translateY(0px);
+	}
+}
+@keyframes moveUp {
+	0% {
+		transform: translateY(1000px);
+	}
+	100% {
+		transform: translateY(0px);
+	}
+}
+
 /* moveDown ------------------------------------------------*/
 @-webkit-keyframes moveDown {
 	0% {

+ 58 - 42
css/font-awesome.css

@@ -9,10 +9,39 @@ table { border-collapse:collapse; border-spacing:0; }
 
 /* Screen behavior -------------------------------------------------*/
 @media only screen and (max-width: 900px) {
+
 	#title span { display: none; }
+	
 }
-@media only screen and (max-width: 600px) {
+@media only screen and (max-width: 640px) {
+
 	#title { display: none; }
+	
+	#button_move { display: none; }
+	
+	.center {
+		top: 0px !important;
+		left: 0px !important;
+	}
+	
+	.message {
+		position: fixed !important;
+		width: 100% !important;
+		height: 100% !important;
+		margin: 1px 0px 0px 0px !important;
+		border-radius: 0px !important;
+		
+		/* Animation */
+		-webkit-animation-name: moveUp !important;
+		-webkit-animation-duration: .3s !important;
+		-moz-animation-name: moveUp !important;
+		-moz-animation-duration: .3s !important;
+		-o-animation-name: moveUp !important;
+		-o-animation-duration: .3s !important;
+		animation-name: moveUp !important;
+		animation-duration: .3s !important;
+	}
+	
 }
 
 /* Basics -------------------------------------------------*/
@@ -60,7 +89,7 @@ body { background-color: #222; background-image: url(../img/background.jpg); fon
 	text-align: center;
     text-shadow: 0 -1px 0 #000;
 	background: #000;
-	box-shadow: 0 1px 2px hsla(0, 0%, 0%, .29);
+	box-shadow: 0 1px 2px hsla(0, 0%, 0%, .25);
 	border-radius: 3px;
 }
 .tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; }
@@ -349,7 +378,7 @@ header {
 	#tools_albums, #tools_album, #tools_photo {
 		display: none;
 	}
-	
+
 	/* Button Custom ------------------------------------------------*/
 	header .button.icon-refresh {
 		padding:  7px 10px 4px 10px;
@@ -399,7 +428,7 @@ header {
 	#search:focus {
 		box-shadow: 0px 1px 0px #555, inset 0px 0px 2px #333;
 		opacity: 1;
-		width: 180px;
+		width: 150px;
 	}
 
 	/* Tools ------------------------------------------------*/
@@ -690,14 +719,11 @@ header {
 		float: left;
 		width: 100%;
 		padding: 12px 0px;
-		background-color: rgba(0, 0, 0, .2);
 		color: #fff;
 		font-size: 16px;
 		font-weight: bold;
 		text-shadow: 0px -1px 0px #000;
 		text-align: center;
-		border-bottom: 1px solid #111;
-		box-shadow: 0px 1px 0px rgba(255,255,255,.2);
 	}
 	.message .close {
 		position: absolute;
@@ -710,16 +736,13 @@ header {
 	}
 	.message p {
 		float: left;
-		width: 470px;
+		width: 90%;
 		margin-top: 1px;
-		padding: 12px 15px 15px 15px;
+		padding: 12px 5% 15px 5%;
 		color: #eee;
 		font-size: 14px;
-		background-color: #555;
 		text-shadow: 0px -1px 0px #222;
 		line-height: 20px;
-		border-bottom: 1px solid #111;
-		box-shadow: 0px 1px 0px rgba(255,255,255,.1);
 	}
 	.message .button {
 		float: right;
@@ -743,6 +766,9 @@ header {
 		box-shadow: inset 0px 1px 0px rgba(255,255,255,.2), 0px 1px 0px rgba(255,255,255,.1);
 		cursor: pointer;
 	}
+	.message .button:first-of-type {
+		margin: 15px 5% 18px 0px !important;
+	}
 	.message .button.active {
 		color: #fff;
 		box-shadow: inset 0px 1px 0px rgba(255,255,255,.2), 0px 1px 0px rgba(255,255,255,.1), 0px 0px 5px #005ecc;
@@ -818,35 +844,25 @@ header {
 	/* Sign in ------------------------------------------------*/
 	.sign_in {
 		float: left;
-		width: 500px;
+		width: 100%;
 		margin-top: 1px;
-		padding: 20px 0px;
+		padding: 5px 0px;
 		color: #eee;
 		font-size: 14px;
-		background-color: #555;
 		text-shadow: 0px -1px 0px #222;
 		line-height: 20px;
-		border-bottom: 1px solid #111;
-		box-shadow: 0px 1px 0px rgba(255,255,255,.1);
-	}
-	.sign_in label {
-		float: left;
-		width: 20%;
-		margin: 6px 0px 0px 10%;
-	}
-	.sign_in label:first-of-type {
-		margin-bottom: 10px;
 	}
 	.sign_in input {
 		float: left;
-		width: 55%;
-		padding: 7px 10px 9px 10px;
+		width: 86%;
+		padding: 7px 2% 9px 2%;
+		margin: 0px 5%;
 		background-color: #444;
 		color: #fff;
 		text-shadow: 0px 1px 0px #222;
 		border: none;
 		border: 1px solid #111;
-		box-shadow: 0px 1px 0px #777;
+		box-shadow: 0px 1px 0px #555;
 		outline: none;
 		border-radius: 5px;
 	}
@@ -854,19 +870,19 @@ header {
 		margin-bottom: 10px;
 	}
 	.sign_in input:focus {
-		box-shadow: 0px 1px 0px #777, inset 0px 0px 3px #333, 0px 0px 5px #005ecc;
+		box-shadow: 0px 1px 0px #666, inset 0px 0px 3px #333, 0px 0px 5px #005ecc;
 	}
 	.sign_in input.error:focus {
-		box-shadow: 0px 1px 0px #777, inset 0px 0px 3px #333, 0px 0px 5px #cc0007;
+		box-shadow: 0px 1px 0px #666, inset 0px 0px 3px #333, 0px 0px 5px #cc0007;
 	}
 	.message #version {
 		display: inline-block;
 		margin-top: 23px;
-		margin-left: 19px;
+		margin-left: 5%;
 		color: #888;
 		text-shadow: 0px -1px 0px #111;
 	}
-	
+
 	/* Sign in ------------------------------------------------*/
 	.copylink {
 		float: left;
@@ -904,7 +920,7 @@ header {
 	background-position: 50% 50%;
 	background-size: contain;
 	-webkit-transition: top .3s, bottom .3s, margin-top .3s;
-	
+
 	-webkit-animation-name: zoomIn;
 	-webkit-animation-duration: .3s;
 	-webkit-animation-fill-mode: forwards;
@@ -924,7 +940,7 @@ header {
 	bottom: auto;
 	left: 50%;
 }
-	
+
 	/* Previous/Next Buttons ------------------------------------------------*/
 	#image_view a {
 		position: fixed;
@@ -948,7 +964,7 @@ header {
 		right: 20px;
 		-webkit-transition: right .3s
 	}
-	
+
 	/* InfoBox ------------------------------------------------*/
 	#infobox_overlay {
 		z-index: 2;
@@ -978,12 +994,12 @@ header {
 		background-color: rgba(20,20,20,0.98);
 		box-shadow: -1px 0px 2px #000;
 		display: none;
-		
+
 		-webkit-user-select: text;
 		-moz-user-select: text;
 		-o-user-select: text;
 		user-select: text;
-		
+
 		-webkit-transition: right .5s ease-out;
 		-moz-transition: right .5s;
 		-o-transition: right .5s;
@@ -998,7 +1014,7 @@ header {
 		float: left;
 		height: 41px;
 		width: 100%;
-	
+
 		background-color: #1d1d1d;
 		background-image: -webkit-gradient(linear, left top, left bottom, from(#1d1d1d), to(#050505));
 		background-image: -webkit-linear-gradient(top, #1d1d1d, #050505);
@@ -1006,7 +1022,7 @@ header {
 		background-image: -o-linear-gradient(top, #1d1d1d, #050505);
 		background-image: -ms-linear-gradient(top, #1d1d1d, #050505);
 		background-image: linear-gradient(top, #1d1d1d, #050505);
-	
+
 		box-shadow: inset 0px 1px 0px #111, inset 0px -1px 0px #000;
 		border-top: 1px solid #000;
 	}
@@ -1207,7 +1223,7 @@ header {
 	font-size: 80px;
 	text-shadow: 0px 1px 2px #000;
 	z-index: 2;
-	
+
 	/* Animation */
 	-webkit-animation-name: pulse;
 	-webkit-animation-duration: 2s;
@@ -1249,7 +1265,7 @@ header {
 	border: 1px solid #000;
 	box-shadow: 0 1px 0 rgba(255,255,255,.2), inset 0px 0px 2px #111;
 	border-radius: 5px;
-	
+
 	/* Animation */
 	-webkit-animation-name: moveBackground;
 	-webkit-animation-duration: .6s;
@@ -1281,7 +1297,7 @@ header {
 	background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(241,241,241,1) 50%,rgba(225,225,225,1) 51%,rgba(246,246,246,1) 100%); /* IE10+ */
 	background: linear-gradient(top, rgba(255,255,255,1) 0%,rgba(241,241,241,1) 50%,rgba(225,225,225,1) 51%,rgba(246,246,246,1) 100%); /* W3C */
 	border-radius: 5px;
-	
+
 	-webkit-transition: width .2s;
 	-moz-transition: width .2s;
 	-o-transition: width .2s;

+ 6 - 6
index.html

@@ -3,7 +3,7 @@
 	<head>
 
 		<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
-		<title></title>
+		<title>Lychee</title>
 
 		<meta name="author" content="Tobias Reich, Philipp Maurer">
 		<meta name="keywords" content="">
@@ -16,7 +16,7 @@
 
 		<link rel="apple-touch-icon-precomposed" href="img/apple-touch-icon.png">
 		<meta name="apple-mobile-web-app-status-bar-style" content="black" >
-		<meta name="viewport" content="width=device-width, user-scalable=no">
+		<meta name="viewport" content="user-scalable=no, initial-scale=1">
 		<meta name="apple-mobile-web-app-capable" content="yes">
 
 	</head>
@@ -24,7 +24,7 @@
 
 	<!-- Loading -->
 	<div id="loading"></div>
-	
+
 	<!-- Header -->
 	<header>
 
@@ -66,17 +66,17 @@
 
 	<!-- ImageView -->
 	<div id="image_view"></div>
-	
+
 	<!-- Infobox -->
 	<div id="infobox"></div>
-	
+
 	<!-- Upload -->
 	<div id="upload">
 		<input id="upload_files" type="file" name="fileElem[]" multiple="true" accept="image/*">
 		<div id="auswahl"></div>
 		<input id="upload_button" type="button" onclick="sendFiles();" value="Upload">
 	</div>
-	
+
 	<!-- JS -->
 	<script type="text/javascript" src="js/frameworks.js"></script>
 	<script type="text/javascript" src="js/upload.js"></script>

+ 41 - 41
js/build.js

@@ -6,7 +6,7 @@
  */
 
 /*
-	Build Functions 
+	Build Functions
 	This functions are used to generate HTML-Code.
 */
 
@@ -34,13 +34,13 @@ function buildAlbum(albumJSON) {
 	album += 		"<h1>" + albumJSON.title + "</h1>";
 	album += 		"<a>" + albumJSON.sysdate + "</a>";
 	album += 	"</div>";
-	
+
 	if(albumJSON.star=="1") album += "<a class='badge red icon-star'></a>";
 	if(albumJSON.public=="1") album += "<a class='badge red icon-rss'></a>";
 	if(albumJSON.unsorted=="1") album += "<a class='badge red icon-reorder'></a>";
-	
+
 	album += "</div>";
-	
+
 	return album;
 
 }
@@ -59,12 +59,12 @@ function buildPhoto(photoJSON) {
 	photo += 		"<h1>" + photoJSON.title + "</h1>";
 	photo += 		"<a>" + photoJSON.sysdate + "</a>";
 	photo += 	"</div>";
-	
+
 	if(photoJSON.star=="1") photo += "<a class='badge red icon-star'></a>";
 	if(photoJSON.public=="1") photo += "<a class='badge red icon-rss'></a>";
 
 	photo += "</div>";
-	
+
 	return photo;
 
 }
@@ -77,33 +77,33 @@ function buildModal(title, text, button, func) {
 	modal += 		"<h1>" + title + "</h1>";
 	modal += 		"<a class='close icon-remove-sign'></a>";
 	modal += 		"<p>" + text + "</p>";
-	
+
 	$.each(button, function(index) {
 
 	if (index==0) modal += "<a onclick='message_click(" + index + ")' class='button active'>" + this + "</a>";
 	else modal += "<a onclick='message_click(" + index + ")' class='button'>" + this + "</a>";
-	
+
 	});
-	
+
 	modal += 	"</div>";
-	
+
 	modal += 	"<script>";
 	modal += 		"function message_click(action) {";
 	modal += 		"switch (action) {";
-	
+
 	$.each(func, function(index) {
-	
+
 	modal +=			"case " + index + ":";
 	modal +=			this.toString();
 	modal +=			"break;";
-	
+
 	});
-	
+
 	modal +=		"} closeModal(); }";
 	modal += 	"</script>";
-	
+
 	modal += "</div>";
-	
+
 	return modal;
 
 }
@@ -123,9 +123,9 @@ function buildAddModal() {
 	modal +=			"<div class='icon icon-picture'></div>";
 	modal +=			"<a>Upload new Photo</a>";
 	modal +=		"</div>";
-	modal += 	"</div>";	
+	modal += 	"</div>";
 	modal += "</div>";
-	
+
 	return modal;
 
 }
@@ -137,14 +137,14 @@ function buildSignInModal() {
 	modal += 	"<div class='message center'>";
 	modal += 		"<h1><a class='icon-lock'></a> Sign in</h1>";
 	modal += 		"<div class='sign_in'>";
-	modal += 			"<label>Username:</label><input id='username' type='text' name='' value=''>";
-	modal += 			"<label>Password:</label><input id='password' type='password' name='' value=''>";
+	modal += 			"<input id='username' type='text' name='' value='' placeholder='username'>";
+	modal += 			"<input id='password' type='password' name='' value='' placeholder='password'>";
 	modal += 		"</div>";
 	modal +=	"<div id='version'>Version " + version + "</div>";
 	modal += 	"<a onclick='login()' class='button active'>Sign in</a>";
 	modal += 	"</div>";
 	modal += "</div>";
-	
+
 	return modal;
 
 }
@@ -158,33 +158,33 @@ function buildUploadModal() {
 	modal += 		"<div class='progressbar'><div></div></div>";
 	modal += 	"</div>";
 	modal += "</div>";
-	
+
 	return modal;
 
 }
 
 function buildContextMenu(items) {
-	
+
 	var menu = "";
 	menu += "<div class='contextmenu_bg'></div>";
 	menu += "<div class='contextmenu'>";
 	menu +=		"<table>";
 	menu +=			"<tbody>";
-	
+
 	$.each(items, function(index) {
-	
+
 		if (items[index][1].length!=0) {
 			menu += "<tr><td onclick='" + items[index][1] + "; closeContextMenu();'>" + items[index][0] + "</td></tr>";
 		}
-	
+
 	});
-	
+
 	menu +=			"</tbody>";
 	menu +=		"</table>";
 	menu +=	"</div>";
-	
+
 	return menu;
-	
+
 }
 
 function buildInfobox(photo) {
@@ -192,9 +192,9 @@ function buildInfobox(photo) {
 	var infobox = "";
 	infobox += "<div class='header'><h1>About</h1><a class='icon-remove-sign'></a></div>";
 	infobox += "<div class='wrapper'>";
-	
+
 	if (photo.public==1) photo.public = "Public"; else photo.public = "Private";
-	
+
 	infos = [
 		["", "Basics"],
 		["Name", photo.title],
@@ -216,32 +216,32 @@ function buildInfobox(photo) {
 		["Privacy", photo.public],
 		["Short Link", photo.shortlink]
 	];
-		
+
 	$.each(infos, function(index) {
-	
+
 		if (infos[index][1]==""||infos[index][1]==undefined||infos[index][1]==null) infos[index][1] = "-";
-		
+
 		if (infos[index][0]=="") {
-		
+
 			infobox += "</table>";
 			infobox += "<div class='separater'><h1>" + infos[index][1] + "</h1></div>";
 			infobox += "<table id='infos'>";
-		
+
 		} else {
-		
+
 			infobox += 	"<tr>";
 			infobox +=  	"<td>" + infos[index][0] + "</td>";
 			infobox +=  	"<td>" + infos[index][1] + "</td>";
 			infobox += 	"</tr>";
-		
+
 		}
-		
+
 	});
-	
+
 	infobox += "</table>";
 	infobox += "<div class='bumper'></div>";
 	infobox += "</div>";
-	
+
 	return infobox;
 
 }

File diff suppressed because it is too large
+ 0 - 1
js/frameworks.js


+ 90 - 88
js/functions.js

@@ -13,7 +13,7 @@
 function init() {
 
 	$("#tools_albums").show();
-	$(".tools").tipsy({gravity: 'n'});
+	if (!mobileBrowser()) $(".tools").tipsy({gravity: 'n'});
 	params = "function=loggedIn";
 	$.ajax({type: "POST", url: api_path, data: params, success: function(data) {
 		if (data!=1) {
@@ -23,7 +23,7 @@ function init() {
 			if (headerTitle.html().length<1&&BrowserDetect.browser=="Firefox") getURL();
 		}
 	}});
-	
+
 }
 
 /*
@@ -71,36 +71,38 @@ function getURL() {
 
 	closeContextMenu();
 	hash = document.location.hash.replace("#", "");
-	
+
 	albumID = "";
 	photoID = "";
-	
+
 	if (hash.indexOf("a")!=-1) albumID = hash.split("p")[0].replace("a", "");
 	if (hash.indexOf("p")!=-1) photoID = hash.split("p")[1];
 
 	if (hash=="upload") {
-	
+
 		loadAlbums();
 		$("body").append(buildAddModal);
-	
+
 	} else if (albumID&&photoID) {
-	
-		content.hide();
+
+		if (content.html()=="") {
+			content.hide();
+			loadPhotos(albumID, true);
+		}
 		showImageview(photoID);
-		if (content.html()=="") loadPhotos(albumID, true);
-	
+
 	} else if (albumID) {
-	
+
 		if (!visibleControls()) showControls();
 		if (visibleImageview()) hideImageview();
 		else loadPhotos(albumID, false);
-		
+
 	} else {
-	
+
 		loadAlbums();
-	
+
 	}
-	
+
 }
 
 /*
@@ -260,7 +262,7 @@ function showContextMenuPhoto(photoID, mouse_x, mouse_y) {
 		["Move to Album", "showContextMenuMove(" + photoID + ", " + (mouse_x+150) + ", " + (mouse_y+$(document).scrollTop()) + ")"],
 		["Delete", "deletePhoto(" + photoID + ")"]
 	];
-	
+
 	closeContextMenu();
 	$("body").css("overflow", "hidden");
 	$(".photo[data-id='" + photoID + "']").addClass("active");
@@ -269,15 +271,15 @@ function showContextMenuPhoto(photoID, mouse_x, mouse_y) {
 		"top": mouse_y,
 		"left": mouse_x
 	});
-	
+
 }
 function showContextMenuMove(photoID, mouse_x, mouse_y) {
 
 	mouse_y -= $(document).scrollTop();
-	
+
 	params = "function=getAlbums";
 	$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
-	
+
 		if (content.attr("data-id")==0) {
 			items = new Array();
 		} else {
@@ -285,7 +287,7 @@ function showContextMenuMove(photoID, mouse_x, mouse_y) {
 				["Unsorted", "loadMovePhoto(" + photoID + ", 0)"]
 			];
 		}
-		
+
 		$.each(data, function(index) {
 			if (this.id!=content.attr("data-id")) {
 				if(!this.title) this.title = "Untitled";
@@ -294,13 +296,13 @@ function showContextMenuMove(photoID, mouse_x, mouse_y) {
 				items[items.length] = new Array("", "");
 			}
 		});
-		
+
 		if (items.length==0) {
 			items = [
 				["Create new Album", "addAlbum()"]
 			];
 		}
-		
+
 		closeContextMenu();
 		$("body").css("overflow", "hidden");
 		$(".photo[data-id='" + photoID + "']").addClass("active");
@@ -309,14 +311,14 @@ function showContextMenuMove(photoID, mouse_x, mouse_y) {
 			"top": mouse_y,
 			"left": mouse_x-150
 		});
-		
+
 	}, error: ajaxError });
-		
+
 }
 function showContextMenuShare(photoID, mouse_x, mouse_y) {
 
 	mouse_y -= $(document).scrollTop();
-	
+
 	items = [
 		["<a class='icon-eye-close'></a> Make Private", "setPhotoPublic()"],
 		["<a class='icon-twitter'></a> Twitter", "loadSharePhoto(0, " + photoID + ")"],
@@ -327,7 +329,7 @@ function showContextMenuShare(photoID, mouse_x, mouse_y) {
 		["<a class='icon-link'></a> Copy Link", "loadSharePhoto(5, " + photoID + ")"],
 		["<a class='icon-link'></a> Copy Shortlink", "loadSharePhoto(6, " + photoID + ")"]
 	];
-			
+
 	closeContextMenu();
 	$("body").css("overflow", "hidden");
 	$(".photo[data-id='" + photoID + "']").addClass("active");
@@ -336,7 +338,7 @@ function showContextMenuShare(photoID, mouse_x, mouse_y) {
 		"top": mouse_y,
 		"left": mouse_x
 	});
-				
+
 }
 function closeContextMenu() {
 	$(".contextmenu_bg, .contextmenu").remove();
@@ -393,7 +395,7 @@ function isPhotoSmall(photo) {
 
 	if (photo.width<$(window).width()-60) size["width"] = true;
 	if (photo.height<$(window).height()-100) size["height"] = true;
-	
+
 	if (size["width"]&&size["height"]) return true;
 	else return false;
 
@@ -407,9 +409,9 @@ function isPhotoSmall(photo) {
 function key(e) {
 
 	code = (e.keyCode ? e.keyCode : e.which);
-	
+
 	if (code==13||code==37||code==39||code==32||code==27) e.preventDefault();
-	
+
 	if (code==13&&$(".message .button.active").length) $(".message .button.active").addClass("pressed").click();
 	if (code==37&&visibleImageview()) loadPreviousPhoto();
 	if (code==39&&visibleImageview()) loadNextPhoto();
@@ -483,13 +485,13 @@ function renameAlbum() {
 function renamePhoto(photoID) {
 
 	if (photoID==undefined) {
-	
+
 		// Function called from ImageViewer
 		oldTitle = headerTitle.html();
 		photoID = image_view.attr("data-id");
-		
+
 	} else oldTitle = "";
-	
+
 	newTitle = prompt("Please enter a new title for this photo:", oldTitle);
 
 	if (photoID!=null&&photoID!=undefined&&newTitle.length<31) {
@@ -518,15 +520,15 @@ function loadAlbums() {
 
 	loadingFadeIn("loading");
 	$(".album, .photo").removeClass("contentZoomIn").addClass("contentZoomOut");
-	
+
 	startTime = new Date().getTime();
 
 	params = "function=getAlbums";
 	$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
-	
+
 		durationTime = (new Date().getTime() - startTime);
 		if (durationTime>300) waitTime = 0; else waitTime = 300 - durationTime;
-		
+
 		$.timer(waitTime,function(){
 
 			$("#tools_album, #tools_photo").hide();
@@ -561,16 +563,16 @@ function loadAlbums() {
 				albums = "";
 				$.each(data, function() { albums += buildAlbum(this); });
 				content.append(buildDivider("Albums") + albums);
-	
+
 				$(".album, .photo").removeClass("contentZoomOut").addClass("contentZoomIn");
-			
+
 			}
 
 			document.title = "Lychee";
 			headerTitle.html("Albums").removeClass("editable");
 
 			loadSmartAlbums();
-			
+
 		});
 
 	}, error: ajaxError });
@@ -581,24 +583,24 @@ function loadSmartAlbums() {
 
 	params = "function=getSmartInfo";
 	$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
-			
+
 		$(".album[data-id='0'] img:nth-child(1)").attr("src", data.unsortThumb2);
 		$(".album[data-id='0'] img:nth-child(2)").attr("src", data.unsortThumb1);
 		$(".album[data-id='0'] img:nth-child(3)").attr("src", data.unsortThumb0);
 		$(".album[data-id='0'] .overlay a").html(data.unsortNum + " photos");
-		
+
 		$(".album[data-id='s'] img:nth-child(1)").attr("src", data.publicThumb2);
 		$(".album[data-id='s'] img:nth-child(2)").attr("src", data.publicThumb1);
 		$(".album[data-id='s'] img:nth-child(3)").attr("src", data.publicThumb0);
 		$(".album[data-id='s'] .overlay a").html(data.publicNum + " photos");
-		
+
 		$(".album[data-id='f'] img:nth-child(1)").attr("src", data.starredThumb2);
 		$(".album[data-id='f'] img:nth-child(2)").attr("src", data.starredThumb1);
 		$(".album[data-id='f'] img:nth-child(3)").attr("src", data.starredThumb0);
 		$(".album[data-id='f'] .overlay a").html(data.starredNum + " photos");
-		
+
 		loadingFadeOut();
-	
+
 	}, error: ajaxError });
 
 }
@@ -613,15 +615,15 @@ function loadPhotos(albumID, refresh) {
 		$(".album, .photo").removeClass("contentZoomIn").addClass("contentZoomOut");
 		$(".divider").removeClass("fadeIn").addClass("fadeOut");
 	}
-	
+
 	startTime = new Date().getTime();
-	
+
 	params = "function=getPhotos&albumID=" + albumID;
 	$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
-	
+
 		durationTime = (new Date().getTime() - startTime);
 		if (durationTime>300) waitTime = 0; else if (refresh) waitTime = 0; else waitTime = 300 - durationTime;
-		
+
 		$.timer(waitTime,function(){
 
 			content.attr("data-id", albumID);
@@ -639,7 +641,7 @@ function loadPhotos(albumID, refresh) {
 				loadAlbumInfo(albumID);
 
 			}
-		
+
 		});
 
 	}, error: ajaxError });
@@ -649,10 +651,10 @@ function loadPhotos(albumID, refresh) {
 function loadAlbumInfo(albumID) {
 
 	if (albumID=="f"||albumID=="s"||albumID==0) {
-	
+
 		params = "function=getSmartInfo";
 		$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
-		
+
 			switch (albumID) {
 				case "f":
 					document.title = "Lychee - Starred";
@@ -662,7 +664,7 @@ function loadAlbumInfo(albumID) {
 				case "s":
 					document.title = "Lychee - Public";
 					headerTitle.html("Public<span> - " + data.publicNum + " photos</span>");
-					$("#button_edit_album, #button_trash_album .button_divider").hide();
+					$("#button_edit_album, #button_trash_album, .button_divider").hide();
 					break;
 				case "0":
 					document.title = "Lychee - Unsorted";
@@ -671,27 +673,27 @@ function loadAlbumInfo(albumID) {
 					$("#button_trash_album, .button_divider").show();
 					break;
 			}
-			
+
 			loadingFadeOut();
-			
+
 		}, error: ajaxError });
-	
+
 	} else {
-	
+
 		params = "function=getAlbumInfo&albumID=" + albumID;
 		$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
-		
+
 			$("#button_edit_album, #button_trash_album, .button_divider").show();
-	
+
 			if (!data.title) data.title = "Untitled";
 			document.title = "Lychee - " + data.title;
 			headerTitle.html(data.title + "<span> - " + data.num + " photos</span>").addClass("editable");
-	
+
 			loadingFadeOut();
-	
+
 		}, error: ajaxError });
-	
-	}	
+
+	}
 
 }
 
@@ -730,13 +732,13 @@ function loadPhotoInfo(photoID) {
 		else if (isPhotoSmall(data)) image_view.html("").append("<a id='previous' style='left: -50px' class='icon-caret-left'></a><a id='next' style='right: -50px' class='icon-caret-right'></a><div id='image' class='small' style='background-image: url(" + data.url + "); width: " + data.width + "px; height: " + data.height + "px; margin-top: -" + parseInt(data.height/2) + "px; margin-left: -" + data.width/2 + "px;'></div>");
 		else image_view.html("").append("<a id='previous' style='left: -50px' class='icon-caret-left'></a><a id='next' style='right: -50px' class='icon-caret-right'></a><div id='image' style='background-image: url(" + data.url + "); top: 0px; right: 0px; bottom: 0px; left: 0px;'></div>");
 		image_view.removeClass("fadeOut").addClass("fadeIn").show();
-		
+
 		if (!visibleControls()) hideControls(true);
-		
+
 		infobox.html(buildInfobox(data)).show();
-		
+
 		$.timer(300,function(){ content.show(); });
-		
+
 		loadingFadeOut();
 
 	}, error: ajaxError });
@@ -801,12 +803,12 @@ function setPhotoPublic(e) {
 }
 
 function setPhotoDescription() {
-	
+
 	description = prompt("Please enter a description for this photo:", "");
 	photoID = image_view.attr("data-id");
-	
+
 	if (description.length>0&&description.length<160) {
-	
+
 		loadingFadeIn("loading");
 
 		params = "function=setPhotoDescription&photoID=" + photoID + "&description=" + escape(description);
@@ -859,7 +861,7 @@ function loadSharePhoto(service, photoID) {
 
 	params = "function=sharePhoto&photoID=" + photoID + "&url=" + getViewLink(photoID);
 	$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
-	
+
 		switch (service) {
 			case 0:
 				link = data.twitter;
@@ -898,7 +900,7 @@ function loadSharePhoto(service, photoID) {
 			location.href = link;
 			loadingFadeOut();
 		} else loadingFadeIn("error");
-		
+
 	}, error: ajaxError });
 
 }
@@ -937,12 +939,12 @@ function loadPreviousPhoto() {
 
 	albumID = content.attr("data-id");
 	photoID = image_view.attr("data-id");
-	
+
 	params = "function=previousPhoto&photoID=" + photoID + "&albumID=" + albumID;
 	$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
-	
+
 		if (data!=false) setURL("a" + albumID + "p" + data.id);
-	
+
 	}, error: ajaxError });
 
 }
@@ -951,7 +953,7 @@ function loadNextPhoto() {
 
 	albumID = content.attr("data-id");
 	photoID = image_view.attr("data-id");
-	
+
 	params = "function=nextPhoto&photoID=" + photoID + "&albumID=" + albumID;
 	$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
 
@@ -977,19 +979,19 @@ function search(term) {
 
 	clearTimeout($(window).data("timeout"));
 	$(window).data("timeout", setTimeout(function() {
-	
+
 		if ($("#search").val().length<=2) {
-		
+
 			$(".divider").removeClass("fadeIn").addClass("fadeOut");
 			loadAlbums();
-			
+
 		} else {
-		
+
 			$(".album, .photo").removeClass("contentZoomIn").addClass("contentZoomOut");
 			$(".divider").removeClass("fadeIn").addClass("fadeOut");
-			
+
 			startTime = new Date().getTime();
-		
+
 			params = "function=search&term=" + term;
 			$.ajax({type: "POST", url: api_path, data: params, dataType: "json", success: function(data) {
 				console.log(data);
@@ -998,12 +1000,12 @@ function search(term) {
 
 				photos = "";
 				if (data.photos!=undefined&&data.photos!=null) $.each(data.photos, function() { photos += buildPhoto(this); });
-		
+
 				durationTime = (new Date().getTime() - startTime);
 				if (durationTime>300) waitTime = 0; else waitTime = 300 - durationTime;
-				
+
 				$.timer(waitTime,function(){
-				
+
 					if (albums==""&&photos=="") code = "";
 					else if (albums=="") code = buildDivider("Photos")+photos;
 					else if (photos=="") code = buildDivider("Albums")+albums;
@@ -1012,13 +1014,13 @@ function search(term) {
 					content.html("").append(code);
 
 					$(".album, .photo").removeClass("contentZoomOut").addClass("contentZoomIn");
-					
+
 				});
-		
+
 			}, error: ajaxError });
-		
+
 		}
-		
+
 	}, 250));
 
 }

+ 40 - 36
js/main.js

@@ -12,70 +12,74 @@ var header = $("header"),
 	loading = $("#loading"),
 	infobox = $("#infobox"),
 	api_path = "php/api.php",
-	version = "1.0.1";
+	version = "1.0.2";
 
 $(document).ready(function(){
 
+	/* Event Name */
+	if (mobileBrowser()) event_name = "touchend";
+	else event_name = "click";
+
 	/* Login */
 	$("#password").live("keyup", function() {
 		if ($(this).val().length>0) $(this).removeClass("error");
 	});
 
 	/* Add Dialog */
-	$(".button_add").live("click", function() { $("body").append(buildAddModal) });
-	$("#add_album").live("click", addAlbum);
-	$("#add_photo").live("click", function() { $("#auswahl").html(""); $("#upload_files").click() });
+	$(".button_add").live(event_name, function() { $("body").append(buildAddModal) });
+	$("#add_album").live(event_name, addAlbum);
+	$("#add_photo").live(event_name, function() { $("#auswahl").html(""); $("#upload_files").click() });
 
 	/* Toolbar Buttons */
-	$("#button_signout").live("click", function() {
+	$("#button_signout").live(event_name, function() {
 		modal = buildModal("Sign Out", "Are you sure you want to leave and log out?", ["Sign out", "Stay here"], ["logout();", ""]);
 		$("body").append(modal);
 	});
-	$("#button_download").live("click", function() {
+	$("#button_download").live(event_name, function() {
 		link = $("#image_view #image").css("background-image").replace(/"/g,"").replace(/url\(|\)$/ig, "");
 		window.open(link,"_newtab");
 	});
-	$("#button_move").live("click", function(e) {
+	$("#button_move").live(event_name, function(e) {
 		showContextMenuMove(image_view.attr("data-id"), e.pageX, e.pageY);
 	});
-	$("#button_trash_album").live("click", function() { 
+	$("#button_trash_album").live(event_name, function() {
 		if (content.attr("data-id")=="0") deleteUnsorted();
 		else deleteAlbum();
 	});
-	$("#button_trash").live("click", function() { deletePhoto() });
-	$("#button_edit_album").live("click", function() { renameAlbum() });
-	$("#button_edit").live("click", function() { renamePhoto() });
-	$("#button_info").live("click", function() { showInfobox() });
-	$("#button_archive").live("click", function() { getAlbumArchive() });
-	$("#button_sync").live("click", function() { syncFolder() });
+	$("#button_trash").live(event_name, function() { deletePhoto() });
+	$("#button_edit_album").live(event_name, function() { renameAlbum() });
+	$("#button_edit").live(event_name, function() { renamePhoto() });
+	$("#button_info").live(event_name, function() { showInfobox() });
+	$("#button_archive").live(event_name, function() { getAlbumArchive() });
+	$("#button_sync").live(event_name, function() { syncFolder() });
 
 	/* Rename Album/Photo via Titlebar */
-	$("#title.editable").live("click", function() {
+	$("#title.editable").live(event_name, function() {
 		if (visibleImageview()) renamePhoto(); else renameAlbum();
 	});
-	
+
 	/* Context Menu */
 	$(".photo").live("contextmenu", function(e) {
 		e.preventDefault();
 		showContextMenuPhoto($(this).attr("data-id"), e.pageX, e.pageY);
 	});
-	$(".contextmenu_bg").live("click", closeContextMenu);
+	$(".contextmenu_bg").live(event_name, closeContextMenu);
 
 	/* Star/Share Photo */
-	$("#button_star").live("click", setPhotoStar);
-	$("#button_share").live("click", function(e) {
+	$("#button_star").live(event_name, setPhotoStar);
+	$("#button_share").live(event_name, function(e) {
 		if ($("#button_share a.active").length) showContextMenuShare(image_view.attr("data-id"), e.pageX, e.pageY);
 		else setPhotoPublic(e);
 	});
-	$(".copylink").live("click", function() { $(this).select() });
-	
+	$(".copylink").live(event_name, function() { $(this).select() });
+
 	/* Upload */
 	$("#upload_files").live("change", function() {
 		closeModal();
 		handleFiles(this.files);
 		$("#upload_button").click();
 	});
-	
+
 	/* Search */
 	$("#search").live("keyup", function() { search($(this).val()) });
 
@@ -84,32 +88,32 @@ $(document).ready(function(){
 	$(".photo").live("click", function() { setURL("a" + content.attr("data-id") + "p" + $(this).attr("data-id")) });
 
 	/* Nav Back */
-	$("#button_back_home").live("click", function() { setURL("") });
-	$("#button_back").live("click", function() { setURL("a" + content.attr("data-id")) });
+	$("#button_back_home").live(event_name, function() { setURL("") });
+	$("#button_back").live(event_name, function() { setURL("a" + content.attr("data-id")) });
 
 	/* Close Modal */
-	$(".message a.close").live("click", closeModal);
+	$(".message a.close").live(event_name, closeModal);
 
 	/* Image View */
-	$("#image_view a#previous").live("click", loadPreviousPhoto);
-	$("#image_view a#next").live("click", loadNextPhoto);
-	
+	$("#image_view a#previous").live(event_name, loadPreviousPhoto);
+	$("#image_view a#next").live(event_name, loadNextPhoto);
+
 	/* Infobox */
-	$("#infobox_overlay, #infobox .header a").live("click", function() { hideInfobox() });
-	$("#edit_description").live("click", function() { setPhotoDescription() });
-	
+	$("#infobox_overlay, #infobox .header a").live(event_name, function() { hideInfobox() });
+	$("#edit_description").live(event_name, function() { setPhotoDescription() });
+
 	/* Window */
 	$(window).keydown(key);
 	$(window).bind("popstate", getURL);
 	$(window).bind("mouseleave", hideControls);
 	$(window).bind("mouseenter", showControls);
-	
+
 	/* Init */
-	if ((BrowserDetect.browser=="Explorer")||(BrowserDetect.browser=="Safari"&&BrowserDetect.version<5)||(BrowserDetect.browser=="Chrome"&&BrowserDetect.version<18)||(BrowserDetect.browser=="Firefox"&&BrowserDetect.version<14)) {
-		
+	if ((BrowserDetect.browser=="Explorer")||(BrowserDetect.browser=="Safari"&&BrowserDetect.version<5)||(BrowserDetect.browser=="Chrome"&&BrowserDetect.version<18)||(BrowserDetect.browser=="Firefox"&&BrowserDetect.version<15)) {
+
 		modal = buildModal("Browser not supported", "You are currently using an outdated or unsupported Browser. This site might not work properly. Please consider to update your Browser!", ["Leave"], ["location.href = 'http://browsehappy.com';"]);
 		$("body").append(modal);
-		
+
 	} else init();
-	
+
 });

+ 19 - 19
js/upload.js

@@ -16,23 +16,23 @@ function handleFiles(files) {
     var fileList = files;
 
     for(i = 0; i < fileList.length; i++) {
-        var img = document.createElement("img");    
+        var img = document.createElement("img");
         img.height = 0;
         img.file = fileList[i];
         img.name = 'pic_'+ i;
         img.classList.add("obj");
-        auswahl_div.appendChild(img);    
+        auswahl_div.appendChild(img);
     }
-    
+
 }
 
 function sendFiles(){
 
 	imgs = document.querySelectorAll(".obj");
-	
+
 	$(".upload_overlay").remove();
 	$("body").append(buildUploadModal());
-	
+
 	global_progress = new Array();
 	last_final_progress = 0;
 
@@ -40,38 +40,38 @@ function sendFiles(){
     	global_progress[i] = 0;
         new FileUpload(i, imgs[i], imgs[i].file);
     }
-    
+
 }
 
 function changeProgress(i, progress) {
 
 	global_progress[i] = progress;
 	final_progress = 0;
-	
+
 	for(i = 0; i < global_progress.length; i++) {
 		final_progress += global_progress[i];
 	}
-	
+
 	if (Math.round(final_progress/document.querySelectorAll(".obj").length)%2==0&&Math.round(last_final_progress/document.querySelectorAll(".obj").length)<Math.round(final_progress/document.querySelectorAll(".obj").length)) {
 		$(".progressbar div").css("width", Math.round(final_progress/document.querySelectorAll(".obj").length) + "%");
 	}
-	
+
 	last_final_progress = final_progress;
-	
+
 	if ((final_progress/document.querySelectorAll(".obj").length)>=100) {
-	
+
 		$(".progressbar div").css("width", "100%");
-	
+
 		$.timer(1000,function(){
-	
+
 			$(".upload_overlay").removeClass("fadeIn").css("opacity", 0);
 			$.timer(300,function(){ $(".upload_overlay").remove() });
-			
+
 			if (content.attr("data-id")=="") setURL("a0");
 			else loadPhotos(content.attr("data-id"));
-		
+
 		});
-		
+
 	}
 
 }
@@ -82,7 +82,7 @@ function FileUpload(i, img, file) {
 		xhr = new XMLHttpRequest(),
     	fd = new FormData,
     	percent = 0;
-    	
+
     this.xhr = xhr;
 
     this.xhr.upload.addEventListener("progress", function(e) {
@@ -94,9 +94,9 @@ function FileUpload(i, img, file) {
     fd.append("function", "upload");
     if (content.attr("data-id")=="") fd.append("albumID", 0);
     else fd.append("albumID", content.attr("data-id"));
-    
+
     xhr.open("POST", "php/api.php", true);
     xhr.overrideMimeType('text/plain; charset=x-user-defined-binary');
     xhr.send(fd);
-    
+
 }

+ 9 - 9
js/view.js

@@ -10,7 +10,7 @@ var header = $("header"),
 	image_view = $("#image_view"),
 	api_path = "php/api.php",
 	infobox = $("#infobox");
-	
+
 $(document).ready(function(){
 
 	/* Window */
@@ -25,9 +25,9 @@ $(document).ready(function(){
 		link = $("#image_view #image").css("background-image").replace(/"/g,"").replace(/url\(|\)$/ig, "");
 		window.open(link,"_newtab");
 	});
-	
+
 	loadPhotoInfo(gup("p"));
-	
+
 });
 
 function key(e) {
@@ -41,7 +41,7 @@ function visibleInfobox() {
 
 	if (parseInt(infobox.css("right").replace("px", ""))<0) return false;
 	else return true;
-	
+
 }
 
 function isPhotoSmall(photo) {
@@ -53,7 +53,7 @@ function isPhotoSmall(photo) {
 
 	if (photo.width<$(window).width()-60) size["width"] = true;
 	if (photo.height<$(window).height()-100) size["height"] = true;
-	
+
 	if (size["width"]&&size["height"]) return true;
 	else return false;
 
@@ -63,14 +63,14 @@ function showInfobox() {
 
 	$("body").append("<div id='infobox_overlay'></div>");
 	infobox.css("right", "0px");
-	
+
 }
 
 function hideInfobox() {
 
 	$("#infobox_overlay").remove();
 	infobox.css("right", "-320px");
-	
+
 }
 
 function loadPhotoInfo(photoID) {
@@ -86,7 +86,7 @@ function loadPhotoInfo(photoID) {
 		if (isPhotoSmall(data)) image_view.html("").append("<div id='image' class='small' style='background-image: url(" + data.url + "); width: " + data.width + "px; height: " + data.height + "px; margin-top: -" + parseInt((data.height/2)-20) + "px; margin-left: -" + data.width/2 + "px;'></div>");
 		else image_view.html("").append("<div id='image' style='background-image: url(" + data.url + "); top: 70px; right: 30px; bottom: 30px; left: 30px;'></div>");
 		image_view.removeClass("fadeOut").addClass("fadeIn").show();
-		
+
 		infobox.html(buildInfobox(data)).show();
 
 	}, error: ajaxError });
@@ -98,5 +98,5 @@ function ajaxError(jqXHR, textStatus, errorThrown) {
 	console.log(jqXHR);
 	console.log(textStatus);
 	console.log(errorThrown);
-	
+
 }

+ 26 - 26
php/api.php

@@ -1,10 +1,10 @@
-<?php
-
-/**
- * @name        api.php
- * @author      Philipp Maurer
- * @author      Tobias Reich
- * @copyright   2012 by Philipp Maurer, Tobias Reich
+<?php
+
+/**
+ * @name        api.php
+ * @author      Philipp Maurer
+ * @author      Tobias Reich
+ * @copyright   2012 by Philipp Maurer, Tobias Reich
  */
 
 if((isset($_POST["function"])&&$_POST["function"]!="")||(isset($_GET["function"])&&$_GET["function"]!="")) {
@@ -29,8 +29,8 @@ if((isset($_POST["function"])&&$_POST["function"]!="")||(isset($_GET["function"]
 		if($_POST["function"]=="getAlbumInfo"&&isset($_POST["albumID"])) echo array2json(getAlbumInfo($_POST["albumID"]));
 		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($_GET["function"]=="getAlbumArchive"&&isset($_GET["albumID"])) getAlbumArchive($_GET["albumID"]);
-		
+		if($_GET["function"]=="getAlbumArchive"&&isset($_GET["albumID"])) getAlbumArchive($_GET["albumID"]);
+
 		// Photo Functions
 		if($_POST["function"]=="getPhotos"&&isset($_POST["albumID"])) echo array2json(getPhotos($_POST["albumID"]));
 		if($_POST["function"]=="getPhotoInfo"&&isset($_POST["photoID"])) echo array2json(getPhotoInfo($_POST["photoID"]));
@@ -39,35 +39,35 @@ if((isset($_POST["function"])&&$_POST["function"]!="")||(isset($_GET["function"]
 		if($_POST["function"]=="setPhotoTitle"&&isset($_POST["photoID"])&&isset($_POST["title"])) echo setPhotoTitle($_POST["photoID"], $_POST["title"]);
 		if($_POST["function"]=="setPhotoStar"&&isset($_POST["photoID"])) echo setPhotoStar($_POST["photoID"]);
 		if($_POST["function"]=="setPhotoPublic"&&isset($_POST["photoID"])&&isset($_POST["url"])) echo setPhotoPublic($_POST["photoID"], $_POST["url"]);
-		if($_POST["function"]=="setPhotoDescription"&&isset($_POST["photoID"])&&isset($_POST["description"])) echo setPhotoDescription($_POST["photoID"], $_POST["description"]);
+		if($_POST["function"]=="setPhotoDescription"&&isset($_POST["photoID"])&&isset($_POST["description"])) echo setPhotoDescription($_POST["photoID"], $_POST["description"]);
 		if($_POST["function"]=="sharePhoto"&&isset($_POST["photoID"])&&isset($_POST["url"])) echo array2json(sharePhoto($_POST["photoID"], $_POST["url"]));
 		if($_POST["function"]=="previousPhoto"&&isset($_POST["photoID"])&&isset($_POST["albumID"])) echo array2json(previousPhoto($_POST["photoID"], $_POST["albumID"]));
 		if($_POST["function"]=="nextPhoto"&&isset($_POST["photoID"])&&isset($_POST["albumID"])) echo array2json(nextPhoto($_POST["photoID"], $_POST["albumID"]));
-                
-        // Upload Function
-		if($_POST["function"]=="upload"&&isset($_FILES)&&isset($_POST["albumID"])) echo upload($_FILES, $_POST["albumID"]);
-		
-		// Search Function
-		if($_POST["function"]=="search"&&isset($_POST["term"])) echo array2json(search($_POST["term"]));
-		
-		// Sync Function
+
+        // Upload Function
+		if($_POST["function"]=="upload"&&isset($_FILES)&&isset($_POST["albumID"])) echo upload($_FILES, $_POST["albumID"]);
+
+		// Search Function
+		if($_POST["function"]=="search"&&isset($_POST["term"])) echo array2json(search($_POST["term"]));
+
+		// Sync Function
 		if($_POST["function"]=="syncFolder") echo syncFolder();
-                
+
 		// Session Functions
 		if($_POST["function"]=="logout") logout();
 		if($_POST["function"]=="loggedIn") echo true;
 
-   } else {
-   
-		dbConnect();
-		
+   } else {
+
+		dbConnect();
+
 		// Photo Functions
 	    if($_POST["function"]=="getPhotoInfo"&&isset($_POST["photoID"])&&isPhotoPublic($_POST["photoID"])) echo array2json(getPhotoInfo($_POST["photoID"]));
-	
+
 	    // Session Functions
 	    if($_POST["function"]=="login") echo login($_POST['user'], $_POST['password']);
-	    if($_POST["function"]=="loggedIn") echo false;
-		  		
+	    if($_POST["function"]=="loggedIn") echo false;
+
    }
 
 } else echo "Error: No permission!";

+ 31 - 31
php/functions.php

@@ -6,7 +6,7 @@
  * @author      Tobias Reich
  * @copyright   2012 by Philipp Maurer, Tobias Reich
  */
- 
+
 include("config.php");
 
 // Database Functions
@@ -49,7 +49,7 @@ function createTables() {
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;";
     $result = mysql_query($query);
     if(!$result) return false;
-    
+
     $query = "CREATE TABLE IF NOT EXISTS `photos` (
   `id` bigint(14) NOT NULL,
   `title` varchar(50) NOT NULL,
@@ -151,9 +151,9 @@ function getCamera($photoID) {
         $return['size'] = $size;
         $return['date'] = date("d.m.Y",filectime($url));
         $return['time'] = date("H:i:s",filectime($url));
-        
+
         echo $exif['FileDateTime']."<br/>".$exif['DateTimeOriginal'];
-        
+
         // Camera Information
         if(isset($exif['ISOSpeedRatings'])){$return['iso']="ISO-".$exif['ISOSpeedRatings'];}
         if(isset($exif['COMPUTED']['ApertureFNumber'])){$return['aperture']=$exif['COMPUTED']['ApertureFNumber'];}
@@ -274,7 +274,7 @@ function getSmartInfo() {
         $i++;
     }
     $return['unsortNum'] = $i;
-    
+
     $query2 = "SELECT * FROM photos WHERE public = 1 ORDER BY id DESC;";
     $result2 = mysql_query($query2);
     $i = 0;
@@ -283,7 +283,7 @@ function getSmartInfo() {
         $i++;
     }
     $return['publicNum'] = $i;
-    
+
     $query3 = "SELECT * FROM photos WHERE star = 1 ORDER BY id DESC;";
     $result3 = mysql_query($query3);
     $i = 0;
@@ -293,7 +293,7 @@ function getSmartInfo() {
     }
     $return['starredNum'] = $i;
     return $return;
-    
+
 }
 function getAlbumInfo($albumID) {
     $return = array();
@@ -365,26 +365,26 @@ function getAlbumArchive($albumID) {
     $row = mysql_fetch_object($result);
     if($albumID!=0&&is_numeric($albumID))$zipTitle = $row->title;
     $filename = "./".$zipTitle.".zip";
-    
+
     $zip = new ZipArchive();
-    
+
     if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
         return false;
     }
-    
+
     foreach($files AS $zipFile) {
         $newFile = explode("/",$zipFile);
         $newFile = array_reverse($newFile);
         $zip->addFile($zipFile, $zipTitle."/".$newFile[0]);
     }
-    
+
     $zip->close();
-    
+
     header("Content-Type: application/zip");
     header("Content-Disposition: attachment; filename=\"$zipTitle.zip\"");
     readfile($filename);
     unlink($filename);
-    
+
     return true;
 }
 
@@ -417,15 +417,15 @@ function downloadPhoto($photoID) {
     $query = "SELECT * FROM photos WHERE id = '$photoID';";
     $result = mysql_query($query);
     $row = mysql_fetch_object($result);
-    
+
     $photo = "../".$row->url;
     $title = $row->title;
     $type = "appcication/zip";
     $filename = "./imageDownload.zip";
-    
+
     $zip = new ZipArchive();
     if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) return false;
-    
+
     $newFile = explode("/",$photo);
     $newFile = array_reverse($newFile);
     $zip->addFile($photo, $title.$newFile[0]);
@@ -454,7 +454,7 @@ function setPhotoPublic($photoID, $url) {
         $shortlink = "";
     }else{
         if($row->shortlink==""){
-            $shortlink = urlShortner($url); 
+            $shortlink = urlShortner($url);
         }else{
             $shortlink = $row->shortlink;
         }
@@ -497,7 +497,7 @@ function nextPhoto($photoID, $albumID) {
         $result = mysql_query($query);
         $return = mysql_fetch_array($result);
     }
-    return $return;    
+    return $return;
 }
 function previousPhoto($photoID, $albumID) {
     switch($albumID) {
@@ -564,9 +564,9 @@ function urlShortner($url) {
     if($bitlyUsername==""||$bitlyApi=="") return false;
     $url = urlencode($url);
     $bitlyAPI = "http://api.bit.ly/shorten?version=2.0.1&format=xml&longUrl=$url&login=$bitlyUsername&apiKey=$bitlyApi";
-    
+
     $data = file_get_contents($bitlyAPI);
-    
+
     $xml = simplexml_load_string($data);
     $shortlink = $xml->results->nodeKeyVal->shortUrl;
     return $shortlink;
@@ -575,18 +575,18 @@ function sharePhoto($photoID, $url) {
     $query = "SELECT * FROM photos WHERE id = '$photoID'";
     $result = mysql_query($query);
     $row = mysql_fetch_object($result);
-    
+
     $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);
     $tumblrUrl = "http://www.tumblr.com/share/link?url=".urlencode("$url")."&name=".  urlencode($title)."&description=".urlencode($description);
     $pinterestUrl = "http://pinterest.com/pin/create/button/?url=".urlencode("$url")."&media=".urlencode($thumb);
     $mailUrl = "mailto:?subject=".rawurlencode($title)."&body=".rawurlencode("Hey guy! Check this out: $url");
-    
+
     $share = array();
     $share['twitter'] = $twitterUrl;
     $share['facebook'] = $facebookUrl;
@@ -594,7 +594,7 @@ function sharePhoto($photoID, $url) {
     $share['pinterest'] = $pinterestUrl;
     $share['mail'] = $mailUrl;
     $share['shortlink'] = $shortlink;
-    
+
     return $share;
 }
 function facebookHeader($photoID) {
@@ -603,14 +603,14 @@ function facebookHeader($photoID) {
     $query = "SELECT * FROM photos WHERE id = '$photoID';";
     $result = mysql_query($query);
     $row = mysql_fetch_object($result);
-    
+
     $parseUrl = parse_url("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
     $thumb = $parseUrl['scheme']."://".$parseUrl['host'].$parseUrl['path']."/../".$row->thumbUrl;
-    
+
     $return  = '<meta name="title" content="'.$row->title.'" />';
     $return .= '<meta name="description" content="'.$row->description.' - via Lychee" />';
     $return .= '<link rel="image_src"  type="image/jpeg" href="'. $thumb .'" />';
-    
+
     return $return;
 }
 function isPhotoPublic($photoID) {
@@ -624,19 +624,19 @@ function isPhotoPublic($photoID) {
 // Search Function
 function search($term) {
     $term = mysql_real_escape_string($term);
-    
+
     $query = "SELECT * FROM photos WHERE title like '%$term%' OR description like '%$term%';";
     $result = mysql_query($query);
     while($row = mysql_fetch_array($result)) {
         $return['photos'][] = $row;
     }
-    
+
     $query = "SELECT * FROM albums WHERE title like '%$term%';";
     $result = mysql_query($query);
     $i=0;
     while($row = mysql_fetch_array($result)) {
         $return['albums'][$i] = $row;
-        
+
         $query = "SELECT thumbUrl FROM photos WHERE album = '".$row['id']."' ORDER BY id DESC LIMIT 0, 3;";
         $result2 = mysql_query($query);
         $k = 0;
@@ -644,7 +644,7 @@ function search($term) {
             $return['albums'][$i]["thumb$k"] = $row2->thumbUrl;
             $k++;
         }
-        
+
     }
     return $return;
 }

+ 2 - 2
readme.md

@@ -2,8 +2,8 @@
 
 #### A great looking and easy-to-use Photo-Management-System.
 
-![Lychee ImageView](http://lychee.electerious.com/uploads/big/13511584079432.png)
-![Lychee ImageView](http://lychee.electerious.com/uploads/big/13497110451270.png)
+![Lychee ImageView](http://lychee.electerious.com/uploads/big/13582806160093.png)
+![Lychee ImageView](http://lychee.electerious.com/uploads/big/13582805615704.png)
 
 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.
 

+ 0 - 0
uploads/big/empty.md


+ 0 - 0
uploads/thumb/empty.md


+ 6 - 6
view.php

@@ -16,17 +16,17 @@
 		<link rel="shortcut icon" href="img/favicon.png">
 
 		<meta name="apple-mobile-web-app-status-bar-style" content="black" >
-		<meta name="viewport" content="width=device-width, user-scalable=no">
+		<meta name="viewport" content="user-scalable=no, initial-scale=1">
 		<meta name="apple-mobile-web-app-capable" content="yes">
-		
+
 		<?php if(isset($_GET['p'])) echo facebookHeader($_GET['p']); ?>
-                
+
 	</head>
 	<body>
 
 	<!-- Loading -->
 	<div id="loading"></div>
-	
+
 	<!-- Header -->
 	<header>
 
@@ -37,10 +37,10 @@
 		<a id="title"></a>
 
 	</header>
-	
+
 	<!-- ImageView -->
 	<div id="image_view"></div>
-	
+
 	<!-- Infobox -->
 	<div id="infobox"></div>
 

Some files were not shown because too many files changed in this diff