aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_groups.php25
-rw-r--r--phpBB/includes/acp/acp_modules.php4
-rw-r--r--phpBB/includes/acp/acp_users.php25
-rw-r--r--phpBB/includes/db/mssql_odbc.php8
-rw-r--r--phpBB/includes/functions_admin.php6
-rw-r--r--phpBB/includes/functions_display.php39
-rwxr-xr-xphpBB/includes/mcp/mcp_notes.php24
-rwxr-xr-xphpBB/includes/mcp/mcp_warn.php48
-rw-r--r--phpBB/includes/message_parser.php13
-rw-r--r--phpBB/includes/session.php1
-rw-r--r--phpBB/includes/ucp/ucp_groups.php25
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php4
-rw-r--r--phpBB/includes/ucp/ucp_pm_viewmessage.php54
-rw-r--r--phpBB/includes/ucp/ucp_profile.php24
14 files changed, 99 insertions, 201 deletions
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index cbf46a1dc1..29000b2c63 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -235,6 +235,8 @@ class acp_groups
case 'edit':
case 'add':
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+
$data = $submit_ary = array();
if ($action == 'edit' && !$group_id)
@@ -486,28 +488,7 @@ class acp_groups
$type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : '';
$type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : '';
- if (isset($group_row['group_avatar']) && $group_row['group_avatar'])
- {
- $avatar_img = '';
-
- switch ($group_row['group_avatar_type'])
- {
- case AVATAR_UPLOAD:
- $avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
- break;
-
- case AVATAR_GALLERY:
- $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
- break;
- }
-
- $avatar_img .= $group_row['group_avatar'];
- $avatar_img = '<img src="' . $avatar_img . '" width="' . $group_row['group_avatar_width'] . '" height="' . $group_row['group_avatar_height'] . '" alt="" />';
- }
- else
- {
- $avatar_img = '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
- }
+ $avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index 585549fb99..8b54589707 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -741,6 +741,10 @@ class acp_modules
trigger_error($user->lang['PARENT_NO_EXIST'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
}
+ // Workaround
+ $row['left_id'] = (int) $row['left_id'];
+ $row['right_id'] = (int) $row['right_id'];
+
$sql = 'UPDATE ' . MODULES_TABLE . "
SET left_id = left_id + 2, right_id = right_id + 2
WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "'
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 54fa34677e..7312dd3bf0 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -1336,6 +1336,8 @@ class acp_users
case 'avatar':
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
if ($submit)
@@ -1350,28 +1352,7 @@ class acp_users
}
// Generate users avatar
- if ($user_row['user_avatar'])
- {
- $avatar_img = '';
-
- switch ($user_row['user_avatar_type'])
- {
- case AVATAR_UPLOAD:
- $avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
- break;
-
- case AVATAR_GALLERY:
- $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
- break;
- }
-
- $avatar_img .= $user_row['user_avatar'];
- $avatar_img = '<img src="' . $avatar_img . '" width="' . $user_row['user_avatar_width'] . '" height="' . $user_row['user_avatar_height'] . '" alt="" />';
- }
- else
- {
- $avatar_img = '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
- }
+ $avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
$avatar_select = basename(request_var('avatar_select', ''));
diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php
index ab3bd2a164..5fa14a66b6 100644
--- a/phpBB/includes/db/mssql_odbc.php
+++ b/phpBB/includes/db/mssql_odbc.php
@@ -22,6 +22,11 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
* Unified ODBC functions
* Unified ODBC functions support any database having ODBC driver, for example Adabas D, IBM DB2, iODBC, Solid, Sybase SQL Anywhere...
* Here we only support MSSQL Server 2000+ because of the provided schema
+*
+* @note number of bytes returned for returning data depends on odbc.defaultlrl php.ini setting.
+* If it is limited to 4K for example only 4K of data is returned max, resulting in incomplete theme data for example.
+* @note odbc.defaultbinmode may affect UTF8 characters
+*
* @package dbal
*/
class dbal_mssql_odbc extends dbal
@@ -195,8 +200,9 @@ class dbal_mssql_odbc extends dbal
/**
* Fetch current row
+ * @note number of bytes returned depends on odbc.defaultlrl php.ini setting. If it is limited to 4K for example only 4K of data is returned max.
*/
- function sql_fetchrow($query_id = false)
+ function sql_fetchrow($query_id = false, $debug = false)
{
global $cache;
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 7437255f2f..07d0a5d4c2 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -1352,13 +1352,13 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$post_ids = array();
while ($row = $db->sql_fetchrow($result))
{
- if (!isset($post_attachment[$row['post_id']]))
+ if (!isset($post_attachment[$row['post_msg_id']]))
{
- $post_ids[] = $row['post_id'];
+ $post_ids[] = $row['post_msg_id'];
}
else
{
- unset($post_attachment[$row['post_id']]);
+ unset($post_attachment[$row['post_msg_id']]);
}
}
$db->sql_freeresult($result);
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 23e2cd4106..01f694afd1 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -706,7 +706,7 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold
{
$topic_type = $user->lang['VIEW_TOPIC_MOVED'];
$folder_img = 'topic_moved';
- $folder_alt = 'VIEW_TOPIC_MOVED';
+ $folder_alt = 'TOPIC_MOVED';
}
else
{
@@ -1096,4 +1096,41 @@ 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 string $alt Optional language string for alt tag within image, can be a language key or text
+*
+* @return string Avatar image
+*/
+function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR')
+{
+ global $user, $config, $phpbb_root_path;
+
+ if (empty($avatar) || !$avatar_type)
+ {
+ return '';
+ }
+
+ $avatar_img = '';
+
+ switch ($avatar_type)
+ {
+ case AVATAR_UPLOAD:
+ $avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
+ break;
+
+ case AVATAR_GALLERY:
+ $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
+ break;
+ }
+
+ $avatar_img .= $avatar;
+ return '<img src="' . $avatar_img . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
+}
+
?> \ No newline at end of file
diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php
index 1b3c36ac22..9d4b522fe4 100755
--- a/phpBB/includes/mcp/mcp_notes.php
+++ b/phpBB/includes/mcp/mcp_notes.php
@@ -141,28 +141,14 @@ class mcp_notes
}
// Generate the appropriate user information for the user we are looking at
- $rank_title = $rank_img = '';
-// get_user_rank($userrow['user_rank'], $userrow['user_posts'], $rank_title, $rank_img);
-
- $avatar_img = '';
-
- if (!empty($userrow['user_avatar']))
+ if (!function_exists('get_user_avatar'))
{
- switch ($userrow['user_avatar_type'])
- {
- case AVATAR_UPLOAD:
- $avatar_img = $config['avatar_path'] . '/';
- break;
-
- case AVATAR_GALLERY:
- $avatar_img = $config['avatar_gallery_path'] . '/';
- break;
- }
-
- $avatar_img .= $userrow['user_avatar'];
- $avatar_img = '<img src="' . $avatar_img . '" width="' . $userrow['user_avatar_width'] . '" height="' . $userrow['user_avatar_height'] . '" alt="" />';
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}
+ $rank_title = $rank_img = '';
+ $avatar_img = get_user_avatar($userrow['user_avatar'], $userrow['user_avatar_type'], $userrow['user_avatar_width'], $userrow['user_avatar_height']);
+
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_IP'], 'd' => $user->lang['SORT_ACTION']);
$sort_by_sql = array('a' => 'u.username_clean', 'b' => 'l.log_time', 'c' => 'l.log_ip', 'd' => 'l.log_operation');
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php
index ea414d2bfd..6d3961de2f 100755
--- a/phpBB/includes/mcp/mcp_warn.php
+++ b/phpBB/includes/mcp/mcp_warn.php
@@ -272,28 +272,14 @@ function mcp_warn_post_view($id, $mode, $action)
$message = smiley_text($message);
// Generate the appropriate user information for the user we are looking at
- $rank_title = $rank_img = '';
-// get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img);
-
- $avatar_img = '';
-
- if (!empty($user_row['user_avatar']))
+ if (!function_exists('get_user_avatar'))
{
- switch ($user_row['user_avatar_type'])
- {
- case AVATAR_UPLOAD:
- $avatar_img = $config['avatar_path'] . '/';
- break;
-
- case AVATAR_GALLERY:
- $avatar_img = $config['avatar_gallery_path'] . '/';
- break;
- }
-
- $avatar_img .= $user_row['user_avatar'];
- $avatar_img = '<img src="' . $avatar_img . '" width="' . $user_row['user_avatar_width'] . '" height="' . $user_row['user_avatar_height'] . '" alt="" />';
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}
+ $rank_title = $rank_img = '';
+ $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']);
+
$template->assign_vars(array(
'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;mode=$mode&amp;p=$post_id"),
@@ -357,28 +343,14 @@ function mcp_warn_user_view($id, $mode, $action)
}
// Generate the appropriate user information for the user we are looking at
- $rank_title = $rank_img = '';
-// get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img);
-
- $avatar_img = '';
-
- if (!empty($user_row['user_avatar']))
+ if (!function_exists('get_user_avatar'))
{
- switch ($user_row['user_avatar_type'])
- {
- case AVATAR_UPLOAD:
- $avatar_img = $config['avatar_path'] . '/';
- break;
-
- case AVATAR_GALLERY:
- $avatar_img = $config['avatar_gallery_path'] . '/';
- break;
- }
-
- $avatar_img .= $user_row['user_avatar'];
- $avatar_img = '<img src="' . $avatar_img . '" width="' . $user_row['user_avatar_width'] . '" height="' . $user_row['user_avatar_height'] . '" alt="" />';
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}
+ $rank_title = $rank_img = '';
+ $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']);
+
// OK, they didn't submit a warning so lets build the page for them to do so
$template->assign_vars(array(
'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;mode=$mode&amp;u=$user_id"),
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 97e977a42b..44bebc20c6 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -200,6 +200,8 @@ class bbcode_firstpass extends bbcode
if ($config['max_' . $this->mode . '_font_size'] && $config['max_' . $this->mode . '_font_size'] < $stx)
{
$this->warn_msg[] = sprintf($user->lang['MAX_FONT_SIZE_EXCEEDED'], $config['max_' . $this->mode . '_font_size']);
+
+ return '[size=' . $stx . ']' . $in . '[/size]';
}
return '[size=' . $stx . ':' . $this->bbcode_uid . ']' . $in . '[/size:' . $this->bbcode_uid . ']';
@@ -270,6 +272,7 @@ class bbcode_firstpass extends bbcode
}
$in = trim($in);
+ $error = false;
if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width'])
{
@@ -277,23 +280,26 @@ class bbcode_firstpass extends bbcode
if ($stats === false)
{
+ $error = true;
$this->warn_msg[] = $user->lang['UNABLE_GET_IMAGE_SIZE'];
}
else
{
if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $stats[1])
{
+ $error = true;
$this->warn_msg[] = sprintf($user->lang['MAX_IMG_HEIGHT_EXCEEDED'], $config['max_' . $this->mode . '_img_height']);
}
if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $stats[0])
{
+ $error = true;
$this->warn_msg[] = sprintf($user->lang['MAX_IMG_WIDTH_EXCEEDED'], $config['max_' . $this->mode . '_img_width']);
}
}
}
- if ($this->path_in_domain($in))
+ if ($error || $this->path_in_domain($in))
{
return '[img]' . $in . '[/img]';
}
@@ -314,22 +320,25 @@ class bbcode_firstpass extends bbcode
}
$in = trim($in);
+ $error = false;
// Apply the same size checks on flash files as on images
if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width'])
{
if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $height)
{
+ $error = true;
$this->warn_msg[] = sprintf($user->lang['MAX_FLASH_HEIGHT_EXCEEDED'], $config['max_' . $this->mode . '_img_height']);
}
if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $width)
{
+ $error = true;
$this->warn_msg[] = sprintf($user->lang['MAX_FLASH_WIDTH_EXCEEDED'], $config['max_' . $this->mode . '_img_width']);
}
}
- if ($this->path_in_domain($in))
+ if ($error || $this->path_in_domain($in))
{
return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]';
}
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 1dfeb43fd3..bc608426b9 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -55,7 +55,6 @@ class session
if (strpos($argument, 'sid=') === 0 || strpos($argument, '_f_=') === 0)
{
unset($args[$key]);
- break;
}
}
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 5445d661b7..519c0220e7 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -419,6 +419,8 @@ class ucp_groups
{
case 'edit':
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+
if (!$group_id)
{
trigger_error($user->lang['NO_GROUP'] . $return_page);
@@ -626,28 +628,7 @@ class ucp_groups
$type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : '';
$type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : '';
- if (isset($group_row['group_avatar']) && $group_row['group_avatar'])
- {
- $avatar_img = '';
-
- switch ($group_row['group_avatar_type'])
- {
- case AVATAR_UPLOAD:
- $avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
- break;
-
- case AVATAR_GALLERY:
- $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
- break;
- }
-
- $avatar_img .= $group_row['group_avatar'];
- $avatar_img = '<img src="' . $avatar_img . '" width="' . $group_row['group_avatar_width'] . '" height="' . $group_row['group_avatar_height'] . '" alt="" />';
- }
- else
- {
- $avatar_img = '<img src="' . $phpbb_root_path . 'adm/images/no_avatar.gif" alt="" />';
- }
+ $avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . $phpbb_root_path . 'adm/images/no_avatar.gif" alt="" />';
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index b6f737ceb9..6c9bfdbdb3 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -91,8 +91,8 @@ function compose_pm($id, $mode, $action)
'S_SHOW_PM_BOX' => true,
'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false,
'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? $group_options : '',
- 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&amp;form=post&amp;field=username_list&amp;select_single=$select_single"),
- 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=post&field=username_list&select_single=$select_single", false))
+ 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&amp;form=postform&amp;field=username_list&amp;select_single=$select_single"),
+ 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=postform&field=username_list&select_single=$select_single", false))
);
}
diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php
index 056a84c8e7..ff760e9142 100644
--- a/phpBB/includes/ucp/ucp_pm_viewmessage.php
+++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php
@@ -390,8 +390,9 @@ function get_user_information($user_id, $user_row)
$db->sql_freeresult($result);
}
- // Grab ranks
- $ranks = $cache->obtain_ranks();
+ // Some standard values
+ $user_row['online'] = false;
+ $user_row['rank_title'] = $user_row['rank_image'] = $user_row['rank_image_src'] = $user_row['email'] = '';
// Generate online information for user
if ($config['load_onlinetrack'])
@@ -410,61 +411,20 @@ function get_user_information($user_id, $user_row)
$user_row['online'] = (time() - $update_time < $row['online_time'] && ($row['viewonline'] && $user_row['user_allow_viewonline'])) ? true : false;
}
}
- else
- {
- $user_row['online'] = false;
- }
- if ($user_row['user_avatar'] && $user->optionget('viewavatars'))
+ if (!function_exists('get_user_avatar'))
{
- $avatar_img = '';
-
- switch ($user_row['user_avatar_type'])
- {
- case AVATAR_UPLOAD:
- $avatar_img = $config['avatar_path'] . '/';
- break;
-
- case AVATAR_GALLERY:
- $avatar_img = $config['avatar_gallery_path'] . '/';
- break;
- }
-
- $avatar_img .= $user_row['user_avatar'];
- $user_row['avatar'] = '<img src="' . $avatar_img . '" width="' . $user_row['user_avatar_width'] . '" height="' . $user_row['user_avatar_height'] . '" alt="' . $user->lang['USER_AVATAR'] . '" />';
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}
- $user_row['rank_title'] = $user_row['rank_image'] = '';
+ $user_row['avatar'] = ($user->optionget('viewavatars')) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : '';
- if (!empty($user_row['user_rank']))
- {
- $user_row['rank_title'] = (isset($ranks['special'][$user_row['user_rank']])) ? $ranks['special'][$user_row['user_rank']]['rank_title'] : '';
- $user_row['rank_image'] = (!empty($ranks['special'][$user_row['user_rank']]['rank_image'])) ? '<img src="' . $config['ranks_path'] . '/' . $ranks['special'][$user_row['user_rank']]['rank_image'] . '" alt="' . $ranks['special'][$user_row['user_rank']]['rank_title'] . '" title="' . $ranks['special'][$user_row['user_rank']]['rank_title'] . '" /><br />' : '';
- }
- else
- {
- if (isset($ranks['normal']))
- {
- foreach ($ranks['normal'] as $rank)
- {
- if ($user_row['user_posts'] >= $rank['rank_min'])
- {
- $user_row['rank_title'] = $rank['rank_title'];
- $user_row['rank_image'] = (!empty($rank['rank_image'])) ? '<img src="' . $config['ranks_path'] . '/' . $rank['rank_image'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" /><br />' : '';
- break;
- }
- }
- }
- }
+ get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']);
if (!empty($user_row['user_allow_viewemail']) || $auth->acl_get('a_email'))
{
$user_row['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&amp;u=$user_id") : ((($config['board_hide_emails'] && !$auth->acl_get('a_email')) || empty($user_row['user_email'])) ? '' : 'mailto:' . $user_row['user_email']);
}
- else
- {
- $user_row['email'] = '';
- }
return $user_row;
}
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index 8c9a9bdccf..3cee288098 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -507,6 +507,8 @@ class ucp_profile
case 'avatar':
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+
$display_gallery = request_var('display_gallery', '0');
$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));
@@ -526,29 +528,9 @@ class ucp_profile
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
- // Generate users avatar
- $avatar_img = '';
-
- if ($user->data['user_avatar'])
- {
- switch ($user->data['user_avatar_type'])
- {
- case AVATAR_UPLOAD:
- $avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
- break;
-
- case AVATAR_GALLERY:
- $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
- break;
- }
-
- $avatar_img .= $user->data['user_avatar'];
- $avatar_img = '<img src="' . $avatar_img . '" width="' . $user->data['user_avatar_width'] . '" height="' . $user->data['user_avatar_height'] . '" alt="" />';
- }
-
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
- 'AVATAR' => $avatar_img,
+ 'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
'AVATAR_SIZE' => $config['avatar_filesize'],
'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&amp;mode=avatar&amp;display_gallery=1'),