From dffce28eb4f1166657574cada9365c2276b1dc5e Mon Sep 17 00:00:00 2001 From: Bocquet Aldric Date: Wed, 16 Mar 2016 15:22:18 +0100 Subject: [PATCH 1/3] Fixed a bug preventing photos form being rotated --- php/Modules/Photo.php | 1 + 1 file changed, 1 insertion(+) diff --git a/php/Modules/Photo.php b/php/Modules/Photo.php index ef79a95..55fe91f 100755 --- a/php/Modules/Photo.php +++ b/php/Modules/Photo.php @@ -4,6 +4,7 @@ namespace Lychee\Modules; use ZipArchive; use Imagick; +use ImagickPixel; final class Photo { From e93564c3e0327e84710540a6fd42c31fdc0b6dbc Mon Sep 17 00:00:00 2001 From: Quentin Ligier Date: Wed, 16 Mar 2016 17:07:22 +0100 Subject: [PATCH 2/3] Rewrite of getExtension --- php/Modules/Album.php | 2 +- php/Modules/Import.php | 2 +- php/Modules/Photo.php | 6 +++--- php/helpers/getExtension.php | 15 ++++++++++----- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/php/Modules/Album.php b/php/Modules/Album.php index 4460a5c..253d224 100644 --- a/php/Modules/Album.php +++ b/php/Modules/Album.php @@ -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; diff --git a/php/Modules/Import.php b/php/Modules/Import.php index 3bf0df1..76adf19 100644 --- a/php/Modules/Import.php +++ b/php/Modules/Import.php @@ -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 . ')'); diff --git a/php/Modules/Photo.php b/php/Modules/Photo.php index ef79a95..3f5b6d1 100755 --- a/php/Modules/Photo.php +++ b/php/Modules/Photo.php @@ -123,7 +123,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 +844,8 @@ final class Photo { } // Get extension - $extension = getExtension($photo->url); - if ($extension===false) { + $extension = getExtension($photo->url, true); + if (empty($extension)) { Log::error(Database::get(), __METHOD__, __LINE__, 'Invalid photo extension'); return false; } diff --git a/php/helpers/getExtension.php b/php/helpers/getExtension.php index 21089c0..d8df170 100644 --- a/php/helpers/getExtension.php +++ b/php/helpers/getExtension.php @@ -1,13 +1,18 @@ \ No newline at end of file From 8bca87e2e4b948c1377e0f8b76bc133107c37342 Mon Sep 17 00:00:00 2001 From: Quentin Ligier Date: Wed, 16 Mar 2016 19:52:13 +0100 Subject: [PATCH 3/3] Better allow_url_fopen check ini_get can return false or an empty string when the setting is deactivated --- plugins/Diagnostics/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Diagnostics/index.php b/plugins/Diagnostics/index.php index 307a774..c7cf963 100644 --- a/plugins/Diagnostics/index.php +++ b/plugins/Diagnostics/index.php @@ -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);