diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 8e571de379..c3fb160db8 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -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); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 3f8117b7af..fefb7dafb6 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -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 avatar’s filesize is too large.
The maximum allowed filesize set in php.ini could not be determined.', 'AVATAR_PHP_SIZE_OVERRUN' => 'The avatar’s filesize is too large. The maximum allowed upload size is %1$d %2$s.
Please note this is set in php.ini and cannot be overridden.',