mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
r141
Упрощенная пагинация git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@141 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
be3c7c8acc
commit
cac6949949
15 changed files with 54 additions and 53 deletions
|
@ -581,12 +581,7 @@ if ($view == 'attachments')
|
||||||
// Generate Pagination
|
// Generate Pagination
|
||||||
if ($do_pagination && $total_rows > $bb_cfg['topics_per_page'])
|
if ($do_pagination && $total_rows > $bb_cfg['topics_per_page'])
|
||||||
{
|
{
|
||||||
$pagination = generate_pagination('admin_attach_cp.php?view=' . $view . '&mode=' . $mode . '&order=' . $sort_order . '&uid=' . $uid, $total_rows, $bb_cfg['topics_per_page'], $start).' ';
|
generate_pagination('admin_attach_cp.php?view=' . $view . '&mode=' . $mode . '&order=' . $sort_order . '&uid=' . $uid, $total_rows, $bb_cfg['topics_per_page'], $start).' ';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'PAGINATION' => $pagination,
|
|
||||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], ( floor( $start / $bb_cfg['topics_per_page'] ) + 1 ), ceil( $total_rows / $bb_cfg['topics_per_page'] )),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_page('admin_attach_cp.tpl', 'admin');
|
print_page('admin_attach_cp.tpl', 'admin');
|
|
@ -243,10 +243,7 @@ else
|
||||||
$pages = (!$log_count) ? 1 : ceil($items_count / $per_page);
|
$pages = (!$log_count) ? 1 : ceil($items_count / $per_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
generate_pagination($url, $items_count, $per_page, $start);
|
||||||
'PAGINATION' => generate_pagination($url, $items_count, $per_page, $start),
|
|
||||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], floor($start / $per_page) + 1, $pages),
|
|
||||||
));
|
|
||||||
|
|
||||||
$filter = array();
|
$filter = array();
|
||||||
|
|
||||||
|
|
|
@ -231,6 +231,9 @@ switch($this->request['type'])
|
||||||
$this->ajax_die(sprintf($lang['SORRY_AUTH_REPLY'], strip_tags($is_auth['auth_reply_type'])));
|
$this->ajax_die(sprintf($lang['SORRY_AUTH_REPLY'], strip_tags($is_auth['auth_reply_type'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$message = (string) $this->request['message'];
|
||||||
|
$message = prepare_message($message);
|
||||||
|
|
||||||
// Flood control
|
// Flood control
|
||||||
$where_sql = (IS_GUEST) ? "p.poster_ip = '". USER_IP ."'" : "p.poster_id = {$userdata['user_id']}";
|
$where_sql = (IS_GUEST) ? "p.poster_ip = '". USER_IP ."'" : "p.poster_id = {$userdata['user_id']}";
|
||||||
|
|
||||||
|
@ -263,16 +266,13 @@ switch($this->request['type'])
|
||||||
{
|
{
|
||||||
$last_msg = DB()->escape($row['post_text']);
|
$last_msg = DB()->escape($row['post_text']);
|
||||||
|
|
||||||
if ($last_msg == $post_message)
|
if ($last_msg == $message)
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['DOUBLE_POST_ERROR']);
|
$this->ajax_die($lang['DOUBLE_POST_ERROR']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = (string) $this->request['message'];
|
|
||||||
$message = prepare_message($message);
|
|
||||||
|
|
||||||
if($bb_cfg['max_smilies'])
|
if($bb_cfg['max_smilies'])
|
||||||
{
|
{
|
||||||
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="'. $bb_cfg['smilies_path']);
|
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="'. $bb_cfg['smilies_path']);
|
||||||
|
|
|
@ -57,8 +57,8 @@ $bb_cfg['css_ver'] = 1;
|
||||||
|
|
||||||
// Increase number of revision after update
|
// Increase number of revision after update
|
||||||
$bb_cfg['tp_version'] = '2.0.2';
|
$bb_cfg['tp_version'] = '2.0.2';
|
||||||
$bb_cfg['tp_release_state'] = 'TP II r140';
|
$bb_cfg['tp_release_state'] = 'TP II r141';
|
||||||
$bb_cfg['tp_release_date'] = '24-07-2011';
|
$bb_cfg['tp_release_date'] = '25-07-2011';
|
||||||
|
|
||||||
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger
|
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger
|
||||||
$bb_cfg['srv_overloaded_msg'] = "Извините, в данный момент сервер перегружен\nПопробуйте повторить запрос через несколько минут";
|
$bb_cfg['srv_overloaded_msg'] = "Извините, в данный момент сервер перегружен\nПопробуйте повторить запрос через несколько минут";
|
||||||
|
|
|
@ -442,10 +442,7 @@ else
|
||||||
$pages = (!$members_count) ? 1 : ceil($items_count / $per_page);
|
$pages = (!$members_count) ? 1 : ceil($items_count / $per_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
generate_pagination(GROUP_URL . $group_id, $items_count, $per_page, $start);
|
||||||
'PAGINATION' => generate_pagination(GROUP_URL . $group_id, $items_count, $per_page, $start),
|
|
||||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], floor($start / $per_page) + 1, $pages),
|
|
||||||
));
|
|
||||||
|
|
||||||
// Pending
|
// Pending
|
||||||
if ($is_moderator)
|
if ($is_moderator)
|
||||||
|
|
|
@ -1670,7 +1670,7 @@ function birthday_age($date)
|
||||||
//
|
//
|
||||||
function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE)
|
function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE)
|
||||||
{
|
{
|
||||||
global $lang;
|
global $lang, $template;
|
||||||
|
|
||||||
// Pagination Mod
|
// Pagination Mod
|
||||||
$begin_end = 3;
|
$begin_end = 3;
|
||||||
|
@ -1772,9 +1772,17 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = ($page_string) ? $lang['GOTO_PAGE'] .': '. $page_string : '';
|
$pagination = ($page_string) ? '<a class="menu-root" href="#pg-jump">Страницы</a> : '. $page_string : '';
|
||||||
|
$pagination = str_replace('&start=0', '', $pagination);
|
||||||
|
|
||||||
return str_replace('&start=0', '', $return);
|
$template->assign_vars(array(
|
||||||
|
'PAGINATION' => $pagination,
|
||||||
|
'PAGE_NUMBER' => sprintf('Страница <b>%d</b> из <b>%s</b>', ( floor($start_item/$per_page) + 1 ), ceil( $num_items / $per_page )),
|
||||||
|
'PG_BASE_URL' => $base_url,
|
||||||
|
'PG_PER_PAGE' => $per_page,
|
||||||
|
));
|
||||||
|
|
||||||
|
return $pagination;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -321,12 +321,7 @@ if (sizeof($attachments) > 0)
|
||||||
// Generate Pagination
|
// Generate Pagination
|
||||||
if ($do_pagination && $total_rows > $bb_cfg['topics_per_page'])
|
if ($do_pagination && $total_rows > $bb_cfg['topics_per_page'])
|
||||||
{
|
{
|
||||||
$pagination = generate_pagination(BB_ROOT ."profile.php?mode=attachcp&mode_a=$mode&order=$sort_order&" . POST_USERS_URL . '=' . $profiledata['user_id'] . '&sid=' . $userdata['session_id'], $total_rows, $bb_cfg['topics_per_page'], $start).' ';
|
generate_pagination(BB_ROOT ."profile.php?mode=attachcp&mode_a=$mode&order=$sort_order&" . POST_USERS_URL . '=' . $profiledata['user_id'] . '&sid=' . $userdata['session_id'], $total_rows, $bb_cfg['topics_per_page'], $start).' ';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'PAGINATION' => $pagination,
|
|
||||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], (floor($start / $bb_cfg['topics_per_page']) + 1), ceil($total_rows / $bb_cfg['topics_per_page'])),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_page('usercp_attachcp.tpl');
|
print_page('usercp_attachcp.tpl');
|
||||||
|
|
|
@ -229,19 +229,13 @@ if ( $mode != 'topten' || $bb_cfg['topics_per_page'] < 10 )
|
||||||
if ($total = DB()->sql_fetchrow($result))
|
if ($total = DB()->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$total_members = $total['total'];
|
$total_members = $total['total'];
|
||||||
$pagination = generate_pagination($paginationurl, $total_members, $bb_cfg['topics_per_page'], $start). ' ';
|
generate_pagination($paginationurl, $total_members, $bb_cfg['topics_per_page'], $start). ' ';
|
||||||
}
|
}
|
||||||
DB()->sql_freeresult($result);
|
DB()->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$pagination = ' ';
|
|
||||||
$total_members = 10;
|
|
||||||
}
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PAGE_TITLE' => $lang['MEMBERLIST'],
|
'PAGE_TITLE' => $lang['MEMBERLIST'],
|
||||||
'PAGINATION' => $pagination,
|
|
||||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], ( floor( $start / $bb_cfg['topics_per_page'] ) + 1 ), ceil( $total_members / $bb_cfg['topics_per_page'] )),
|
|
||||||
));
|
));
|
||||||
|
|
||||||
print_page('memberlist.tpl');
|
print_page('memberlist.tpl');
|
||||||
|
|
|
@ -1751,11 +1751,7 @@ else
|
||||||
}
|
}
|
||||||
while( $row = DB()->sql_fetchrow($result) );
|
while( $row = DB()->sql_fetchrow($result) );
|
||||||
|
|
||||||
$template->assign_vars(array(
|
generate_pagination("privmsg.php?folder=$folder", $pm_total, $bb_cfg['topics_per_page'], $start);
|
||||||
'PAGINATION' => generate_pagination("privmsg.php?folder=$folder", $pm_total, $bb_cfg['topics_per_page'], $start),
|
|
||||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], ( floor( $start / $bb_cfg['topics_per_page'] ) + 1 ), ceil( $pm_total / $bb_cfg['topics_per_page'] )),
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -752,10 +752,10 @@ if ($items_display)
|
||||||
$pages = (!$items_count) ? 1 : ceil($items_count / $per_page);
|
$pages = (!$items_count) ? 1 : ceil($items_count / $per_page);
|
||||||
$url = ($search_id) ? url_arg($url, 'id', $search_id) : $url;
|
$url = ($search_id) ? url_arg($url, 'id', $search_id) : $url;
|
||||||
|
|
||||||
|
generate_pagination($url, $items_count, $per_page, $start);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PAGE_TITLE' => $lang['SEARCH'],
|
'PAGE_TITLE' => $lang['SEARCH'],
|
||||||
'PAGINATION' => generate_pagination($url, $items_count, $per_page, $start),
|
|
||||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], floor($start / $per_page) + 1, $pages),
|
|
||||||
|
|
||||||
'SEARCH_MATCHES' => ($items_count) ? sprintf($lang['FOUND_SEARCH_MATCHES'], $items_count) : '',
|
'SEARCH_MATCHES' => ($items_count) ? sprintf($lang['FOUND_SEARCH_MATCHES'], $items_count) : '',
|
||||||
'DISPLAY_AS_POSTS' => $post_mode,
|
'DISPLAY_AS_POSTS' => $post_mode,
|
||||||
|
|
|
@ -436,6 +436,29 @@ important_info
|
||||||
|
|
||||||
<!--menus-->
|
<!--menus-->
|
||||||
|
|
||||||
|
<!-- IF PAGINATION -->
|
||||||
|
<div class="menu-sub" id="pg-jump">
|
||||||
|
<table cellspacing="1" cellpadding="4">
|
||||||
|
<tr><th>К странице...</th></tr>
|
||||||
|
<tr><td>
|
||||||
|
<form method="get" onsubmit="return go_to_page();">
|
||||||
|
<input id="pg-page" type="text" size="5" maxlength="4" />
|
||||||
|
<input type="submit" value="Перейти"/>
|
||||||
|
</form>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function go_to_page ()
|
||||||
|
{
|
||||||
|
var page_num = (parseInt( $('#pg-page').val() ) > 1) ? $('#pg-page').val() : 1;
|
||||||
|
var pg_start = (page_num - 1) * {PG_PER_PAGE};
|
||||||
|
window.location = '{PG_BASE_URL}&start=' + pg_start;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<!-- IF SHOW_ONLY_NEW_MENU -->
|
<!-- IF SHOW_ONLY_NEW_MENU -->
|
||||||
<div class="menu-sub" id="only-new-options">
|
<div class="menu-sub" id="only-new-options">
|
||||||
<table cellspacing="1" cellpadding="4">
|
<table cellspacing="1" cellpadding="4">
|
||||||
|
|
|
@ -174,6 +174,7 @@ function checkForm(form) {
|
||||||
topic_id: {TOPIC_ID}
|
topic_id: {TOPIC_ID}
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
|
$('#topic_quick_reply').hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
|
@ -800,11 +800,11 @@ if ($tor_count)
|
||||||
$search_matches = ($tor_count == 1) ? sprintf($lang['FOUND_SEARCH_MATCH'], $tor_count) : sprintf($lang['FOUND_SEARCH_MATCHES'], $tor_count);
|
$search_matches = ($tor_count == 1) ? sprintf($lang['FOUND_SEARCH_MATCH'], $tor_count) : sprintf($lang['FOUND_SEARCH_MATCHES'], $tor_count);
|
||||||
$search_max = "(max: $tor_search_limit)";
|
$search_max = "(max: $tor_search_limit)";
|
||||||
|
|
||||||
|
generate_pagination($base_url, $tor_count, $per_page, $start);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'MATCHES' => $search_matches,
|
'MATCHES' => $search_matches,
|
||||||
'SERACH_MAX' => $search_max,
|
'SERACH_MAX' => $search_max,
|
||||||
'PAGINATION' => generate_pagination($base_url, $tor_count, $per_page, $start),
|
|
||||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], (floor($start / $per_page) + 1), ceil($tor_count / $per_page)),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -589,10 +589,7 @@ $pg_url .= ($topics_per_page != $bb_cfg['topics_per_page']) ? "&tpp=$topics
|
||||||
|
|
||||||
if ($found_topics)
|
if ($found_topics)
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
generate_pagination($pg_url, $forum_topics, $topics_per_page, $start);
|
||||||
'PAGINATION' => generate_pagination($pg_url, $forum_topics, $topics_per_page, $start),
|
|
||||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], (floor($start / $topics_per_page) + 1), ceil($forum_topics / $topics_per_page)),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -543,7 +543,7 @@ $pg_url .= isset($_REQUEST['single']) ? "&single=1" : '';
|
||||||
$pg_url .= ($moderation) ? "&mod=1" : '';
|
$pg_url .= ($moderation) ? "&mod=1" : '';
|
||||||
$pg_url .= ($posts_per_page != $bb_cfg['posts_per_page']) ? "&ppp=$posts_per_page" : '';
|
$pg_url .= ($posts_per_page != $bb_cfg['posts_per_page']) ? "&ppp=$posts_per_page" : '';
|
||||||
|
|
||||||
$pagination = generate_pagination($pg_url, $total_replies, $posts_per_page, $start);
|
generate_pagination($pg_url, $total_replies, $posts_per_page, $start);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Selects
|
// Selects
|
||||||
|
@ -578,8 +578,6 @@ $template->assign_vars(array(
|
||||||
'TOPIC_ID' => $topic_id,
|
'TOPIC_ID' => $topic_id,
|
||||||
'PAGE_TITLE' => $topic_title,
|
'PAGE_TITLE' => $topic_title,
|
||||||
'TOPIC_TITLE' => wbr($topic_title),
|
'TOPIC_TITLE' => wbr($topic_title),
|
||||||
'PAGINATION' => $pagination,
|
|
||||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], ( floor($start/$posts_per_page) + 1 ), ceil( $total_replies / $posts_per_page )),
|
|
||||||
'PORNO_FORUM' => isset($porno_forums[$forum_id]),
|
'PORNO_FORUM' => isset($porno_forums[$forum_id]),
|
||||||
'REPLY_IMG' => $reply_img,
|
'REPLY_IMG' => $reply_img,
|
||||||
'SHOW_BOT_NICK' => $bb_cfg['show_bot_nick'],
|
'SHOW_BOT_NICK' => $bb_cfg['show_bot_nick'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue