Commit bdbc83f3 authored by Melissa Draper's avatar Melissa Draper
Browse files

Add warnings for incomplete GD lib compilations (bug #904882)



Currently there's no warning if the PHP GD library has been
compiled without one support for a file type. When a user attempts
to upload an image of an unsupported type, it will fail.

Change-Id: I682a39aeaba2d06494868210b9ef9d8f46f1b136
Signed-off-by: default avatarMelissa Draper <melissa@catalyst.net.nz>
parent 6763b52a
......@@ -128,7 +128,13 @@ $string['timezoneidentifierunusable'] = 'PHP on your website host does not retur
$string['postmaxlessthanuploadmax'] = 'Your PHP post_max_size setting (%s) is smaller than your upload_max_filesize setting (%s). Uploads larger than %s will fail without displaying an error. Usually, post_max_size should be much larger than upload_max_filesize.';
$string['smallpostmaxsize'] = 'Your PHP post_max_size setting (%s) is very small. Uploads larger than %s will fail without displaying an error.';
$string['notenoughsessionentropy'] = 'Your PHP session.entropy_length setting is too small. Set it to at least 16 in your php.ini to ensure that generated session IDs are random and unpredictable enough.';
$string['noreplyaddressmissingorinvalid'] = 'The noreply address setting is either empty or has an invalid email address. Please check the configuration in the <a href="%s">site options in the email settings</a>.';
$string['openbasedirenabled'] = 'Your server has the php open_basedir restriction enabled.';
$string['openbasedirpaths'] = 'Mahara can only open files within the following path(s): %s';
$string['openbasedirwarning'] = 'Some requests for external sites may fail to complete. This could stop certain feeds from updating, among other things.';
$string['gdlibrarylacksgifsupport'] = 'The installed PHP GD Library does not support both creating and reading GIF images. Full support is needed to upload GIF images.';
$string['gdlibrarylacksjpegsupport'] = 'The installed PHP GD Library does not support JPEG/JPG images. Full support is needed to upload JPEG/JPG images.';
$string['gdlibrarylackspngsupport'] = 'The installed PHP GD Library does not support PNG images. Full support is needed to upload PNG images.';
......@@ -1188,6 +1188,20 @@ function site_warnings() {
$warnings[] = get_string('noreplyaddressmissingorinvalid', 'error', get_config('wwwroot') . 'admin/site/options.php?fs=emailsettings');
}
// Check that the GD library has support for jpg, png and gif at least
$gdinfo = gd_info();
if (!$gdinfo['JPEG Support']) {
$warnings[] = get_string('gdlibrarylacksjpegsupport', 'error');
}
if (!$gdinfo['PNG Support']) {
$warnings[] = get_string('gdlibrarylackspngsupport', 'error');
}
if (!$gdinfo['GIF Read Support'] || !$gdinfo['GIF Create Support']) {
$warnings[] = get_string('gdlibrarylacksgifsupport', 'error');
}
// Check file upload settings.
$postmax = ini_get('post_max_size');
$uploadmax = ini_get('upload_max_filesize');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment