mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-05 00:07:44 +02:00
Merge branch 'feature/avatars' of https://github.com/igorw/phpbb3 into feature/avatars
Conflicts: phpBB/adm/style/acp_groups.html phpBB/adm/style/acp_users_avatar.html phpBB/includes/acp/acp_groups.php phpBB/includes/acp/acp_users.php phpBB/includes/functions_display.php phpBB/install/database_update.php phpBB/install/schemas/mssql_schema.sql phpBB/styles/prosilver/template/ucp_avatar_options.html
This commit is contained in:
@@ -1313,79 +1313,86 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank
|
||||
/**
|
||||
* Get user avatar
|
||||
*
|
||||
* @param string $avatar Users assigned avatar name
|
||||
* @param int $avatar_type Type of avatar
|
||||
* @param string $avatar_width Width of users avatar
|
||||
* @param string $avatar_height Height of users avatar
|
||||
* @param array $user_row Row from the users table
|
||||
* @param string $alt Optional language string for alt tag within image, can be a language key or text
|
||||
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
|
||||
*
|
||||
* @return string Avatar image
|
||||
* @return string Avatar html
|
||||
*/
|
||||
function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false)
|
||||
function get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = false)
|
||||
{
|
||||
global $user, $config, $phpbb_root_path, $phpEx;
|
||||
global $phpbb_dispatcher;
|
||||
$row = phpbb_avatar_manager::clean_row($user_row);
|
||||
return get_avatar($row, $alt, $ignore_config);
|
||||
}
|
||||
|
||||
$overwrite_avatar = '';
|
||||
/**
|
||||
* Get group avatar
|
||||
*
|
||||
* @param array $group_row Row from the groups table
|
||||
* @param string $alt Optional language string for alt tag within image, can be a language key or text
|
||||
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
|
||||
*
|
||||
* @return string Avatar html
|
||||
*/
|
||||
function get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false)
|
||||
{
|
||||
$row = phpbb_avatar_manager::clean_row($user_row);
|
||||
return get_avatar($row, $alt, $ignore_config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrite users avatar
|
||||
*
|
||||
* @event core.display_custom_bbcodes_modify_row
|
||||
* @var string avatar Users assigned avatar name
|
||||
* @var int avatar_type Type of avatar
|
||||
* @var string avatar_width Width of users avatar
|
||||
* @var string avatar_height Height of users avatar
|
||||
* @var string alt Language string for alt tag within image
|
||||
* Can be a language key or text
|
||||
* @var bool ignore_config Ignores config and force displaying avatar
|
||||
* @var string overwrite_avatar If set, this string will be the avatar
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'alt', 'ignore_config', 'overwrite_avatar');
|
||||
extract($phpbb_dispatcher->trigger_event('core.user_get_avatar', compact($vars)));
|
||||
/**
|
||||
* Get avatar
|
||||
*
|
||||
* @param array $row Row cleaned by phpbb_avatar_driver::clean_row
|
||||
* @param string $alt Optional language string for alt tag within image, can be a language key or text
|
||||
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
|
||||
*
|
||||
* @return string Avatar html
|
||||
*/
|
||||
function get_avatar($row, $alt, $ignore_config = false)
|
||||
{
|
||||
global $user, $config, $cache, $phpbb_root_path, $phpEx;
|
||||
global $request;
|
||||
global $phpbb_avatar_manager;
|
||||
|
||||
if ($overwrite_avatar)
|
||||
{
|
||||
return $overwrite_avatar;
|
||||
}
|
||||
|
||||
if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config))
|
||||
if (!$config['allow_avatar'] && !$ignore_config)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$avatar_img = '';
|
||||
$avatar_data = array(
|
||||
'src' => $row['avatar'],
|
||||
'width' => $row['avatar_width'],
|
||||
'height' => $row['avatar_height'],
|
||||
);
|
||||
|
||||
switch ($avatar_type)
|
||||
$avatar = $phpbb_avatar_manager->get_driver($row['avatar_type']);
|
||||
|
||||
if ($avatar)
|
||||
{
|
||||
case AVATAR_UPLOAD:
|
||||
if (!$config['allow_avatar_upload'] && !$ignore_config)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
$avatar_img = $phpbb_root_path . "download/file.$phpEx?avatar=";
|
||||
break;
|
||||
if ($avatar->custom_html)
|
||||
{
|
||||
return $avatar->get_html($row, $ignore_config);
|
||||
}
|
||||
|
||||
case AVATAR_GALLERY:
|
||||
if (!$config['allow_avatar_local'] && !$ignore_config)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
$avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
|
||||
break;
|
||||
|
||||
case AVATAR_REMOTE:
|
||||
if (!$config['allow_avatar_remote'] && !$ignore_config)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
break;
|
||||
$avatar_data = $avatar->get_data($row, $ignore_config);
|
||||
}
|
||||
else
|
||||
{
|
||||
$avatar_data['src'] = '';
|
||||
}
|
||||
|
||||
$avatar_img .= $avatar;
|
||||
return '<img src="' . (str_replace(' ', '%20', $avatar_img)) . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
|
||||
$html = '';
|
||||
|
||||
if (!empty($avatar_data['src']))
|
||||
{
|
||||
$html = '<img src="' . $avatar_data['src'] . '" ' .
|
||||
($avatar_data['width'] ? ('width="' . $avatar_data['width'] . '" ') : '') .
|
||||
($avatar_data['height'] ? ('height="' . $avatar_data['height'] . '" ') : '') .
|
||||
'alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user