From 3f6abe056aca4706dfff6bbbda681a69f72f327d Mon Sep 17 00:00:00 2001 From: Christian Schnegelberger Date: Thu, 2 Feb 2023 18:02:54 +0100 Subject: [PATCH 1/2] [ticket/17004] Repair pagination func for global announce in ucp front PHPBB3-17004 --- phpBB/includes/ucp/ucp_main.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 65241dacd7..541ddaf128 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -36,7 +36,13 @@ class ucp_main function main($id, $mode) { global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $cache; - global $request; + global $request, $phpbb_container, $language; + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); switch ($mode) { @@ -105,6 +111,7 @@ class ucp_main $topic_list[] = $row['topic_id']; $rowset[$row['topic_id']] = $row; } + $topics_count = (int) $db->sql_fetchfield('topics_count'); $db->sql_freeresult($result); } @@ -152,6 +159,19 @@ class ucp_main $folder_img = ($unread_topic) ? $folder_new : $folder; $folder_alt = ($unread_topic) ? 'UNREAD_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_UNREAD_POSTS'); + // Replies + $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1; + + if ($topics_count) + { + $start = $pagination->validate_start($start, $config['topics_per_page'], $topics_count); + $pagination->generate_template_pagination($this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'TOTAL_TOPICS' => $language->lang('VIEW_FORUM_TOPICS', (int) $topics_count), + )); + } + if ($row['topic_status'] == ITEM_LOCKED) { $folder_img .= '_locked'; @@ -218,6 +238,8 @@ class ucp_main extract($phpbb_dispatcher->trigger_event('core.ucp_main_front_modify_template_vars', compact($vars))); $template->assign_block_vars('topicrow', $topicrow); + + $pagination->generate_template_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id"), 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); } if ($config['load_user_activity']) From 015c038d921c38dd86aaffff7eb40eab139f3a37 Mon Sep 17 00:00:00 2001 From: Christian Schnegelberger Date: Mon, 17 Apr 2023 18:44:03 +0200 Subject: [PATCH 2/2] [ticket/17004] Remove not needed if and topic_count PHPBB3-17004 --- phpBB/includes/ucp/ucp_main.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 541ddaf128..fea431f961 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -111,7 +111,6 @@ class ucp_main $topic_list[] = $row['topic_id']; $rowset[$row['topic_id']] = $row; } - $topics_count = (int) $db->sql_fetchfield('topics_count'); $db->sql_freeresult($result); } @@ -162,16 +161,6 @@ class ucp_main // Replies $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1; - if ($topics_count) - { - $start = $pagination->validate_start($start, $config['topics_per_page'], $topics_count); - $pagination->generate_template_pagination($this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start); - - $template->assign_vars(array( - 'TOTAL_TOPICS' => $language->lang('VIEW_FORUM_TOPICS', (int) $topics_count), - )); - } - if ($row['topic_status'] == ITEM_LOCKED) { $folder_img .= '_locked';