From 040c2e9b78945ae6308286485ec9287db2d92133 Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Sat, 9 Jul 2022 14:57:01 -0500 Subject: [PATCH 1/2] [ticket/17003] Include topic icon on UCP front page Prosilver already supports rendering topic icons on this view, but the backend didn't populate the needed topicrow values. PHPBB3-17003 --- phpBB/includes/ucp/ucp_main.php | 13 ++++++++++--- phpBB/styles/prosilver/template/ucp_main_front.html | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 9e53a56286..8b5c1cba86 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -35,7 +35,7 @@ class ucp_main function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $phpbb_dispatcher; + global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $cache; global $request; switch ($mode) @@ -44,8 +44,8 @@ class ucp_main $user->add_lang('memberlist'); - $sql_from = TOPICS_TABLE . ' t '; - $sql_select = ''; + $sql_from = TOPICS_TABLE . ' t LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = t.forum_id) '; + $sql_select = ',f.enable_icons '; if ($config['load_db_track']) { @@ -137,6 +137,9 @@ class ucp_main } unset($topic_forum_list); + // Grab icons + $icons = $cache->obtain_icons(); + foreach ($topic_list as $topic_id) { $row = &$rowset[$topic_id]; @@ -176,10 +179,14 @@ class ucp_main 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, + 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', + 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', + 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', 'TOPIC_IMG_STYLE' => $folder_img, 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '', + 'S_TOPIC_ICONS' => $row['enable_icons'] ? true : false, 'S_USER_POSTED' => (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false, 'S_UNREAD' => $unread_topic, diff --git a/phpBB/styles/prosilver/template/ucp_main_front.html b/phpBB/styles/prosilver/template/ucp_main_front.html index 04b568f623..38a90007f9 100644 --- a/phpBB/styles/prosilver/template/ucp_main_front.html +++ b/phpBB/styles/prosilver/template/ucp_main_front.html @@ -14,7 +14,7 @@
  • -
    style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"> +
    style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;">
    From 7275f9e7f15b34147de365b286e76e7d0eb45c92 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 27 Jul 2022 18:17:46 +0200 Subject: [PATCH 2/2] [ticket/17003] Small code style adjustmens PHPBB3-17003 --- phpBB/includes/ucp/ucp_main.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 8b5c1cba86..65241dacd7 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -45,7 +45,7 @@ class ucp_main $user->add_lang('memberlist'); $sql_from = TOPICS_TABLE . ' t LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = t.forum_id) '; - $sql_select = ',f.enable_icons '; + $sql_select = ', f.enable_icons'; if ($config['load_db_track']) { @@ -179,9 +179,9 @@ class ucp_main 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, - 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', - 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', - 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', + 'TOPIC_ICON_IMG' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['img'] : '', + 'TOPIC_ICON_IMG_WIDTH' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['width'] : '', + 'TOPIC_ICON_IMG_HEIGHT' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['height'] : '', 'TOPIC_IMG_STYLE' => $folder_img, 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '',