diff options
Diffstat (limited to 'phpBB')
53 files changed, 303 insertions, 569 deletions
diff --git a/phpBB/adm/style/acp_attachments.html b/phpBB/adm/style/acp_attachments.html index f3d67d2bfa..bdec9eb3cb 100644 --- a/phpBB/adm/style/acp_attachments.html +++ b/phpBB/adm/style/acp_attachments.html @@ -379,20 +379,11 @@ <legend>{L_TITLE}</legend> <div class="pagination"> - <!-- IF .pagination or TOTAL_FILES --> - {L_NUMBER_FILES}: {TOTAL_FILES} • {L_TOTAL_SIZE}: {TOTAL_SIZE} • + <!-- IF .pagination or TOTAL_FILES --> + {L_NUMBER_FILES}: {TOTAL_FILES} • {L_TOTAL_SIZE}: {TOTAL_SIZE} <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> - <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --><li><a href="{pagination.PAGE_URL}">{L_NEXT}</a></li> - <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + • + <!-- INCLUDE pagination.html --> <!-- ELSE --> {S_ON_PAGE} <!-- ENDIF --> diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index ca68bc7528..6e52880131 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -241,17 +241,7 @@ </table> <div class="pagination"> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> - <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --><li><a href="{pagination.PAGE_URL}">{L_NEXT}</a></li> - <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ENDIF --> </div> diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index 6f42165414..b9af20d5a2 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -257,16 +257,7 @@ </table> <div class="pagination"> <!-- IF .pagination --> - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> - <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --><li><a href="{pagination.PAGE_URL}">{L_NEXT}</a></li> - <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ENDIF --> </div> <p class="quick"> diff --git a/phpBB/adm/style/acp_inactive.html b/phpBB/adm/style/acp_inactive.html index 12cc11d742..ad5871f291 100644 --- a/phpBB/adm/style/acp_inactive.html +++ b/phpBB/adm/style/acp_inactive.html @@ -12,17 +12,7 @@ <div class="pagination"> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> - <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --><li><a href="{pagination.PAGE_URL}">{L_NEXT}</a></li> - <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ENDIF --> </div> diff --git a/phpBB/adm/style/acp_logs.html b/phpBB/adm/style/acp_logs.html index 3b2d448a44..16638a5a72 100644 --- a/phpBB/adm/style/acp_logs.html +++ b/phpBB/adm/style/acp_logs.html @@ -14,17 +14,7 @@ <div class="pagination" style="float: right; margin: 15px 0 2px 0"> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> - <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --><li><a href="{pagination.PAGE_URL}">{L_NEXT}</a></li> - <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ENDIF --> </div> diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html index 02cdab55b2..837629255b 100644 --- a/phpBB/adm/style/acp_users.html +++ b/phpBB/adm/style/acp_users.html @@ -159,17 +159,7 @@ <div class="pagination"> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> - <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --><li><a href="{pagination.PAGE_URL}">{L_NEXT}</a></li> - <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ENDIF --> </div> @@ -208,17 +198,7 @@ <hr /> <div class="pagination"> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> - <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --><li><a href="{pagination.PAGE_URL}">{L_NEXT}</a></li> - <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ENDIF --> </div> diff --git a/phpBB/adm/style/acp_users_feedback.html b/phpBB/adm/style/acp_users_feedback.html index 6b7761ed46..1dad7f1927 100644 --- a/phpBB/adm/style/acp_users_feedback.html +++ b/phpBB/adm/style/acp_users_feedback.html @@ -2,17 +2,7 @@ <div class="pagination"> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> - <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --><li><a href="{pagination.PAGE_URL}">{L_NEXT}</a></li> - <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ENDIF --> </div> @@ -56,17 +46,7 @@ <hr /> <div class="pagination"> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> - <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --><li><a href="{pagination.PAGE_URL}">{L_NEXT}</a></li> - <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ENDIF --> </div> diff --git a/phpBB/adm/style/pagination.html b/phpBB/adm/style/pagination.html new file mode 100644 index 0000000000..d62d0b6a81 --- /dev/null +++ b/phpBB/adm/style/pagination.html @@ -0,0 +1,12 @@ + + <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • + <ul> + <!-- BEGIN pagination --> + <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> + <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> + <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> + <!-- ELSEIF pagination.S_IS_NEXT --><li><a href="{pagination.PAGE_URL}">{L_NEXT}</a></li> + <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> + <!-- ENDIF --> + <!-- END pagination --> + </ul> diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 4b621cb18d..62533b376f 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -1222,13 +1222,14 @@ class acp_attachments } $db->sql_freeresult($result); - generate_pagination($this->u_action . "&$u_sort_param", $num_files, $attachments_per_page, $start); + $base_url = $this->u_action . "&$u_sort_param"; + generate_template_pagination($base_url, 'pagination', $num_files, $attachments_per_page, $start); $template->assign_vars(array( 'TOTAL_FILES' => $num_files, 'TOTAL_SIZE' => get_formatted_filesize($total_size), - 'S_ON_PAGE' => on_page($num_files, $attachments_per_page, $start), + 'S_ON_PAGE' => on_page($base_url, $num_files, $attachments_per_page, $start), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir) diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index ded28252dc..2407137012 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -682,14 +682,15 @@ class acp_groups $s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>'; } - generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&action=$action&g=$group_id"; + generate_template_pagination($base_url, 'pagination', $total_members, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_LIST' => true, 'S_GROUP_SPECIAL' => ($group_row['group_type'] == GROUP_SPECIAL) ? true : false, 'S_ACTION_OPTIONS' => $s_action_options, - 'S_ON_PAGE' => on_page($total_members, $config['topics_per_page'], $start), + 'S_ON_PAGE' => on_page($base_url, $total_members, $config['topics_per_page'], $start), 'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], 'U_ACTION' => $this->u_action . "&g=$group_id", diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index fdf0fbde2f..b6f7ce18c4 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -928,7 +928,7 @@ class acp_icons } $db->sql_freeresult($result); - generate_pagination($this->u_action, $item_count, $config['smilies_per_page'], $pagination_start); + generate_template_pagination($this->u_action, 'pagination', $item_count, $config['smilies_per_page'], $pagination_start); } /** diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index c7f9e5398e..a62490f052 100644 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -288,7 +288,8 @@ class acp_inactive $option_ary += array('remind' => 'REMIND'); } - generate_pagination($this->u_action . "&$u_sort_param&users_per_page=$per_page", $inactive_count, $per_page, $start); + $base_url = $this->u_action . "&$u_sort_param&users_per_page=$per_page"; + generate_template_pagination($base_url, 'pagination', $inactive_count, $per_page, $start); $template->assign_vars(array( 'S_INACTIVE_USERS' => true, @@ -297,7 +298,7 @@ class acp_inactive 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, - 'S_ON_PAGE' => on_page($inactive_count, $per_page, $start), + 'S_ON_PAGE' => on_page($base_url, $inactive_count, $per_page, $start), 'USERS_PER_PAGE' => $per_page, diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index 43cf15cb4d..1ba4dfbc08 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -129,14 +129,15 @@ class acp_logs $log_count = 0; $start = view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords); - generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&$u_sort_param$keywords_param"; + generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'L_TITLE' => $l_title, 'L_EXPLAIN' => $l_title_explain, 'U_ACTION' => $this->u_action . "&$u_sort_param$keywords_param&start=$start", - 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), + 'S_ON_PAGE' => on_page($base_url, $log_count, $config['topics_per_page'], $start), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index e98c015f8b..227d566155 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1120,11 +1120,12 @@ class acp_users $log_count = 0; $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); - generate_pagination($this->u_action . "&u=$user_id&$u_sort_param", $log_count, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&u=$user_id&$u_sort_param"; + generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_FEEDBACK' => true, - 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), + 'S_ON_PAGE' => on_page($base_url, $log_count, $config['topics_per_page'], $start), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, @@ -2036,11 +2037,12 @@ class acp_users } $db->sql_freeresult($result); - generate_pagination($this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir"; + generate_template_pagination($base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_ATTACHMENTS' => true, - 'S_ON_PAGE' => on_page($num_attachments, $config['topics_per_page'], $start), + 'S_ON_PAGE' => on_page($base_url, $num_attachments, $config['topics_per_page'], $start), 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, )); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index b7b8ccda0f..33b009307e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1882,15 +1882,115 @@ function tracking_unserialize($string, $max_depth = 3) /** * Pagination routine, generates page number sequence -* tpl_prefix is for using different pagination blocks at one page +* To generate pagination which is rendered fully within the template use generate_template_pagination +* +* @param string $base_url the base url is prepended to all links generated within the function +* @param int $num_items the total number of items, posts, topics, etc., used to determine the number of pages to produce +* @param int $per_page the number of items, posts, topics, etc. to display per page, used to determine the number of pages to produce +* @param int $start_item the item which should be considered currently active, used to determine the page we're on +* @param bool $add_prevnext_text appends and prepends next and previous links (true) or not (false) +* @param string $tpl_prefix is for using different pagination blocks at one page */ -function generate_pagination($base_url, $num_items, $per_page, $start_item = 1, $tpl_prefix = '', $reverse_count = false, $ignore_on_page = false, $block_var_name = '') +function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = false, $tpl_prefix = '') { global $template, $user; // Make sure $per_page is a valid value $per_page = ($per_page <= 0) ? 1 : $per_page; + $separator = '<span class="page-sep">' . $user->lang['COMMA_SEPARATOR'] . '</span>'; + $total_pages = ceil($num_items / $per_page); + + if ($total_pages == 1 || !$num_items) + { + return false; + } + + $on_page = floor($start_item / $per_page) + 1; + $url_delim = (strpos($base_url, '?') === false) ? '?' : ((strpos($base_url, '?') === strlen($base_url) - 1) ? '' : '&'); + + $page_string = ($on_page == 1) ? '<strong>1</strong>' : '<a href="' . $base_url . '">1</a>'; + + if ($total_pages > 5) + { + $start_cnt = min(max(1, $on_page - 4), $total_pages - 5); + $end_cnt = max(min($total_pages, $on_page + 4), 6); + + $page_string .= ($start_cnt > 1) ? '<span class="page-dots"> ... </span>' : $separator; + + for ($i = $start_cnt + 1; $i < $end_cnt; $i++) + { + $page_string .= ($i == $on_page) ? '<strong>' . $i . '</strong>' : '<a href="' . $base_url . "{$url_delim}start=" . (($i - 1) * $per_page) . '">' . $i . '</a>'; + if ($i < $end_cnt - 1) + { + $page_string .= $separator; + } + } + + $page_string .= ($end_cnt < $total_pages) ? '<span class="page-dots"> ... </span>' : $separator; + } + else + { + $page_string .= $separator; + + for ($i = 2; $i < $total_pages; $i++) + { + $page_string .= ($i == $on_page) ? '<strong>' . $i . '</strong>' : '<a href="' . $base_url . "{$url_delim}start=" . (($i - 1) * $per_page) . '">' . $i . '</a>'; + if ($i < $total_pages) + { + $page_string .= $separator; + } + } + } + + $page_string .= ($on_page == $total_pages) ? '<strong>' . $total_pages . '</strong>' : '<a href="' . $base_url . "{$url_delim}start=" . (($total_pages - 1) * $per_page) . '">' . $total_pages . '</a>'; + + if ($add_prevnext_text) + { + if ($on_page != 1) + { + $page_string = '<a href="' . $base_url . "{$url_delim}start=" . (($on_page - 2) * $per_page) . '">' . $user->lang['PREVIOUS'] . '</a> ' . $page_string; + } + + if ($on_page != $total_pages) + { + $page_string .= ' <a href="' . $base_url . "{$url_delim}start=" . ($on_page * $per_page) . '">' . $user->lang['NEXT'] . '</a>'; + } + } + + $template->assign_vars(array( + $tpl_prefix . 'BASE_URL' => $base_url, + 'A_' . $tpl_prefix . 'BASE_URL' => addslashes($base_url), + $tpl_prefix . 'PER_PAGE' => $per_page, + + $tpl_prefix . 'PREVIOUS_PAGE' => ($on_page == 1) ? '' : $base_url . "{$url_delim}start=" . (($on_page - 2) * $per_page), + $tpl_prefix . 'NEXT_PAGE' => ($on_page == $total_pages) ? '' : $base_url . "{$url_delim}start=" . ($on_page * $per_page), + $tpl_prefix . 'TOTAL_PAGES' => $total_pages, + $tpl_prefix . 'CURRENT_PAGE' => $on_page, + )); + + return $page_string; +} + +/** +* Generate template rendered pagination +* Allows full control of rendering of pagination with the template +* +* @param string $base_url is url prepended to all links generated within the function +* @param string $block_var_name is the name assigned to the pagination data block within the template (example: <!-- BEGIN pagination -->) +* @param int $num_items the total number of items, posts, etc., used to determine the number of pages to produce +* @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce +* @param int $start_item the item which should be considered currently active, used to determine the page we're on +* @param bool $reverse_count determines whether we weight display of the list towards the start (false) or end (true) of the list +* @param bool $ignore_on_page decides whether we enable an active (unlinked) item, used primarily for embedded lists +* +*/ +function generate_template_pagination($base_url, $block_var_name, $num_items, $per_page, $start_item = 1, $reverse_count = false, $ignore_on_page = false) +{ + global $template; + + // Make sure $per_page is a valid value + $per_page = ($per_page <= 0) ? 1 : $per_page; $total_pages = ceil($num_items / $per_page); if ($total_pages == 1 || !$num_items) @@ -1900,17 +2000,31 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item = 1, $on_page = floor($start_item / $per_page) + 1; $url_delim = (strpos($base_url, '?') === false) ? '?' : ((strpos($base_url, '?') === strlen($base_url) - 1) ? '' : '&'); - $block_var_name = ($block_var_name) ? $block_var_name . '.pagination' : 'pagination'; if ($reverse_count) { - $start_cnt = ($total_pages > 5) ? $total_pages - 3 : 1; - $end_cnt = $total_pages; + $start_page = ($total_pages > 5) ? $total_pages - 4 : 1; + $end_page = $total_pages; } else { - $start_cnt = ($total_pages > 5) ? min(max(1, $on_page - 4), $total_pages - 5) : 1; - $end_cnt = ($total_pages > 5) ? max(min($total_pages, $on_page + 4), 6) : $total_pages; + // What we're doing here is calculating what the "start" and "end" pages should be. We + // do this by assuming pagination is "centered" around the currently active page with + // the three previous and three next page links displayed. Anything more than that and + // we display the ellipsis, likewise anything less. + // + // $start_page is the page at which we start creating the list. When we have five or less + // pages we start at page 1 since there will be no ellipsis displayed. Anymore than that + // and we calculate the start based on the active page. This is the min/max calculation. + // First (max) would we end up starting on a page less than 1? Next (min) would we end + // up starting so close to the end that we'd not display our minimum number of pages. + // + // $end_page is the last page in the list to display. Like $start_page we use a min/max to + // determine this number. Again at most five pages? Then just display them all. More than + // five and we first (min) determine whether we'd end up listing more pages than exist. + // We then (max) ensure we're displaying the minimum number of pages. + $start_page = ($total_pages > 5) ? min(max(1, $on_page - 3), $total_pages - 4) : 1; + $end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 3), 5) : $total_pages; } if ($on_page != $total_pages) @@ -1924,35 +2038,48 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item = 1, 'S_IS_ELLIPSIS' => false, )); } - - $i = 1; + + // This do...while exists purely to negate the need for start and end assign_block_vars, i.e. + // to display the first and last page in the list plus any ellipsis. We use this loop to jump + // around a little within the list depending on where we're starting (and ending). + $at_page = 1; do { - $page_url = $base_url . (($i == 1) ? '' : $url_delim . 'start=' . (($i - 1) * $per_page)); - + $page_url = $base_url . (($at_page == 1) ? '' : $url_delim . 'start=' . (($at_page - 1) * $per_page)); + + // We decide whether to display the ellipsis during the loop. The ellipsis is always + // displayed as either the second or penultimate item in the list. So are we at either + // of those points and of course do we even need to display it, i.e. is the list starting + // on at least page 3 and ending three pages before the final item. $template->assign_block_vars($block_var_name, array( - 'PAGE_NUMBER' => $i, + 'PAGE_NUMBER' => $at_page, 'PAGE_URL' => $page_url, - 'S_IS_CURRENT' => (!$ignore_on_page && $i == $on_page) ? true : false, + 'S_IS_CURRENT' => (!$ignore_on_page && $at_page == $on_page), 'S_IS_NEXT' => false, 'S_IS_PREV' => false, - 'S_IS_ELLIPSIS' => ($i == 2 && $start_cnt > 1) || ($i == $total_pages - 1 && $end_cnt < $total_pages) ? true : false, + 'S_IS_ELLIPSIS' => ($at_page == 2 && $start_page > 2) || ($at_page == $total_pages - 1 && $end_page < $total_pages - 1), )); - - if ($i > 1 && $i < $start_cnt - 1) + + // We may need to jump around in the list depending on whether we have or need to display + // the ellipsis. Are we on page 2 and are we more than one page away from the start + // of the list? Yes? Then we jump to the start of the list. Likewise are we at the end of + // the list and are there more than two pages left in total? Yes? Then jump to the penultimate + // page (so we can display the ellipsis next pass). Else, increment the counter and keep + // going + if ($at_page == 2 && $at_page < $start_page - 1) { - $i = $start_cnt; + $at_page = $start_page; } - elseif ($i == $end_cnt && $end_cnt < $total_pages - 1) + else if ($at_page == $end_page && $end_page < $total_pages - 1) { - $i = $total_pages - 1; + $at_page = $total_pages - 1; } else { - $i++; + $at_page++; } } - while ($i <= $total_pages); + while ($at_page <= $total_pages); if ($on_page != 1) { @@ -1965,24 +2092,19 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item = 1, 'S_IS_ELLIPSIS' => false, )); } - - $template->assign_vars(array( - $tpl_prefix . 'BASE_URL' => $base_url, - 'A_' . $tpl_prefix . 'BASE_URL' => addslashes($base_url), - $tpl_prefix . 'PER_PAGE' => $per_page, - $tpl_prefix . 'PREVIOUS_PAGE' => ($on_page == 1) ? '' : $base_url . "{$url_delim}start=" . (($on_page - 2) * $per_page), - $tpl_prefix . 'NEXT_PAGE' => ($on_page == $total_pages) ? '' : $base_url . "{$url_delim}start=" . ($on_page * $per_page), - $tpl_prefix . 'TOTAL_PAGES' => $total_pages, - $tpl_prefix . 'CURRENT_PAGE' => $on_page, - )); - - return; } /** -* Return current page (pagination) +* Return current page +* This function also sets certain specific template variables +* +* @param string $base_url the base url used to call this page, used by Javascript for popup jump to page +* @param int $num_items the total number of items, posts, topics, etc. +* @param int $per_page the number of items, posts, etc. per page +* @param int $start the item which should be considered currently active, used to determine the page we're on +* */ -function on_page($num_items, $per_page, $start) +function on_page($base_url, $num_items, $per_page, $start) { global $template, $user; @@ -1992,8 +2114,11 @@ function on_page($num_items, $per_page, $start) $on_page = floor($start / $per_page) + 1; $template->assign_vars(array( - 'ON_PAGE' => $on_page) - ); + 'PER_PAGE' => $per_page, + 'ON_PAGE' => $on_page, + + 'A_BASE_URL' => addslashes($base_url), + )); return sprintf($user->lang['PAGE_OF'], $on_page, max(ceil($num_items / $per_page), 1)); } diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 936f85ccc2..eda8455361 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -101,7 +101,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total; $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; - generate_pagination($url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : ''), $forum_topics, $topics_per_page, $start); + $base_url = $url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : ''); + generate_template_pagination($base_url, 'pagination', $forum_topics, $topics_per_page, $start); $template->assign_vars(array( 'ACTION' => $action, @@ -131,7 +132,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' => on_page($forum_topics, $topics_per_page, $start), + 'PAGE_NUMBER' => on_page($base_url, $forum_topics, $topics_per_page, $start), 'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $forum_topics), )); diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index 2b5e847e26..26305734ee 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -171,10 +171,11 @@ class mcp_logs $log_count = 0; $start = view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords); - generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&$u_sort_param$keywords_param"; + generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( - 'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => 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'], diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index 7e0dd69a2f..f83db17003 100644 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -215,7 +215,8 @@ class mcp_notes } } - generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&$u_sort_param$keywords_param"; + generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'U_POST_ACTION' => $this->u_action, @@ -227,7 +228,7 @@ class mcp_notes 'L_TITLE' => $user->lang['MCP_NOTES_USER'], - 'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($base_url, $log_count, $config['topics_per_page'], $start), 'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $log_count), 'RANK_TITLE' => $rank_title, diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 3e2ce4bfd3..b7cd2edb85 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -297,8 +297,9 @@ class mcp_pm_reports } } } - - generate_pagination($this->u_action . "&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start); + + $base_url = $this->u_action . "&st=$sort_days&sk=$sort_key&sd=$sort_dir"; + generate_template_pagination($base_url, 'pagination', $total, $config['topics_per_page'], $start); // Now display the page $template->assign_vars(array( @@ -309,7 +310,7 @@ class mcp_pm_reports 'S_MCP_ACTION' => $this->u_action, 'S_CLOSED' => ($mode == 'pm_reports_closed') ? true : false, - 'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($base_url, $total, $config['topics_per_page'], $start), 'TOTAL' => $total, 'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total), ) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 86fffbcf93..c1998c73d3 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -419,7 +419,8 @@ class mcp_queue } unset($rowset, $forum_names); - generate_pagination($this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir"; + generate_template_pagination($base_url, 'pagination', $total, $config['topics_per_page'], $start); // Now display the page $template->assign_vars(array( @@ -432,7 +433,7 @@ class mcp_queue 'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')), 'S_TOPICS' => ($mode == 'unapproved_posts') ? false : true, - 'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($base_url, $total, $config['topics_per_page'], $start), 'TOPIC_ID' => $topic_id, 'TOTAL' => $user->lang((($mode == 'unapproved_posts') ? 'VIEW_TOPIC_POSTS' : 'VIEW_FORUM_TOPICS'), (int) $total), )); diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 3c5f51ee05..dd03e23380 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -411,7 +411,8 @@ class mcp_reports unset($report_ids, $row); } - generate_pagination($this->u_action . "&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir"; + generate_template_pagination($base_url, 'pagination', $total, $config['topics_per_page'], $start); // Now display the page $template->assign_vars(array( @@ -423,7 +424,7 @@ class mcp_reports 'S_FORUM_OPTIONS' => $forum_options, 'S_CLOSED' => ($mode == 'reports_closed') ? true : false, - 'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($base_url, $total, $config['topics_per_page'], $start), 'TOPIC_ID' => $topic_id, 'TOTAL' => $total, 'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total), diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index c2f44bd360..e4f796f781 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -306,9 +306,10 @@ function mcp_topic_view($id, $mode, $action) 'post_ids' => $post_id_list, )); + $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) { - generate_pagination(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"), $total, $posts_per_page, $start); + generate_template_pagination($base_url, 'pagination', $total, $posts_per_page, $start); } $template->assign_vars(array( @@ -349,7 +350,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' => on_page($total, $posts_per_page, $start), + 'PAGE_NUMBER' => on_page($base_url, $total, $posts_per_page, $start), 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total), )); } diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 31822dd147..eba300f664 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -175,7 +175,8 @@ class mcp_warn )); } - generate_pagination(append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&mode=list&st=$st&sk=$sk&sd=$sd"), $user_count, $config['topics_per_page'], $start); + $base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&mode=list&st=$st&sk=$sk&sd=$sd"); + generate_template_pagination($base_url, 'pagination', $user_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'U_POST_ACTION' => $this->u_action, @@ -184,7 +185,7 @@ class mcp_warn 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'PAGE_NUMBER' => on_page($user_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($base_url, $user_count, $config['topics_per_page'], $start), 'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $user_count), )); } diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index fb2dfaabee..56a87f616f 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -170,10 +170,11 @@ class ucp_attachments } $db->sql_freeresult($result); - generate_pagination($this->u_action . "&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&sk=$sort_key&sd=$sort_dir"; + generate_template_pagination($base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start); $template->assign_vars(array( - 'PAGE_NUMBER' => on_page($num_attachments, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($base_url, $num_attachments, $config['topics_per_page'], $start), 'TOTAL_ATTACHMENTS' => $num_attachments, 'L_TITLE' => $user->lang['UCP_ATTACHMENTS'], diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index d919208aca..a72c7fb023 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -844,12 +844,13 @@ class ucp_groups $s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>'; } - generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&action=$action&g=$group_id"; + generate_template_pagination($base_url, 'pagination', $total_members, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_LIST' => true, 'S_ACTION_OPTIONS' => $s_action_options, - 'S_ON_PAGE' => on_page($total_members, $config['topics_per_page'], $start), + 'S_ON_PAGE' => on_page($base_url, $total_members, $config['topics_per_page'], $start), 'U_ACTION' => $this->u_action . "&g=$group_id", 'S_UCP_ACTION' => $this->u_action . "&g=$group_id", diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index fed844de96..d07d838227 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -670,10 +670,10 @@ class ucp_main if ($topics_count) { - generate_pagination($this->u_action, $topics_count, $config['topics_per_page'], $start); + generate_template_pagination($this->u_action, 'pagination', $topics_count, $config['topics_per_page'], $start); $template->assign_vars(array( - 'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($this->u_action, $topics_count, $config['topics_per_page'], $start), 'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $topics_count), )); } @@ -838,7 +838,7 @@ class ucp_main 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), )); - generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . "&t=$topic_id"), $replies + 1, $config['posts_per_page'], 1, '', true, true, 'topicrow'); + generate_template_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . "&t=$topic_id"), 'topicrow.pagination', $replies + 1, $config['posts_per_page'], 1, true, true); } } } diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 168280bd96..2775dc3eca 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -451,10 +451,11 @@ function get_pm_from($folder_id, $folder, $user_id) $sql_limit_time = ''; } - generate_pagination(append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param"), $pm_count, $config['topics_per_page'], $start); + $base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param"); + generate_template_pagination($base_url, 'pagination', $pm_count, $config['topics_per_page'], $start); $template->assign_vars(array( - 'PAGE_NUMBER' => on_page($pm_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => 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'), diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index f837a21666..0957763873 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1572,11 +1572,11 @@ switch ($mode) } } - generate_pagination($pagination_url, $total_users, $config['topics_per_page'], $start); + generate_template_pagination($pagination_url, 'pagination', $total_users, $config['topics_per_page'], $start); // Generate page $template->assign_vars(array( - 'PAGE_NUMBER' => on_page($total_users, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($pagination_url, $total_users, $config['topics_per_page'], $start), 'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $total_users), 'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['PROFILE']), diff --git a/phpBB/search.php b/phpBB/search.php index fefe7f9b0e..ac2289295c 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -603,7 +603,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $phrase_search_disabled = $search->supports_phrase_search() ? false : true; } - generate_pagination($u_search, $total_match_count, $per_page, $start); + generate_template_pagination($u_search, 'pagination', $total_match_count, $per_page, $start); $template->assign_vars(array( 'SEARCH_TITLE' => $l_search_title, @@ -611,7 +611,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'SEARCH_WORDS' => $keywords, 'SEARCHED_QUERY' => $search->search_query, 'IGNORED_WORDS' => (sizeof($search->common_words)) ? implode(' ', $search->common_words) : '', - 'PAGE_NUMBER' => on_page($total_match_count, $per_page, $start), + 'PAGE_NUMBER' => on_page($u_search, $total_match_count, $per_page, $start), 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, @@ -1006,7 +1006,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($show_results == 'topics') { - generate_pagination($view_topic_url, $replies + 1, $config['posts_per_page'], 1, '', true, true, 'searchresults'); + generate_template_pagination($view_topic_url, 'searchresults.pagination', $replies + 1, $config['posts_per_page'], 1, true, true); } } diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index a31e0fc74a..811aace154 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -15,20 +15,7 @@ <li class="rightside pagination"> <!-- IF TOTAL_TOPICS --> {TOTAL_TOPICS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/mcp_logs.html b/phpBB/styles/prosilver/template/mcp_logs.html index af101f8d24..0d7f357d5b 100644 --- a/phpBB/styles/prosilver/template/mcp_logs.html +++ b/phpBB/styles/prosilver/template/mcp_logs.html @@ -14,20 +14,7 @@ <li class="rightside pagination"> <!-- IF TOTAL -->{TOTAL} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> @@ -81,20 +68,7 @@ <li class="rightside pagination"> <!-- IF TOTAL -->{TOTAL} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/mcp_notes_user.html b/phpBB/styles/prosilver/template/mcp_notes_user.html index ea484e5628..d0d79f4664 100644 --- a/phpBB/styles/prosilver/template/mcp_notes_user.html +++ b/phpBB/styles/prosilver/template/mcp_notes_user.html @@ -57,20 +57,7 @@ <li class="rightside pagination"> <!-- IF TOTAL_REPORTS -->{TOTAL_REPORTS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> @@ -121,20 +108,7 @@ <li class="rightside pagination"> <!-- IF TOTAL_REPORTS -->{TOTAL_REPORTS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/mcp_queue.html b/phpBB/styles/prosilver/template/mcp_queue.html index 5dd4308f7a..93483ae02a 100644 --- a/phpBB/styles/prosilver/template/mcp_queue.html +++ b/phpBB/styles/prosilver/template/mcp_queue.html @@ -20,20 +20,7 @@ <li class="rightside pagination"> <!-- IF TOTAL --> {TOTAL} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> @@ -92,20 +79,7 @@ <li class="rightside pagination"> <!-- IF TOTAL -->{TOTAL} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/mcp_reports.html b/phpBB/styles/prosilver/template/mcp_reports.html index 431f50d346..aa67414713 100644 --- a/phpBB/styles/prosilver/template/mcp_reports.html +++ b/phpBB/styles/prosilver/template/mcp_reports.html @@ -22,20 +22,7 @@ <li class="rightside pagination"> <!-- IF TOTAL -->{TOTAL_REPORTS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> @@ -93,20 +80,7 @@ <li class="rightside pagination"> <!-- IF TOTAL -->{TOTAL_REPORTS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index 2a7b749027..a6938ee2fb 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -144,20 +144,7 @@ onload_functions.push('subPanels()'); <li class="rightside pagination"> <!-- IF TOTAL_POSTS --> {TOTAL_POSTS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/mcp_warn_list.html b/phpBB/styles/prosilver/template/mcp_warn_list.html index 27adcf40e3..fca377a823 100644 --- a/phpBB/styles/prosilver/template/mcp_warn_list.html +++ b/phpBB/styles/prosilver/template/mcp_warn_list.html @@ -67,20 +67,7 @@ <li class="rightside pagination"> <!-- IF TOTAL_USERS -->{TOTAL_USERS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html index bb3ce814d3..545d5000c4 100644 --- a/phpBB/styles/prosilver/template/memberlist_body.html +++ b/phpBB/styles/prosilver/template/memberlist_body.html @@ -44,20 +44,7 @@ {TOTAL_USERS} <!-- IF .pagination --> • - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> @@ -171,20 +158,7 @@ <li class="rightside pagination">{TOTAL_USERS} <!-- IF .pagination --> • - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/pagination.html b/phpBB/styles/prosilver/template/pagination.html new file mode 100644 index 0000000000..1c8441a9fd --- /dev/null +++ b/phpBB/styles/prosilver/template/pagination.html @@ -0,0 +1,15 @@ + + <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • + <ul> + <!-- BEGIN pagination --> + <!-- IF pagination.S_IS_PREV --> + <!-- ELSEIF pagination.S_IS_CURRENT --> + <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> + <!-- ELSEIF pagination.S_IS_ELLIPSIS --> + <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> + <!-- ELSEIF pagination.S_IS_NEXT --> + <!-- ELSE --> + <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> + <!-- ENDIF --> + <!-- END pagination --> + </ul> diff --git a/phpBB/styles/prosilver/template/posting_smilies.html b/phpBB/styles/prosilver/template/posting_smilies.html index 097d08244d..01b74c710c 100644 --- a/phpBB/styles/prosilver/template/posting_smilies.html +++ b/phpBB/styles/prosilver/template/posting_smilies.html @@ -19,20 +19,7 @@ </div> <div class="pagination"> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --><li><a href="{pagination.PAGE_URL}">{L_NEXT}</a></li> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ENDIF --> </div> <a href="#" onclick="window.close(); return false;">{L_CLOSE_WINDOW}</a> diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index 7b4ecaab72..063cc8c8ea 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -29,20 +29,7 @@ {SEARCH_MATCHES} <!-- IF .pagination --> • - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_attachments.html b/phpBB/styles/prosilver/template/ucp_attachments.html index b57376344f..2160d8fcf7 100644 --- a/phpBB/styles/prosilver/template/ucp_attachments.html +++ b/phpBB/styles/prosilver/template/ucp_attachments.html @@ -14,20 +14,7 @@ <li class="rightside pagination"> <!-- IF TOTAL_ATTACHMENTS -->{TOTAL_ATTACHMENTS} {L_TITLE} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> @@ -74,20 +61,7 @@ <li class="rightside pagination"> <!-- IF TOTAL_ATTACHMENTS -->{TOTAL_ATTACHMENTS} {L_TITLE} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_groups_manage.html b/phpBB/styles/prosilver/template/ucp_groups_manage.html index 680d39ea1e..892a5d12b4 100644 --- a/phpBB/styles/prosilver/template/ucp_groups_manage.html +++ b/phpBB/styles/prosilver/template/ucp_groups_manage.html @@ -160,20 +160,7 @@ <ul class="linklist"> <li class="leftside pagination"> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {S_ON_PAGE} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_main_bookmarks.html b/phpBB/styles/prosilver/template/ucp_main_bookmarks.html index 895fce5e51..8707a749c1 100644 --- a/phpBB/styles/prosilver/template/ucp_main_bookmarks.html +++ b/phpBB/styles/prosilver/template/ucp_main_bookmarks.html @@ -65,20 +65,7 @@ <li class="rightside pagination"> <!-- IF TOTAL_TOPICS --> {TOTAL_TOPICS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_main_subscribed.html b/phpBB/styles/prosilver/template/ucp_main_subscribed.html index 0324218149..11957aa90d 100644 --- a/phpBB/styles/prosilver/template/ucp_main_subscribed.html +++ b/phpBB/styles/prosilver/template/ucp_main_subscribed.html @@ -84,20 +84,7 @@ <li class="rightside pagination"> <!-- IF TOTAL_TOPICS --> {TOTAL_TOPICS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_pm_message_header.html b/phpBB/styles/prosilver/template/ucp_pm_message_header.html index 9af2bf07a5..c02a34f83d 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_message_header.html +++ b/phpBB/styles/prosilver/template/ucp_pm_message_header.html @@ -22,20 +22,7 @@ <!-- IF FOLDER_CUR_MESSAGES neq 0 --> <!-- IF TOTAL_MESSAGES -->{TOTAL_MESSAGES} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index 8f969a7018..195b212da3 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -105,20 +105,7 @@ <li class="rightside pagination"> <!-- IF TOTAL_MESSAGES -->{TOTAL_MESSAGES • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 4e368120b8..373a172918 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -60,20 +60,7 @@ <!-- IF not S_IS_BOT and U_MARK_TOPICS --><a href="{U_MARK_TOPICS}" accesskey="m" data-ajax="true">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF --> <!-- IF TOTAL_TOPICS -->{TOTAL_TOPICS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> @@ -228,20 +215,7 @@ <!-- IF TOTAL_POSTS and not NEWEST_USER --> {TOTAL_POSTS}<!-- ELSEIF TOTAL_TOPICS and not NEWEST_USER --> {TOTAL_TOPICS} • <!-- ENDIF --> <!-- IF TOTAL_USERS -->{TOTAL_USERS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul class="pagination> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/viewonline_body.html b/phpBB/styles/prosilver/template/viewonline_body.html index 775f182c07..9156090407 100644 --- a/phpBB/styles/prosilver/template/viewonline_body.html +++ b/phpBB/styles/prosilver/template/viewonline_body.html @@ -6,20 +6,7 @@ <ul class="linklist"> <li class="rightside pagination"> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> @@ -71,20 +58,7 @@ <ul class="linklist"> <li class="rightside pagination"> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 29786f7b86..cfbf0969d9 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -49,17 +49,7 @@ <div class="pagination"> <!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --><a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> • <!-- ENDIF -->{TOTAL_POSTS} • <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 81f3567aba..60903911dd 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -1,8 +1,6 @@ /* Content Styles ---------------------------------------- */ -/* Forum and topic lists ----------------------------------------- */ ul.topiclist { display: block; list-style-type: none; @@ -703,4 +701,4 @@ dl.pmlist dt textarea { dl.pmlist dd { margin-left: 61% !important; margin-bottom: 2px; -}
\ No newline at end of file +} diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index f1c10e347e..676e0cae3b 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -590,10 +590,11 @@ if ($s_display_active) // otherwise the number is different from the one on the forum list $total_topic_count = $topics_count - sizeof($global_announce_forums); -generate_pagination(append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '')), $topics_count, $config['topics_per_page'], $start); +$base_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '')); +generate_template_pagination($base_url, 'pagination', $topics_count, $config['topics_per_page'], $start); $template->assign_vars(array( - 'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($base_url, $topics_count, $config['topics_per_page'], $start), 'TOTAL_TOPICS' => ($s_display_active) ? false : $user->lang('VIEW_FORUM_TOPICS', (int) $total_topic_count), )); @@ -744,7 +745,7 @@ if (sizeof($topic_list)) 'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test) ); - generate_pagination($view_topic_url, $replies + 1, $config['posts_per_page'], 1, '', true, true, 'topicrow'); + generate_template_pagination($view_topic_url, 'topicrow.pagination', $replies + 1, $config['posts_per_page'], 1, true, true); $s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 546152f647..33f42a657e 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -342,8 +342,6 @@ while ($row = $db->sql_fetchrow($result)) $db->sql_freeresult($result); unset($prev_id, $prev_ip); -generate_pagination(append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir"), $counter, $config['topics_per_page'], $start); - $order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; // Grab group details for legend display if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) @@ -386,13 +384,16 @@ $db->sql_freeresult($result); // Refreshing the page every 60 seconds... meta_refresh(60, append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir&start=$start")); +$base_url = append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir"); +generate_template_pagination($base_url, 'pagination', $counter, $config['topics_per_page'], $start); + // Send data to template $template->assign_vars(array( 'TOTAL_REGISTERED_USERS_ONLINE' => $user->lang('REG_USERS_ONLINE', (int) $logged_visible_online, $user->lang('HIDDEN_USERS_ONLINE', (int) $logged_hidden_online)), 'TOTAL_GUEST_USERS_ONLINE' => $user->lang('GUEST_USERS_ONLINE', (int) $guest_counter), 'LEGEND' => $legend, 'PAGINATION' => $pagination, - 'PAGE_NUMBER' => on_page($counter, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($base_url, $counter, $config['topics_per_page'], $start), 'U_SORT_USERNAME' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), 'U_SORT_UPDATED' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 98a4f123be..969f6fb63e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -545,9 +545,6 @@ foreach($quickmod_array as $option => $qm_ary) } } -// If we've got a hightlight set pass it on to pagination. -generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); - // Navigation links generate_forum_nav($topic_data); @@ -585,6 +582,10 @@ if (!empty($_EXTRA_URL)) } } +// If we've got a hightlight set pass it on to pagination. +$base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); +generate_template_pagination($base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); + // Send vars to template $template->assign_vars(array( 'FORUM_ID' => $forum_id, @@ -598,7 +599,7 @@ $template->assign_vars(array( 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), - 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), + 'PAGE_NUMBER' => on_page($base_url, $total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '', |