mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-29 02:29:21 +02:00
[feature/avatars] Improve handling of incorrect input for avatars
The upload avatar driver will now inform the user if insufficient data has been entered for both remote and local avatar uploads. The local avatar driver (gallery avatar) will also inform the user if he didn't select a category and/or file before submitting. PHPBB3-10018
This commit is contained in:
parent
7256a2d944
commit
8f8527a416
@ -120,6 +120,13 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
|
||||
$category = $this->request->variable('avatar_local_cat', '');
|
||||
|
||||
$file = $this->request->variable('avatar_local_file', '');
|
||||
|
||||
if (empty($category) || empty($file))
|
||||
{
|
||||
$error[] = 'NO_AVATAR_SELECTED';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset($avatar_list[$category][urldecode($file)]))
|
||||
{
|
||||
$error[] = 'AVATAR_URL_NOT_FOUND';
|
||||
|
@ -75,10 +75,15 @@ class phpbb_avatar_driver_upload extends phpbb_avatar_driver
|
||||
{
|
||||
$file = $upload->form_upload('avatar_upload_file');
|
||||
}
|
||||
else
|
||||
elseif (!empty($this->config['allow_avatar_remote_upload']) && !empty($url))
|
||||
{
|
||||
$file = $upload->remote_upload($url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error[] = 'NO_AVATAR_SELECTED';
|
||||
return false;
|
||||
}
|
||||
|
||||
$prefix = $this->config['avatar_salt'] . '_';
|
||||
$file->clean_filename('avatar', $prefix, $row['id']);
|
||||
|
@ -397,6 +397,7 @@ $lang = array_merge($lang, array(
|
||||
'NO_AUTH_ADMIN_USER_DIFFER' => 'You are not able to re-authenticate as a different user.',
|
||||
'NO_AUTH_OPERATION' => 'You do not have the necessary permissions to complete this operation.',
|
||||
'NO_AVATARS' => 'No avatars currently available',
|
||||
'NO_AVATAR_SELECTED' => 'You have not selected any avatar.',
|
||||
'NO_CONNECT_TO_SMTP_HOST' => 'Could not connect to smtp host : %1$s : %2$s',
|
||||
'NO_BIRTHDAYS' => 'No birthdays today',
|
||||
'NO_EMAIL_MESSAGE' => 'Email message was blank.',
|
||||
|
Loading…
x
Reference in New Issue
Block a user