1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-21 00:02:18 +02:00

[ticket/16604] Display warning messages on avatar upload setting issues

PHPBB3-16604
This commit is contained in:
rxu 2020-09-20 23:10:09 +07:00
parent 2db4dc8c96
commit 5e351dad53
No known key found for this signature in database
GPG Key ID: 955F0567380E586A
2 changed files with 21 additions and 0 deletions

View File

@ -510,6 +510,25 @@ class acp_board
}
}
if ($mode == 'avatar' && $cfg_array['allow_avatar_upload'])
{
$filesystem = $phpbb_container->get('filesystem');
// If avatar uploading is enabled but the path setting is empty,
// config variable validation is bypassed. Catch the case here
if (!$cfg_array['avatar_path'])
{
$error[] = $language->lang('AVATAR_NO_UPLOAD_PATH');
}
// Not existing or writable path will be caught on submit by config vars validation
// Display the warning if the directory was changed on the server afterwards
else if (!$submit &&
(!$filesystem->exists($phpbb_root_path . $cfg_array['avatar_path']) || !$filesystem->is_writable($phpbb_root_path . $cfg_array['avatar_path'])))
{
$error[] = $language->lang('AVATAR_NO_UPLOAD_DIR');
}
}
// We validate the complete config if wished
validate_config_vars($display_vars['vars'], $cfg_array, $error);

View File

@ -110,6 +110,8 @@ $lang = array_merge($lang, array(
'AVATAR_NOT_UPLOADED' => 'Avatar could not be uploaded.',
'AVATAR_NO_TEMP_DIR' => 'Temporary folder could not be found or is not writable.',
'AVATAR_NO_SIZE' => 'The width or height of the linked avatar could not be determined. Please enter them manually.',
'AVATAR_NO_UPLOAD_DIR' => 'Avatar storage path does not exist or is not writable.',
'AVATAR_NO_UPLOAD_PATH' => 'Avatar uploading is enabled but avatar storage path is not set.',
'AVATAR_PARTIAL_UPLOAD' => 'The specified file was only partially uploaded.',
'AVATAR_PHP_SIZE_NA' => 'The avatars filesize is too large.<br />The maximum allowed filesize set in php.ini could not be determined.',
'AVATAR_PHP_SIZE_OVERRUN' => 'The avatars filesize is too large. The maximum allowed upload size is %1$d %2$s.<br />Please note this is set in php.ini and cannot be overridden.',