Remove support for 'all' queries and for poststart and postend.
git-svn-id: http://svn.automattic.com/wordpress/trunk@2179 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1a10aedc78
commit
e9d1241d26
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
require_once('admin.php');
|
||||
|
||||
$wpvarstoreset = array('action', 'safe_mode', 'withcomments', 'posts', 'poststart', 'postend', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder' );
|
||||
$wpvarstoreset = array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder' );
|
||||
|
||||
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||
$wpvar = $wpvarstoreset[$i];
|
||||
|
|
|
@ -82,7 +82,7 @@ if ((isset($_GET['error']) && $_GET['error'] == '404') ||
|
|||
}
|
||||
}
|
||||
|
||||
$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error');
|
||||
$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error');
|
||||
|
||||
$wpvarstoreset = apply_filters('query_vars', $wpvarstoreset);
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class WP_Query {
|
|||
|
||||
if ('' != $qv['name']) {
|
||||
$this->is_single = true;
|
||||
} elseif ( $qv['p'] && $qv['p'] != 'all' ) {
|
||||
} elseif ( $qv['p'] ) {
|
||||
$this->is_single = true;
|
||||
} elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {
|
||||
// If year, month, day, hour, minute, and second are set, a single
|
||||
|
@ -133,7 +133,7 @@ class WP_Query {
|
|||
$this->is_date = true;
|
||||
}
|
||||
|
||||
if (empty($qv['cat']) || ($qv['cat'] == 'all') || ($qv['cat'] == '0')) {
|
||||
if (empty($qv['cat']) || ($qv['cat'] == '0')) {
|
||||
$this->is_category = false;
|
||||
} else {
|
||||
if (stristr($qv['cat'],'-')) {
|
||||
|
@ -147,7 +147,7 @@ class WP_Query {
|
|||
$this->is_category = true;
|
||||
}
|
||||
|
||||
if ((empty($qv['author'])) || ($qv['author'] == 'all') || ($qv['author'] == '0')) {
|
||||
if ((empty($qv['author'])) || ($qv['author'] == '0')) {
|
||||
$this->is_author = false;
|
||||
} else {
|
||||
$this->is_author = true;
|
||||
|
@ -298,12 +298,12 @@ class WP_Query {
|
|||
}
|
||||
|
||||
// If a post number is specified, load that post
|
||||
if (($q['p'] != '') && ($q['p'] != 'all') && intval($q['p']) != 0) {
|
||||
if (($q['p'] != '') && intval($q['p']) != 0) {
|
||||
$q['p'] = (int) $q['p'];
|
||||
$where = ' AND ID = ' . $q['p'];
|
||||
}
|
||||
|
||||
if (($q['page_id'] != '') && ($q['page_id'] != 'all')) {
|
||||
if (($q['page_id'] != '') && (intval($q['page_id']) != 0)) {
|
||||
$q['page_id'] = intval($q['page_id']);
|
||||
$q['p'] = $q['page_id'];
|
||||
$where = ' AND ID = '.$q['page_id'];
|
||||
|
@ -338,7 +338,7 @@ class WP_Query {
|
|||
|
||||
// Category stuff
|
||||
|
||||
if ((empty($q['cat'])) || ($q['cat'] == 'all') || ($q['cat'] == '0') ||
|
||||
if ((empty($q['cat'])) || ($q['cat'] == '0') ||
|
||||
// Bypass cat checks if fetching specific posts
|
||||
(
|
||||
intval($q['year']) || intval($q['monthnum']) || intval($q['day']) || intval($q['w']) ||
|
||||
|
@ -397,7 +397,7 @@ class WP_Query {
|
|||
|
||||
// Author/user stuff
|
||||
|
||||
if ((empty($q['author'])) || ($q['author'] == 'all') || ($q['author'] == '0')) {
|
||||
if ((empty($q['author'])) || ($q['author'] == '0')) {
|
||||
$whichauthor='';
|
||||
} else {
|
||||
$q['author'] = ''.urldecode($q['author']).'';
|
||||
|
@ -464,17 +464,10 @@ class WP_Query {
|
|||
}
|
||||
}
|
||||
|
||||
if ($q['p'] == 'all') {
|
||||
$where = '';
|
||||
}
|
||||
|
||||
$now = gmdate('Y-m-d H:i:59');
|
||||
|
||||
if ($pagenow != 'post.php' && $pagenow != 'edit.php') {
|
||||
if ((empty($q['poststart'])) || (empty($q['postend'])) || !($q['postend'] > $q['poststart'])) {
|
||||
$where .= " AND post_date_gmt <= '$now'";
|
||||
}
|
||||
|
||||
$where .= " AND post_date_gmt <= '$now'";
|
||||
$distinct = 'DISTINCT';
|
||||
}
|
||||
|
||||
|
@ -496,24 +489,7 @@ class WP_Query {
|
|||
$join = apply_filters('posts_join', $join);
|
||||
|
||||
// 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()) {
|
||||
if (empty($q['nopaging']) && ! is_single()) {
|
||||
$page = $q['paged'];
|
||||
if (empty($page)) {
|
||||
$page = 1;
|
||||
|
|
Loading…
Reference in New Issue