Fix post paging regex to avoid regex collision between posts with slugs that differ only by a trailing number. http://mosquito.wordpress.org/view.php?id=1235

git-svn-id: https://develop.svn.wordpress.org/trunk@2535 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2005-04-14 04:24:22 +00:00
parent b86f9be3ef
commit 5cf9bdb5ae
2 changed files with 9 additions and 2 deletions

View File

@ -253,6 +253,11 @@ class WP_Query {
$q['posts_per_page'] = get_settings('posts_per_rss');
$q['what_to_show'] = 'posts';
}
if (isset($q['page'])) {
$q['page'] = trim($q['page'], '/');
$q['page'] = (int) $q['page'];
}
$add_hours = intval(get_settings('gmt_offset'));
$add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
@ -1123,7 +1128,8 @@ class WP_Rewrite {
$post = 1;
$trackbackmatch = $match . $trackbackregex;
$trackbackquery = $trackbackindex . '?' . $query . '&tb=1';
$match = $match . '?([0-9]+)?/?$';
$match = rtrim($match, '/');
$match = $match . '(/[0-9]+)?/?$';
$query = $index . '?' . $query . '&page=' . $this->preg_index($num_toks + 1);
} else {
$match .= '?$';

View File

@ -879,9 +879,10 @@ function setup_postdata($post) {
$day = mysql2date('d.m.y', $post->post_date);
$currentmonth = mysql2date('m', $post->post_date);
$numpages = 1;
$page = get_query_var('page');
if (!$page)
$page = 1;
if (isset($p))
if (is_single() || is_page())
$more = 1;
$content = $post->post_content;
if (preg_match('/<!--nextpage-->/', $content)) {