summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-includes/query.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-07 14:28:14 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-07 14:28:14 +0000
commit9d42ec4ee5db0437e9ad14b793f044fa0f5de8fe (patch)
treea0bb93e81f1856204377f936a97a8a285f77f2b7 /wp-inst/wp-includes/query.php
parent16cdc878fce216364bd57f498baeeb1b94ca8662 (diff)
downloadwordpress-mu-9d42ec4ee5db0437e9ad14b793f044fa0f5de8fe.tar.gz
wordpress-mu-9d42ec4ee5db0437e9ad14b793f044fa0f5de8fe.tar.xz
wordpress-mu-9d42ec4ee5db0437e9ad14b793f044fa0f5de8fe.zip
WP Merge and new features
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@550 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/query.php')
-rw-r--r--wp-inst/wp-includes/query.php34
1 files changed, 29 insertions, 5 deletions
diff --git a/wp-inst/wp-includes/query.php b/wp-inst/wp-includes/query.php
index aa7069c..510a7ab 100644
--- a/wp-inst/wp-includes/query.php
+++ b/wp-inst/wp-includes/query.php
@@ -157,6 +157,12 @@ function is_preview() {
return $wp_query->is_preview;
}
+function is_robots() {
+ global $wp_query;
+
+ return $wp_query->is_robots;
+}
+
function is_search () {
global $wp_query;
@@ -272,6 +278,7 @@ class WP_Query {
var $is_comments_popup = false;
var $is_admin = false;
var $is_attachment = false;
+ var $is_robots = false;
function init_query_flags() {
$this->is_single = false;
@@ -292,6 +299,7 @@ class WP_Query {
$this->is_paged = false;
$this->is_admin = false;
$this->is_attachment = false;
+ $this->is_robots = false;
}
function init () {
@@ -321,6 +329,11 @@ class WP_Query {
$this->query_vars = $qv;
}
+ if ( ! empty($qv['robots']) ) {
+ $this->is_robots = true;
+ return;
+ }
+
if ('404' == $qv['error']) {
$this->is_404 = true;
if ( !empty($query) ) {
@@ -697,6 +710,7 @@ class WP_Query {
$cat_array = preg_split('/[,\s]+/', $q['cat']);
$in_cats = $out_cats = '';
foreach ( $cat_array as $cat ) {
+ $cat = intval($cat);
$in = strstr($cat, '-') ? false : true;
$cat = trim($cat, '-');
if ( $in )
@@ -828,13 +842,23 @@ class WP_Query {
} else {
$where .= " AND (post_type = '$post_type' AND (post_status = 'publish'";
- if ( is_admin() )
+ if ( is_admin() ) {
$where .= " OR post_status = 'future' OR post_status = 'draft'";
- if ( is_user_logged_in() )
- $where .= " OR post_author = $user_ID AND post_status = 'private'))";
- else
- $where .= '))';
+ if ( is_user_logged_in() ) {
+ if ( 'post' == $post_type )
+ $cap = 'edit_private_posts';
+ else
+ $cap = 'edit_private_pages';
+
+ if ( current_user_can($cap) )
+ $where .= "OR post_status = 'private'";
+ else
+ $where .= " OR post_author = $user_ID AND post_status = 'private'";
+ }
+ }
+
+ $where .= '))';
}
// Apply filters on where and join prior to paging so that any