- 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 browserpull/15/merge 1.2
parent
b0dccfb3e0
commit
4e5c836b8d
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 4.4 KiB |
File diff suppressed because one or more lines are too long
@ -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
|
||||
|
||||
define("LYCHEE", true);
|
||||
define('LYCHEE', true);
|
||||
|
||||
// Declare
|
||||
$error = "";
|
||||
$error = '';
|
||||
|
||||
// Include
|
||||
include("config.php");
|
||||
require('config.php');
|
||||
|
||||
// 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
|
||||
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("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('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('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');
|
||||
|
||||
// Config
|
||||
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 (!$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 (!$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 (!$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 (!$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 (!$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');
|
||||
|
||||
// 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 = 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
|
||||
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/import/")), -4) != "0777") $error .= ("Error 502: Wrong permissions for \"/uploads/import\" (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/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;
|
||||
|
||||
?>
|
@ -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!";
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in new issue