diff options
Diffstat (limited to 'phpBB/includes/mcp/mcp_topic.php')
| -rw-r--r-- | phpBB/includes/mcp/mcp_topic.php | 12 | 
1 files changed, 4 insertions, 8 deletions
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index a2aa03c583..a4c561a3bf 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -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),  	));  }  | 
