mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
Merge remote-tracking branch 'nickvergessen/feature/pagination-class' into develop
# By Joas Schilling # Via Joas Schilling * nickvergessen/feature/pagination-class: [ticket/11849] Fix more function calls [ticket/11849] Update more MCP calls to pagination class [ticket/11849] Update some ACP modules with new pagination [ticket/11849] Update rest of the UCP modules [ticket/11849] Update UCP notifications and pm folder [ticket/11849] Update search and memberlist [ticket/11849] Update pagination in viewonline.php [ticket/11849] Remove old pagination test [ticket/11849] Update pagination code in viewtopic.php [ticket/11849] Replace pagination in viewforum.php with class [ticket/11849] Add service definition [ticket/11849] Remove pagination functions [ticket/11849] Test validate_start and on_page [ticket/11849] Move pagination code to class
This commit is contained in:
@@ -73,6 +73,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||
break;
|
||||
}
|
||||
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
|
||||
$selected_ids = '';
|
||||
if (sizeof($post_id_list) && $action != 'merge_topics')
|
||||
{
|
||||
@@ -102,7 +104,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||
|
||||
$base_url = $url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : '');
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $forum_topics, $topics_per_page, $start);
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $forum_topics, $topics_per_page, $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'ACTION' => $action,
|
||||
@@ -133,7 +135,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||
|
||||
'S_MCP_ACTION' => $url . "&i=$id&forum_action=$action&mode=$mode&start=$start" . (($merge_select) ? $selected_ids : ''),
|
||||
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $forum_topics, $topics_per_page, $start),
|
||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $forum_topics, $topics_per_page, $start),
|
||||
'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $forum_topics),
|
||||
));
|
||||
|
||||
|
@@ -33,7 +33,7 @@ class mcp_logs
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $auth, $db, $user, $template;
|
||||
global $config, $phpbb_root_path, $phpEx;
|
||||
global $config, $phpbb_root_path, $phpEx, $phpbb_container;
|
||||
|
||||
$user->add_lang('acp/common');
|
||||
|
||||
@@ -62,6 +62,8 @@ class mcp_logs
|
||||
$this->tpl_name = 'mcp_logs';
|
||||
$this->page_title = 'MCP_LOGS';
|
||||
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
|
||||
$forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_')));
|
||||
$forum_list[] = 0;
|
||||
|
||||
@@ -172,10 +174,10 @@ class mcp_logs
|
||||
$start = view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords);
|
||||
|
||||
$base_url = $this->u_action . "&$u_sort_param$keywords_param";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start),
|
||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start),
|
||||
'TOTAL' => $user->lang('TOTAL_LOGS', (int) $log_count),
|
||||
|
||||
'L_TITLE' => $user->lang['MCP_LOGS'],
|
||||
|
@@ -72,7 +72,7 @@ class mcp_notes
|
||||
function mcp_notes_user_view($action)
|
||||
{
|
||||
global $phpEx, $phpbb_root_path, $config;
|
||||
global $template, $db, $user, $auth;
|
||||
global $template, $db, $user, $auth, $phpbb_container;
|
||||
|
||||
$user_id = request_var('u', 0);
|
||||
$username = request_var('username', '', true);
|
||||
@@ -80,6 +80,7 @@ class mcp_notes
|
||||
$st = request_var('st', 0);
|
||||
$sk = request_var('sk', 'b');
|
||||
$sd = request_var('sd', 'd');
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
|
||||
add_form_key('mcp_notes');
|
||||
|
||||
@@ -216,7 +217,7 @@ class mcp_notes
|
||||
}
|
||||
|
||||
$base_url = $this->u_action . "&$u_sort_param$keywords_param";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_POST_ACTION' => $this->u_action,
|
||||
@@ -228,7 +229,7 @@ class mcp_notes
|
||||
|
||||
'L_TITLE' => $user->lang['MCP_NOTES_USER'],
|
||||
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start),
|
||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start),
|
||||
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $log_count),
|
||||
|
||||
'RANK_TITLE' => $rank_title,
|
||||
|
@@ -39,6 +39,7 @@ class mcp_pm_reports
|
||||
include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
|
||||
|
||||
$start = request_var('start', 0);
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
|
||||
$this->page_title = 'MCP_PM_REPORTS';
|
||||
|
||||
@@ -297,7 +298,7 @@ class mcp_pm_reports
|
||||
}
|
||||
|
||||
$base_url = $this->u_action . "&st=$sort_days&sk=$sort_key&sd=$sort_dir";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
|
||||
|
||||
// Now display the page
|
||||
$template->assign_vars(array(
|
||||
@@ -308,7 +309,7 @@ class mcp_pm_reports
|
||||
'S_MCP_ACTION' => $this->u_action,
|
||||
'S_CLOSED' => ($mode == 'pm_reports_closed') ? true : false,
|
||||
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start),
|
||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),
|
||||
'TOTAL' => $total,
|
||||
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total),
|
||||
)
|
||||
|
@@ -337,6 +337,7 @@ class mcp_queue
|
||||
|
||||
$topic_id = $request->variable('t', 0);
|
||||
$forum_info = array();
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
|
||||
if ($topic_id)
|
||||
{
|
||||
@@ -532,7 +533,7 @@ class mcp_queue
|
||||
unset($rowset, $forum_names);
|
||||
|
||||
$base_url = $this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
|
||||
|
||||
// Now display the page
|
||||
$template->assign_vars(array(
|
||||
@@ -546,7 +547,7 @@ class mcp_queue
|
||||
'S_TOPICS' => $is_topics,
|
||||
'S_RESTORE' => $is_restore,
|
||||
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start),
|
||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),
|
||||
'TOPIC_ID' => $topic_id,
|
||||
'TOTAL' => $user->lang(((!$is_topics) ? 'VIEW_TOPIC_POSTS' : 'VIEW_FORUM_TOPICS'), (int) $total),
|
||||
));
|
||||
|
@@ -315,6 +315,7 @@ class mcp_reports
|
||||
|
||||
$forum_list[] = 0;
|
||||
$forum_data = array();
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
|
||||
$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
|
||||
foreach ($forum_list_reports as $row)
|
||||
@@ -410,7 +411,7 @@ class mcp_reports
|
||||
}
|
||||
|
||||
$base_url = $this->u_action . "&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
|
||||
|
||||
// Now display the page
|
||||
$template->assign_vars(array(
|
||||
@@ -422,7 +423,7 @@ class mcp_reports
|
||||
'S_FORUM_OPTIONS' => $forum_options,
|
||||
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
|
||||
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start),
|
||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),
|
||||
'TOPIC_ID' => $topic_id,
|
||||
'TOTAL' => $total,
|
||||
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total),
|
||||
|
@@ -26,6 +26,7 @@ function mcp_topic_view($id, $mode, $action)
|
||||
$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url());
|
||||
|
||||
$user->add_lang('viewtopic');
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
|
||||
$topic_id = request_var('t', 0);
|
||||
$topic_info = get_topic_data(array($topic_id), false, true);
|
||||
@@ -129,12 +130,7 @@ function mcp_topic_view($id, $mode, $action)
|
||||
{
|
||||
$start = 0;
|
||||
}
|
||||
|
||||
// Make sure $start is set to the last page if it exceeds the amount
|
||||
if ($start < 0 || $start >= $total)
|
||||
{
|
||||
$start = ($start < 0) ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page;
|
||||
}
|
||||
$start = $pagination->validate_start($start, $posts_per_page, $total);
|
||||
|
||||
$sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||
@@ -304,7 +300,7 @@ function mcp_topic_view($id, $mode, $action)
|
||||
$base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir");
|
||||
if ($posts_per_page)
|
||||
{
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $posts_per_page, $start);
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $posts_per_page, $start);
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
@@ -347,7 +343,7 @@ function mcp_topic_view($id, $mode, $action)
|
||||
'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_info['forum_id']}&t={$topic_info['topic_id']}&start=$start") . '">', '</a>'),
|
||||
'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$topic_info['forum_id']}&start=$start") . '">', '</a>'),
|
||||
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $posts_per_page, $start),
|
||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $posts_per_page, $start),
|
||||
'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total),
|
||||
));
|
||||
}
|
||||
|
@@ -134,10 +134,11 @@ class mcp_warn
|
||||
*/
|
||||
function mcp_warn_list_view($action)
|
||||
{
|
||||
global $phpEx, $phpbb_root_path, $config;
|
||||
global $phpEx, $phpbb_root_path, $config, $phpbb_container;
|
||||
global $template, $db, $user, $auth;
|
||||
|
||||
$user->add_lang('memberlist');
|
||||
$pagination = $phpbb_container->get('pagination');
|
||||
|
||||
$start = request_var('start', 0);
|
||||
$st = request_var('st', 0);
|
||||
@@ -176,7 +177,7 @@ class mcp_warn
|
||||
}
|
||||
|
||||
$base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&mode=list&st=$st&sk=$sk&sd=$sd");
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $user_count, $config['topics_per_page'], $start);
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $user_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_POST_ACTION' => $this->u_action,
|
||||
@@ -185,7 +186,7 @@ class mcp_warn
|
||||
'S_SELECT_SORT_KEY' => $s_sort_key,
|
||||
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
||||
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $user_count, $config['topics_per_page'], $start),
|
||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $user_count, $config['topics_per_page'], $start),
|
||||
'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $user_count),
|
||||
));
|
||||
}
|
||||
|
Reference in New Issue
Block a user