From 4243074a7b902d7102a699d03f2ed9bd088a2a4d Mon Sep 17 00:00:00 2001 From: Peter Hoffmann Date: Fri, 25 Sep 2015 13:30:44 +0200 Subject: [PATCH 1/3] Check for GD-support (JPEG/PNG/GIF) --- plugins/check/index.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/check/index.php b/plugins/check/index.php index b21b087..ca82f5c 100644 --- a/plugins/check/index.php +++ b/plugins/check/index.php @@ -89,6 +89,12 @@ if (!ini_get('allow_url_fopen')) echo('Warning: You may experience problems with # 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); +# About GD +$gdVersion = gd_info(); +if (!$gdVersion['JPEG Support']) $error .= ('Error: No GD without jpeg support' . PHP_EOL); +if (!$gdVersion['PNG Support']) $error .= ('Error: No GD without png support' . PHP_EOL); +if (!$gdVersion['GIF Read Support'] || !$gdVersion['GIF Create Support']) $error .= ('Error: No GD without full gif support' . PHP_EOL); + # Output if ($error==='') echo('No critical problems found. Lychee should work without problems!' . PHP_EOL); else echo $error; @@ -108,9 +114,6 @@ else $imagick = '-'; if (!isset($imagickVersion, $imagickVersion['versionNumber'])||$imagickVersion==='') $imagickVersion = '-'; else $imagickVersion = $imagickVersion['versionNumber']; -# About GD -$gdVersion = gd_info(); - # Output system information echo('Lychee Version: ' . $json['version'] . PHP_EOL); echo('DB Version: ' . $settings['version'] . PHP_EOL); From 9d489a5bfa829e7dec3a3b58d47c2dfd8c1e544d Mon Sep 17 00:00:00 2001 From: Peter Hoffmann Date: Fri, 25 Sep 2015 13:35:21 +0200 Subject: [PATCH 2/3] Enhancing error message --- plugins/check/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/check/index.php b/plugins/check/index.php index ca82f5c..7fa1bcd 100644 --- a/plugins/check/index.php +++ b/plugins/check/index.php @@ -91,9 +91,9 @@ if ($database->server_version<50500) echo('Warning: Lychee uses the GBK charset # About GD $gdVersion = gd_info(); -if (!$gdVersion['JPEG Support']) $error .= ('Error: No GD without jpeg support' . PHP_EOL); -if (!$gdVersion['PNG Support']) $error .= ('Error: No GD without png support' . PHP_EOL); -if (!$gdVersion['GIF Read Support'] || !$gdVersion['GIF Create Support']) $error .= ('Error: No GD without full gif support' . PHP_EOL); +if (!$gdVersion['JPEG Support']) $error .= ('Error: PHP gd extension without jpeg support' . PHP_EOL); +if (!$gdVersion['PNG Support']) $error .= ('Error: PHP gd extension without png support' . PHP_EOL); +if (!$gdVersion['GIF Read Support'] || !$gdVersion['GIF Create Support']) $error .= ('Error: PHP gd extension without full gif support' . PHP_EOL); # Output if ($error==='') echo('No critical problems found. Lychee should work without problems!' . PHP_EOL); From 115188c2d0025e590498c7d0ad63a2957c5ecd47 Mon Sep 17 00:00:00 2001 From: Peter Hoffmann Date: Fri, 25 Sep 2015 15:46:57 +0200 Subject: [PATCH 3/3] You don't need to set config options each time, better set them once --- php/api.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/php/api.php b/php/api.php index cb089e5..d043a4d 100755 --- a/php/api.php +++ b/php/api.php @@ -5,12 +5,6 @@ # @copyright 2015 by Tobias Reich ### -@ini_set('max_execution_time', '200'); -@ini_set('post_max_size', '200M'); -@ini_set('upload_max_size', '200M'); -@ini_set('upload_max_filesize', '20M'); -@ini_set('max_file_uploads', '100'); - if (!empty($_POST['function'])||!empty($_GET['function'])) { session_start(); @@ -96,4 +90,4 @@ if (!empty($_POST['function'])||!empty($_GET['function'])) { } -?> \ No newline at end of file +?>