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: http://svn.automattic.com/wordpress/trunk@2535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-04-14 04:24:22 +00:00
parent a0e1196acf
commit 6fa7ece460
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)) {