[wp-cvs] wordpress/wp-includes classes.php, 1.7,
1.8 template-functions-links.php, 1.27, 1.28
Ryan Boren
rboren at users.sourceforge.net
Mon Aug 16 22:50:15 UTC 2004
Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21010/wp-includes
Modified Files:
classes.php template-functions-links.php
Log Message:
Paging cleanup.
Index: template-functions-links.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/template-functions-links.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** template-functions-links.php 14 Aug 2004 17:29:09 -0000 1.27
--- template-functions-links.php 16 Aug 2004 22:50:06 -0000 1.28
***************
*** 430,440 ****
global $request, $posts_per_page, $wpdb;
if (! is_single()) {
! $nxt_request = $request;
! if ($pos = strpos(strtoupper($request), 'LIMIT')) {
$nxt_request = substr($request, 0, $pos);
! }
! $nxt_result = $wpdb->query($nxt_request);
! $numposts = $wpdb->num_rows;
! $max_page = ceil($numposts / $posts_per_page);
if ($max_page > 1) {
previous_posts_link($prelabel);
--- 430,448 ----
global $request, $posts_per_page, $wpdb;
if (! is_single()) {
! $show_what = get_query_var('what_to_show');
!
! if (get_query_var('what_to_show') == 'posts') {
! $nxt_request = $request;
! if ($pos = strpos(strtoupper($request), 'LIMIT')) {
$nxt_request = substr($request, 0, $pos);
! }
!
! $nxt_result = $wpdb->query($nxt_request);
! $numposts = $wpdb->num_rows;
! $max_page = ceil($numposts / $posts_per_page);
! } else {
! $max_page = 999999;
! }
!
if ($max_page > 1) {
previous_posts_link($prelabel);
***************
*** 445,448 ****
}
-
?>
\ No newline at end of file
--- 453,455 ----
Index: classes.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/classes.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** classes.php 14 Aug 2004 16:08:57 -0000 1.7
--- classes.php 16 Aug 2004 22:50:06 -0000 1.8
***************
*** 395,451 ****
}
! if ((!$whichcat) && (!$q['m']) && (!$q['p']) && (!$q['w']) && (!$q['s']) && empty($q['poststart']) && empty($q['postend'])) {
! if ($q['what_to_show'] == 'posts') {
! $limits = ' LIMIT '.$q['posts_per_page'];
! } elseif ($q['what_to_show'] == 'days' && empty($q['monthnum']) && empty($q['year']) && empty($q['day'])) {
! $lastpostdate = get_lastpostdate();
! $lastpostdate = mysql2date('Y-m-d 00:00:00',$lastpostdate);
! $lastpostdate = mysql2date('U',$lastpostdate);
! $otherdate = date('Y-m-d H:i:s', ($lastpostdate - (($q['posts_per_page']-1) * 86400)));
! $where .= " AND post_date > '$otherdate'";
! }
! }
! if ( !empty($q['postend']) && ($q['postend'] > $q['poststart']) && (!$q['m']) && empty($q['monthnum']) && empty($q['year']) && empty($q['day']) &&(!$q['w']) && (!$whichcat) && (!$q['s']) && (!$q['p'])) {
! if ($q['what_to_show'] == 'posts') {
! $q['poststart'] = intval($q['poststart']);
! $q['postend'] = intval($q['postend']);
! $limposts = $q['postend'] - $q['poststart'];
! $limits = ' LIMIT '.$q['poststart'].','.$limposts;
! } elseif ($q['what_to_show'] == 'days') {
! $q['poststart'] = intval($q['poststart']);
! $q['postend'] = intval($q['postend']);
! $limposts = $q['postend'] - $q['poststart'];
! $lastpostdate = get_lastpostdate();
! $lastpostdate = mysql2date('Y-m-d 00:00:00',$lastpostdate);
! $lastpostdate = mysql2date('U',$lastpostdate);
! $startdate = date('Y-m-d H:i:s', ($lastpostdate - (($q['poststart'] -1) * 86400)));
! $otherdate = date('Y-m-d H:i:s', ($lastpostdate - (($q['postend'] -1) * 86400)));
! $where .= " AND post_date > '$otherdate' AND post_date < '$startdate'";
! }
! } else {
! if (($q['what_to_show'] == 'posts') && (! is_single()) && (!$q['more'])) {
! if ($pagenow != 'post.php') {
! $pgstrt = '';
! if ($q['paged']) {
! $pgstrt = (intval($q['paged']) -1) * $q['posts_per_page'] . ', ';
! }
! $limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
! } else {
! if (($q['m']) || ($q['p']) || ($q['w']) || ($q['s']) || ($whichcat)) {
! $limits = '';
! } else {
! $pgstrt = '';
! if ($q['paged']) {
! $pgstrt = (intval($q['paged']) -1) * $q['posts_per_page'] . ', ';
! }
! $limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
! }
! }
! }
! elseif (($q['m']) || ($q['p']) || ($q['w']) || ($q['s']) || ($whichcat) || ($q['author']) || $q['monthnum'] || $q['year'] || $q['day']) {
! $limits = '';
! }
! }
if ($q['p'] == 'all') {
--- 395,439 ----
}
! // Paging
! if ( !empty($q['postend']) && ($q['postend'] > $q['poststart']) ) {
! if ($q['what_to_show'] == 'posts') {
! $q['poststart'] = intval($q['poststart']);
! $q['postend'] = intval($q['postend']);
! $limposts = $q['postend'] - $q['poststart'];
! $limits = ' LIMIT '.$q['poststart'].','.$limposts;
! } elseif ($q['what_to_show'] == 'days') {
! $q['poststart'] = intval($q['poststart']);
! $q['postend'] = intval($q['postend']);
! $limposts = $q['postend'] - $q['poststart'];
! $lastpostdate = get_lastpostdate();
! $lastpostdate = mysql2date('Y-m-d 00:00:00',$lastpostdate);
! $lastpostdate = mysql2date('U',$lastpostdate);
! $startdate = date('Y-m-d H:i:s', ($lastpostdate - (($q['poststart'] -1) * 86400)));
! $otherdate = date('Y-m-d H:i:s', ($lastpostdate - (($q['postend'] -1) * 86400)));
! $where .= " AND post_date > '$otherdate' AND post_date < '$startdate'";
! }
! } else if (empty($q['nopaging']) && ! is_single()) {
! $page = $q['paged'];
! if (empty($page)) {
! $page = 1;
! }
! if (($q['what_to_show'] == 'posts')) {
! $pgstrt = '';
! $pgstrt = (intval($page) -1) * $q['posts_per_page'] . ', ';
! $limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
! } elseif ($q['what_to_show'] == 'days') {
! $lastpostdate = get_lastpostdate();
! $lastpostdate = mysql2date('Y-m-d 00:00:00',$lastpostdate);
! $lastpostdate = mysql2date('U',$lastpostdate);
! $startdate = date('Y-m-d H:i:s', ($lastpostdate - ((intval($page) -1) * ($q['posts_per_page']-1) * 86400)));
! $enddate = date('Y-m-d H:i:s', ($lastpostdate - (intval($page) * ($q['posts_per_page']-1) * 86400)));
! if ($page > 1) {
! $where .= " AND post_date > '$enddate' AND post_date < '$startdate'";
! } else {
! $where .= " AND post_date > '$enddate'";
! }
! }
! }
if ($q['p'] == 'all') {
More information about the cvs
mailing list