1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 19:24:01 +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:
Marc Alexander
2013-01-04 17:23:22 +01:00
parent 7256a2d944
commit 8f8527a416
3 changed files with 14 additions and 1 deletions

View File

@@ -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';

View File

@@ -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']);