diff options
author | Marc Alexander <admin@m-a-styles.de> | 2012-11-12 14:57:28 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2012-11-12 14:57:28 +0100 |
commit | 2265811cd16f6473807f647cba4693c5366324c6 (patch) | |
tree | ff27efb016da2f8adff55e2d343c1163d26219d8 /phpBB/includes/functions_display.php | |
parent | 5a5e507a14084b08e41c4d2f86f2fb6700e68eb5 (diff) | |
parent | 0e2a30a27b92a851221be489370217b9c7bf8e07 (diff) | |
download | forums-2265811cd16f6473807f647cba4693c5366324c6.tar forums-2265811cd16f6473807f647cba4693c5366324c6.tar.gz forums-2265811cd16f6473807f647cba4693c5366324c6.tar.bz2 forums-2265811cd16f6473807f647cba4693c5366324c6.tar.xz forums-2265811cd16f6473807f647cba4693c5366324c6.zip |
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
Diffstat (limited to 'phpBB/includes/functions_display.php')
-rw-r--r-- | phpBB/includes/functions_display.php | 117 |
1 files changed, 62 insertions, 55 deletions
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 73129803ee..f84652fc50 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -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; - - $overwrite_avatar = ''; + $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 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); +} - if ($overwrite_avatar) - { - return $overwrite_avatar; - } +/** +* 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 (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'], + ); + + $avatar = $phpbb_avatar_manager->get_driver($row['avatar_type']); - switch ($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; + $avatar_data = $avatar->get_data($row, $ignore_config); + } + else + { + $avatar_data['src'] = ''; + } - case AVATAR_REMOTE: - if (!$config['allow_avatar_remote'] && !$ignore_config) - { - return ''; - } - break; + $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) . '" />'; } - $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) . '" />'; + return $html; } /** |