aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-12-12 15:13:57 +0100
committerJoas Schilling <nickvergessen@gmx.de>2013-12-18 18:35:59 +0100
commita5b55e5ab4c063914228a36d32d541ddd0f67c36 (patch)
tree34bb417905ca2ef34602307cd43c59bc3044f7dd /phpBB/includes
parentdfe0526979e40f982c29b6fb371c0ec151df511a (diff)
downloadforums-a5b55e5ab4c063914228a36d32d541ddd0f67c36.tar
forums-a5b55e5ab4c063914228a36d32d541ddd0f67c36.tar.gz
forums-a5b55e5ab4c063914228a36d32d541ddd0f67c36.tar.bz2
forums-a5b55e5ab4c063914228a36d32d541ddd0f67c36.tar.xz
forums-a5b55e5ab4c063914228a36d32d541ddd0f67c36.zip
[ticket/11849] Update UCP notifications and pm folder
PHPBB3-11849
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/ucp/ucp_notifications.php6
-rw-r--r--phpBB/includes/ucp/ucp_pm_viewfolder.php17
2 files changed, 12 insertions, 11 deletions
diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php
index 63dbe79666..79055095bc 100644
--- a/phpBB/includes/ucp/ucp_notifications.php
+++ b/phpBB/includes/ucp/ucp_notifications.php
@@ -31,6 +31,7 @@ class ucp_notifications
$form_time = ($form_time <= 0 || $form_time > time()) ? time() : $form_time;
$phpbb_notifications = $phpbb_container->get('notification_manager');
+ $pagination = $phpbb_container->get('pagination');
switch ($mode)
{
@@ -137,10 +138,11 @@ class ucp_notifications
}
$base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=ucp_notifications&amp;mode=notification_list");
- phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $notifications['total_count'], $config['topics_per_page'], $start);
+ $start = $pagination->validate_start($start, $config['topics_per_page'], $notifications['total_count']);
+ $pagination->generate_template_pagination($base_url, 'pagination', 'start', $notifications['total_count'], $config['topics_per_page'], $start);
$template->assign_vars(array(
- 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $notifications['total_count'], $config['topics_per_page'], $start),
+ 'PAGE_NUMBER' => $pagination->on_page($base_url, $notifications['total_count'], $config['topics_per_page'], $start),
'TOTAL_COUNT' => $notifications['total_count'],
'U_MARK_ALL' => $base_url . '&amp;mark=all&amp;token=' . generate_link_hash('mark_all_notifications_read'),
));
diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php
index 9393e65f3c..0ea94835f2 100644
--- a/phpBB/includes/ucp/ucp_pm_viewfolder.php
+++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php
@@ -393,7 +393,7 @@ function view_folder($id, $mode, $folder_id, $folder)
*/
function get_pm_from($folder_id, $folder, $user_id)
{
- global $user, $db, $template, $config, $auth, $phpbb_root_path, $phpEx;
+ global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx;
$start = request_var('start', 0);
@@ -402,6 +402,8 @@ function get_pm_from($folder_id, $folder, $user_id)
$sort_key = request_var('sk', 't');
$sort_dir = request_var('sd', 'd');
+ $pagination = $phpbb_container->get('pagination');
+
// PM ordering options
$limit_days = array(0 => $user->lang['ALL_MESSAGES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
@@ -452,10 +454,11 @@ function get_pm_from($folder_id, $folder, $user_id)
}
$base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&amp;mode=view&amp;action=view_folder&amp;f=$folder_id&amp;$u_sort_param");
- phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start);
+ $start = $pagination->validate_start($start, $config['topics_per_page'], $pm_count);
+ $pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start);
$template->assign_vars(array(
- 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $pm_count, $config['topics_per_page'], $start),
+ 'PAGE_NUMBER' => $pagination->on_page($base_url, $pm_count, $config['topics_per_page'], $start),
'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count),
'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'),
@@ -481,14 +484,10 @@ function get_pm_from($folder_id, $folder, $user_id)
{
$store_reverse = true;
- if ($start + $config['topics_per_page'] > $pm_count)
- {
- $sql_limit = min($config['topics_per_page'], max(1, $pm_count - $start));
- }
-
// Select the sort order
$direction = ($sort_dir == 'd') ? 'ASC' : 'DESC';
- $sql_start = max(0, $pm_count - $sql_limit - $start);
+ $sql_limit = $pagination->reverse_limit($start, $sql_limit, $pm_count);
+ $sql_start = $pagination->reverse_start($start, $sql_limit, $pm_count);
}
else
{