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

@ -254,6 +254,11 @@ class WP_Query {
$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));
$wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";
@ -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)) {