From 408986bf7d96d74a991bc748fcb2742baab81968 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Wed, 17 Jan 2018 12:16:04 -0600 Subject: [PATCH 1/2] Fixes #295 --- Upload/inc/plugins/asb/modules/latest_threads.php | 9 ++++----- Upload/inc/plugins/asb/modules/rand_quote.php | 6 +----- Upload/inc/plugins/asb/modules/staff_online_box.php | 5 +---- Upload/inc/plugins/asb/modules/top_poster.php | 5 +---- Upload/inc/plugins/asb/modules/welcome_box.php | 6 +----- Upload/inc/plugins/asb/modules/whosonline.php | 8 +------- 6 files changed, 9 insertions(+), 30 deletions(-) diff --git a/Upload/inc/plugins/asb/modules/latest_threads.php b/Upload/inc/plugins/asb/modules/latest_threads.php index 2e5290d..cc7173b 100644 --- a/Upload/inc/plugins/asb/modules/latest_threads.php +++ b/Upload/inc/plugins/asb/modules/latest_threads.php @@ -326,17 +326,16 @@ function asb_latest_threads_get_threadlist($settings, $width) $lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']); $lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']); - if (strlen(trim($thread['avatar'])) == 0) { - $thread['avatar'] = "{$theme['imgdir']}/default_avatar.png"; - } - $settings['avatar_width'] = trim($settings['avatar_width']); if (my_strpos($settings['avatar_width'], '%') == my_strlen($settings['avatar_width']) - 1) { $settings['avatar_width'] = (int) $width * (my_substr($settings['avatar_width'], 0, my_strlen($settings['avatar_width']) - 1) / 100); } $avatar_width = (int) min($width / 2, max($width / 8, $settings['avatar_width'])); + + $avatarInfo = format_avatar($thread['avatar']); + $avatar = << +{$thread['last_post']} EOF; $formatted_name = format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']); diff --git a/Upload/inc/plugins/asb/modules/rand_quote.php b/Upload/inc/plugins/asb/modules/rand_quote.php index a89a0ed..8d7fe65 100644 --- a/Upload/inc/plugins/asb/modules/rand_quote.php +++ b/Upload/inc/plugins/asb/modules/rand_quote.php @@ -303,11 +303,7 @@ function asb_rand_quote_get_quote($settings, $width) $parser_options = array('allow_smilies' => 1); $new_message = str_replace(array('
', '/me'), array('', " * {$plain_text_username}"), $parser->parse_message($new_message . ' ', $parser_options)); - // if the user has an avatar then display it, otherwise force the default avatar. - $avatar_filename = "{$theme['imgdir']}/default_avatar.png"; - if ($rand_post['avatar'] != '') { - $avatar_filename = $rand_post['avatar']; - } + $avatar_filename = format_avatar($rand_post['avatar'])['image']; $avatar_alt = $lang->sprintf($lang->asb_random_quote_users_profile, $plain_text_username); diff --git a/Upload/inc/plugins/asb/modules/staff_online_box.php b/Upload/inc/plugins/asb/modules/staff_online_box.php index 6834f9f..ab3b558 100644 --- a/Upload/inc/plugins/asb/modules/staff_online_box.php +++ b/Upload/inc/plugins/asb/modules/staff_online_box.php @@ -253,10 +253,7 @@ function asb_staff_online_box_get_online_staff($settings, $width) $staff_avatar_alt = $staff_avatar_title = $user['username'] . '\'s profile'; // if the user has an avatar then display it, otherwise force the default avatar. - $staff_avatar_filename = "{$theme['imgdir']}/default_avatar.png"; - if ($user['avatar'] != '') { - $staff_avatar_filename = $user['avatar']; - } + $staff_avatar_filename = format_avatar($user['avatar'])['image']; // avatar properties $staff_avatar_dimensions = '100%'; diff --git a/Upload/inc/plugins/asb/modules/top_poster.php b/Upload/inc/plugins/asb/modules/top_poster.php index 2251fb3..a9c50fb 100644 --- a/Upload/inc/plugins/asb/modules/top_poster.php +++ b/Upload/inc/plugins/asb/modules/top_poster.php @@ -329,10 +329,7 @@ function asb_top_poster_build_template($args) } } - $top_poster_avatar_src = "{$theme['imgdir']}/default_avatar.png"; - if ($user['avatar'] != '') { - $top_poster_avatar_src = $user['avatar']; - } + $top_poster_avatar_src = format_avatar($user['avatar'])['image']; $settings['avatar_size'] = trim($settings['avatar_size']); if (my_strpos($settings['avatar_size'], '%') == my_strlen($settings['avatar_size']) - 1) { diff --git a/Upload/inc/plugins/asb/modules/welcome_box.php b/Upload/inc/plugins/asb/modules/welcome_box.php index e111902..dcd8c23 100644 --- a/Upload/inc/plugins/asb/modules/welcome_box.php +++ b/Upload/inc/plugins/asb/modules/welcome_box.php @@ -141,11 +141,7 @@ function asb_welcome_box_build_template($args) $avatar_width = (int) ($width / 5); - // if the user has an avatar then display it, otherwise force the default avatar. - $avatar_filename = "{$theme['imgdir']}/default_avatar.png"; - if ($mybb->user['avatar'] != '') { - $avatar_filename = $mybb->user['avatar']; - } + $avatar_filename = format_avatar($mybb->user['avatar'])['image']; $user_avatar = <<{$mybb->user['username']}'s profile  diff --git a/Upload/inc/plugins/asb/modules/whosonline.php b/Upload/inc/plugins/asb/modules/whosonline.php index 8ec6d9e..7a9cfa8 100644 --- a/Upload/inc/plugins/asb/modules/whosonline.php +++ b/Upload/inc/plugins/asb/modules/whosonline.php @@ -242,13 +242,7 @@ function asb_whosonline_get_online_members($settings, $width) $user['profilelink'] = get_profile_link($user['uid']); if ($settings['show_avatars']) { - // If the user has an avatar then display it . . . - if ($user['avatar'] != '') { - $avatar_filename = $user['avatar']; - } else { - // . . . otherwise force the default avatar. - $avatar_filename = "{$theme['imgdir']}/default_avatar.png"; - } + $avatar_filename = format_avatar($user['avatar'])['image']; $avatar_height_style = " min-height: {$avatar_height}px; max-height: {$avatar_height}px;"; $avatar_width_style = " min-width: {$avatar_width}px; max-width: {$avatar_width}px;"; From a654c028d0052efd4c0a58e378d9622520b14ee3 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Wed, 17 Jan 2018 12:19:32 -0600 Subject: [PATCH 2/2] 3.1.11 Pre-release --- README.md | 2 +- Upload/inc/plugins/asb.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1f5a6e9..7cfe381 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Advanced-Sidebox 3.1.10 +## Advanced-Sidebox 3.1.11

Advanced Sidebox Logo diff --git a/Upload/inc/plugins/asb.php b/Upload/inc/plugins/asb.php index 5582d1b..ef763e8 100644 --- a/Upload/inc/plugins/asb.php +++ b/Upload/inc/plugins/asb.php @@ -15,7 +15,7 @@ // for modules define('IN_ASB', true); define('ASB_MODULES_DIR', MYBB_ROOT . 'inc/plugins/asb/modules'); -define('ASB_VERSION', '3.1.10'); +define('ASB_VERSION', '3.1.11'); define('ASB_CUSTOM_VERSION', '2.0'); define('ASB_SCRIPT_VERSION', '2.0');