mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [ticket/12822] Fix test runs of avatar manager_test [ticket/12822] Add method for deleting avatars and use confirm_box [ticket/12822] Remove "None" option from avatar select boxes Conflicts: phpBB/styles/subsilver2/template/ucp_groups_manage.html phpBB/styles/subsilver2/template/ucp_profile_avatar.html
This commit is contained in:
@@ -69,6 +69,11 @@ class gravatar extends \phpbb\avatar\driver\driver
|
||||
$row['avatar_width'] = $request->variable('avatar_gravatar_width', 0);
|
||||
$row['avatar_height'] = $request->variable('avatar_gravatar_height', 0);
|
||||
|
||||
if (empty($row['avatar']))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!function_exists('validate_data'))
|
||||
{
|
||||
require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
|
||||
|
@@ -120,7 +120,6 @@ class local extends \phpbb\avatar\driver\driver
|
||||
|
||||
if (empty($category) || empty($file))
|
||||
{
|
||||
$error[] = 'NO_AVATAR_SELECTED';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -53,6 +53,11 @@ class remote extends \phpbb\avatar\driver\driver
|
||||
$width = $request->variable('avatar_remote_width', 0);
|
||||
$height = $request->variable('avatar_remote_height', 0);
|
||||
|
||||
if (empty($url))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!preg_match('#^(http|https|ftp)://#i', $url))
|
||||
{
|
||||
$url = 'http://' . $url;
|
||||
|
@@ -129,7 +129,6 @@ class upload extends \phpbb\avatar\driver\driver
|
||||
}
|
||||
else
|
||||
{
|
||||
$error[] = 'NO_AVATAR_SELECTED';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -41,8 +41,8 @@ class manager
|
||||
static protected $default_row = array(
|
||||
'avatar' => '',
|
||||
'avatar_type' => '',
|
||||
'avatar_width' => '',
|
||||
'avatar_height' => '',
|
||||
'avatar_width' => 0,
|
||||
'avatar_height' => 0,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -307,4 +307,36 @@ class manager
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle deleting avatars
|
||||
*
|
||||
* @param \phpbb\db\driver\driver_interface $db phpBB dbal
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
* @param array $avatar_data Cleaned user data containing the user's
|
||||
* avatar data
|
||||
* @param string $table Database table from which the avatar should be deleted
|
||||
* @param string $prefix Prefix of user data columns in database
|
||||
* @return null
|
||||
*/
|
||||
public function handle_avatar_delete(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $avatar_data, $table, $prefix)
|
||||
{
|
||||
if ($driver = $this->get_driver($avatar_data['avatar_type']))
|
||||
{
|
||||
$driver->delete($avatar_data);
|
||||
}
|
||||
|
||||
$result = self::$default_row;
|
||||
|
||||
foreach ($result as $key => $value)
|
||||
{
|
||||
$result[$prefix . $key] = $value;
|
||||
unset($result[$key]);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . $table . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $result) . '
|
||||
WHERE ' . $prefix . 'id = ' . (int) $avatar_data['id'];
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user