mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/avatars] Update avatars in database_update
PHPBB3-10018
This commit is contained in:
parent
3b71e81cfb
commit
a1132fc5c7
2 changed files with 36 additions and 60 deletions
|
@ -1325,72 +1325,28 @@ function get_avatar($row, $alt, $ignore_config = false)
|
||||||
'width' => $row['avatar_width'],
|
'width' => $row['avatar_width'],
|
||||||
'height' => $row['avatar_height'],
|
'height' => $row['avatar_height'],
|
||||||
);
|
);
|
||||||
|
|
||||||
switch ($row['avatar_type'])
|
$avatar = $phpbb_avatar_manager->get_driver($row['avatar_type']);
|
||||||
|
|
||||||
|
if ($avatar)
|
||||||
{
|
{
|
||||||
case AVATAR_UPLOAD:
|
if ($avatar->custom_html)
|
||||||
// Compatibility with old avatars
|
{
|
||||||
if (!$config['allow_avatar_upload'] && !$ignore_config)
|
return $avatar->get_html($row, $ignore_config);
|
||||||
{
|
}
|
||||||
$avatar_data['src'] = '';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$avatar_data['src'] = $phpbb_root_path . "download/file.$phpEx?avatar=" . $avatar_data['src'];
|
|
||||||
$avatar_data['src'] = str_replace(' ', '%20', $avatar_data['src']);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case AVATAR_GALLERY:
|
$avatar_data = $avatar->get_data($row, $ignore_config);
|
||||||
// Compatibility with old avatars
|
}
|
||||||
if (!$config['allow_avatar_local'] && !$ignore_config)
|
else
|
||||||
{
|
{
|
||||||
$avatar_data['src'] = '';
|
$avatar_data['src'] = '';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$avatar_data['src'] = $phpbb_root_path . $config['avatar_gallery_path'] . '/' . $avatar_data['src'];
|
|
||||||
$avatar_data['src'] = str_replace(' ', '%20', $avatar_data['src']);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case AVATAR_REMOTE:
|
|
||||||
// Compatibility with old avatars
|
|
||||||
if (!$config['allow_avatar_remote'] && !$ignore_config)
|
|
||||||
{
|
|
||||||
$avatar_data['src'] = '';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$avatar_data['src'] = str_replace(' ', '%20', $avatar_data['src']);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$avatar = $phpbb_avatar_manager->get_driver($row['avatar_type']);
|
|
||||||
|
|
||||||
if ($avatar)
|
|
||||||
{
|
|
||||||
if ($avatar->custom_html)
|
|
||||||
{
|
|
||||||
return $avatar->get_html($row, $ignore_config);
|
|
||||||
}
|
|
||||||
|
|
||||||
$avatar_data = $avatar->get_data($row, $ignore_config);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$avatar_data['src'] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
if (!empty($avatar_data['src']))
|
if (!empty($avatar_data['src']))
|
||||||
{
|
{
|
||||||
$html = '<img src="' . $avatar_data['src'] . '" ' .
|
$html = '<img src="' . $avatar_data['src'] . '" ' .
|
||||||
($avatar_data['width'] ? ('width="' . $avatar_data['width'] . '" ') : '') .
|
($avatar_data['width'] ? ('width="' . $avatar_data['width'] . '" ') : '') .
|
||||||
($avatar_data['height'] ? ('height="' . $avatar_data['height'] . '" ') : '') .
|
($avatar_data['height'] ? ('height="' . $avatar_data['height'] . '" ') : '') .
|
||||||
'alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
|
'alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
|
||||||
|
|
|
@ -2391,13 +2391,33 @@ function change_database_data(&$no_updates, $version)
|
||||||
{
|
{
|
||||||
set_config('teampage_memberships', '1');
|
set_config('teampage_memberships', '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear styles table and add prosilver entry
|
// Clear styles table and add prosilver entry
|
||||||
_sql('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary);
|
_sql('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary);
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . STYLES_TABLE . " (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '© phpBB Group', 1, 'prosilver', 'kNg=', 0, '')";
|
$sql = 'INSERT INTO ' . STYLES_TABLE . " (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '© phpBB Group', 1, 'prosilver', 'kNg=', 0, '')";
|
||||||
_sql($sql, $errored, $error_ary);
|
_sql($sql, $errored, $error_ary);
|
||||||
|
|
||||||
|
// Update avatars to modular types
|
||||||
|
$avatar_type_map = array(
|
||||||
|
AVATAR_UPLOAD => 'upload',
|
||||||
|
AVATAR_GALLERY => 'local',
|
||||||
|
AVATAR_REMOTE => 'remote',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($avatar_type_map as $old => $new)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||||
|
SET user_avatar_type = '" . $db->sql_escape($new) . "'
|
||||||
|
WHERE user_avatar_type = '" . $db->sql_escape($old) . "'";
|
||||||
|
_sql($sql, $errored, $error_ary);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . GROUPS_TABLE . "
|
||||||
|
SET group_avatar_type = '" . $db->sql_escape($new) . "'
|
||||||
|
WHERE group_avatar_type = '" . $db->sql_escape($old) . "'";
|
||||||
|
_sql($sql, $errored, $error_ary);
|
||||||
|
}
|
||||||
|
|
||||||
$no_updates = false;
|
$no_updates = false;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue