mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 08:47:45 +02:00
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into feature/softdelete-1-permission
* 'develop' of https://github.com/phpbb/phpbb3: (234 commits) [ticket/11398] Correctly call permission_set method in permission tool [ticket/11394] Relax Migration Tools [ticket/11386] Fix missing ; [ticket/10714] Get log from container in install, update and download/file [feature/avatars] Update module_auth of ucp module and fix small issues [ticket/11396] Rename insert_migration to set_migration_state [ticket/11395] Prevent acp_modules::get_modules_info from reincluding files [ticket/11393] Give more information on database updater [ticket/11386] Send list of migrations instead of using load_migrations [feature/avatars] Add migrations data file for avatars [feature/avatars] Reduce module auth of ucp avatar settings [ticket/10714] Use $phpbb_adm_relative_path instead of hardcoded adm/ [ticket/10714] Logs are disabled for this page call only [ticket/10411] Fix call to function on non-object $db->...() [ticket/10411] Remove ajax delete, so the page is refreshed [feature/avatars] Auto-clear avatar dimensions when first changing avatars [ticket/10411] Update schema file with new table and remove the column [ticket/10411] Add unit tests for move() with values >1 [ticket/10411] Add migrations file for teampage table [ticket/10411] Revert database_update.php changes from for easier update ...
This commit is contained in:
@@ -1332,79 +1332,87 @@ 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 phpbb_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 phpbb_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 phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false)
|
||||
{
|
||||
$row = phpbb_avatar_manager::clean_row($user_row);
|
||||
return phpbb_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 phpbb_get_avatar($row, $alt, $ignore_config = false)
|
||||
{
|
||||
global $user, $config, $cache, $phpbb_root_path, $phpEx;
|
||||
global $request;
|
||||
global $phpbb_container;
|
||||
|
||||
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)
|
||||
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
|
||||
$driver = $phpbb_avatar_manager->get_driver($row['avatar_type'], $ignore_config);
|
||||
$html = '';
|
||||
|
||||
if ($driver)
|
||||
{
|
||||
case AVATAR_UPLOAD:
|
||||
if (!$config['allow_avatar_upload'] && !$ignore_config)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
$avatar_img = $phpbb_root_path . "download/file.$phpEx?avatar=";
|
||||
break;
|
||||
$html = $driver->get_custom_html($user, $row, $alt);
|
||||
if (!empty($html))
|
||||
{
|
||||
return $html;
|
||||
}
|
||||
|
||||
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 = $driver->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) . '" />';
|
||||
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