Merge pull request #2 from electerious/develop

Develop
This commit is contained in:
Quentin Ligier 2016-03-17 19:16:59 +01:00
commit 4324d2a5cb
9 changed files with 2162 additions and 25 deletions

BIN
dist/main.js vendored Executable file → Normal file

Binary file not shown.

View File

@ -278,7 +278,7 @@ final class Album {
if (!@is_readable($photo->url)) continue;
// Get extension of image
$extension = getExtension($photo->url);
$extension = getExtension($photo->url, true);
// Set title for photo
$zipFileName = $zipTitle . '/' . $photo->title . $extension;

View File

@ -50,7 +50,7 @@ final class Import {
// This prevents us from downloading invalid photos.
// Verify extension
$extension = getExtension($url);
$extension = getExtension($url, true);
if (!in_array(strtolower($extension), Photo::$validExtensions, true)) {
$error = true;
Log::error(Database::get(), __METHOD__, __LINE__, 'Photo format not supported (' . $url . ')');

View File

@ -4,6 +4,7 @@ namespace Lychee\Modules;
use ZipArchive;
use Imagick;
use ImagickPixel;
final class Photo {
@ -123,7 +124,7 @@ final class Photo {
}
// Verify extension
$extension = getExtension($file['name']);
$extension = getExtension($file['name'], false);
if (!in_array(strtolower($extension), self::$validExtensions, true)) {
Log::error(Database::get(), __METHOD__, __LINE__, 'Photo format not supported');
if ($returnOnError===true) return false;
@ -844,8 +845,8 @@ final class Photo {
}
// Get extension
$extension = getExtension($photo->url);
if ($extension===false) {
$extension = getExtension($photo->url, true);
if (empty($extension)===true) {
Log::error(Database::get(), __METHOD__, __LINE__, 'Invalid photo extension');
return false;
}

View File

@ -1,10 +1,17 @@
<?php
function getExtension($filename) {
/**
* Returns the extension of the filename (path or URI) or an empty string.
* @return string Extension of the filename starting with a dot.
*/
function getExtension($filename, $isURI = false) {
$extension = strpos($filename, '.') !== false
? strrchr($filename, '.')
: '';
// If $filename is an URI, get only the path component
if ($isURI===true) $filename = parse_url($filename, PHP_URL_PATH);
$extension = pathinfo($filename, PATHINFO_EXTENSION);
if (empty($extension)===false) $extension = '.' . $extension;
return $extension;

View File

@ -91,7 +91,7 @@ if (!$settings['dropboxKey']) echo('Warning: Dropbox import not working. No prop
// Check php.ini Settings
if (ini_get('max_execution_time')<200&&ini_set('upload_max_filesize', '20M')===false) echo('Warning: You may experience problems when uploading a large amount of photos. Take a look in the FAQ for details.' . PHP_EOL);
if (!ini_get('allow_url_fopen')) echo('Warning: You may experience problems with the Dropbox- and URL-Import. Edit your php.ini and set allow_url_fopen to 1.' . PHP_EOL);
if (empty(ini_get('allow_url_fopen'))) echo('Warning: You may experience problems with the Dropbox- and URL-Import. Edit your php.ini and set allow_url_fopen to 1.' . PHP_EOL);
// Check mysql version
if ($database->server_version<50500) echo('Warning: Lychee uses the GBK charset to avoid sql injections on your MySQL version. Please update to MySQL 5.5 or higher to enable UTF-8 support.' . PHP_EOL);

2141
src/npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
"start": "gulp watch",
"compile": "gulp"
},
"devDependencies": {
"dependencies": {
"babel-preset-es2015": "^6.6.0",
"basiccontext": "^3.5.1",
"basicmodal": "^3.3.3",

View File

@ -95,10 +95,6 @@ lychee.login = function(data) {
if (data===true) {
// Use 'try' to catch a thrown error when Safari is in private mode
try { localStorage.setItem('lychee_username', user) }
catch (err) {}
window.location.reload()
} else {
@ -116,8 +112,8 @@ lychee.loginDialog = function() {
let msg = lychee.html`
<p class='signIn'>
<input class='text' name='username' autocomplete='username' type='text' value='' placeholder='username' autocapitalize='off' autocorrect='off'>
<input class='text' name='password' autocomplete='current-password' type='password' value='' placeholder='password'>
<input class='text' name='username' autocomplete='username' type='text' placeholder='username' autocapitalize='off' autocorrect='off'>
<input class='text' name='password' autocomplete='current-password' type='password' placeholder='password'>
</p>
<p class='version'>Lychee $${ lychee.version }<span> &#8211; <a target='_blank' href='$${ lychee.updateURL }'>Update available!</a><span></p>
`
@ -136,14 +132,6 @@ lychee.loginDialog = function() {
}
})
if (localStorage) {
let localUsername = localStorage.getItem('lychee_username')
if (localUsername!=null && localUsername.length>0) {
$('.basicModal input[name="username"]').val(localUsername)
$('.basicModal input[name="password"]').focus()
}
}
if (lychee.checkForUpdates==='1') lychee.getUpdate()
}