From c1e9ee019dcce4d8c2e5bc7d6feac95afa812598 Mon Sep 17 00:00:00 2001 From: donncha Date: Wed, 5 Jul 2006 11:55:16 +0000 Subject: WP Merge. Delete feed code and sql git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@636 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-includes/query.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'wp-includes/query.php') diff --git a/wp-includes/query.php b/wp-includes/query.php index 3bb98b0..d42aa9e 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -555,6 +555,7 @@ class WP_Query { if (isset($q['page'])) { $q['page'] = trim($q['page'], '/'); $q['page'] = (int) $q['page']; + $q['page'] = abs($q['page']); } $add_hours = intval(get_settings('gmt_offset')); @@ -842,11 +843,11 @@ class WP_Query { } if ( $this->is_attachment ) { - $where .= ' AND (post_type = "attachment")'; + $where .= " AND (post_type = 'attachment')"; } elseif ($this->is_page) { - $where .= ' AND (post_type = "page")'; + $where .= " AND (post_type = 'page')"; } elseif ($this->is_single) { - $where .= ' AND (post_type = "post")'; + $where .= " AND (post_type = 'post')"; } else { $where .= " AND (post_type = '$post_type' AND (post_status = 'publish'"; @@ -875,18 +876,19 @@ class WP_Query { // Paging if (empty($q['nopaging']) && ! $this->is_single && ! $this->is_page) { - $page = $q['paged']; + $page = abs(intval($q['paged'])); if (empty($page)) { $page = 1; } if (($q['what_to_show'] == 'posts')) { + $q['offset'] = abs(intval($q['offset'])); if ( empty($q['offset']) ) { $pgstrt = ''; $pgstrt = (intval($page) -1) * $q['posts_per_page'] . ', '; $limits = 'LIMIT '.$pgstrt.$q['posts_per_page']; } else { // we're ignoring $page and using 'offset' - $pgstrt = intval($q['offset']) . ', '; + $pgstrt = $q['offset'] . ', '; $limits = 'LIMIT ' . $pgstrt . $q['posts_per_page']; } } elseif ($q['what_to_show'] == 'days') { -- cgit