Don't allow private query vars in url_to_postid
git-svn-id: http://svn.automattic.com/wordpress/trunk@5925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
07ff444b6f
commit
ac46bc16c7
|
@ -657,6 +657,12 @@ class WP_Query {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !empty($qv['post_type']) )
|
||||||
|
$qv['post_type'] = sanitize_user($qv['post_type'], true);
|
||||||
|
|
||||||
|
if ( !empty($qv['post_status']) )
|
||||||
|
$qv['post_status'] = sanitize_user($qv['post_status'], true);
|
||||||
|
|
||||||
if ( $this->is_posts_page && !$qv['withcomments'] )
|
if ( $this->is_posts_page && !$qv['withcomments'] )
|
||||||
$this->is_comment_feed = false;
|
$this->is_comment_feed = false;
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,15 @@ function url_to_postid($url) {
|
||||||
|
|
||||||
// Substitute the substring matches into the query.
|
// Substitute the substring matches into the query.
|
||||||
eval("\$query = \"$query\";");
|
eval("\$query = \"$query\";");
|
||||||
|
// Filter out non-public query vars
|
||||||
|
global $wp;
|
||||||
|
parse_str($query, $query_vars);
|
||||||
|
$query = array();
|
||||||
|
foreach ( $query_vars as $key => $value ) {
|
||||||
|
if ( in_array($key, $wp->public_query_vars) )
|
||||||
|
$query[$key] = $value;
|
||||||
|
}
|
||||||
|
// Do the query
|
||||||
$query = new WP_Query($query);
|
$query = new WP_Query($query);
|
||||||
if ( $query->is_single || $query->is_page )
|
if ( $query->is_single || $query->is_page )
|
||||||
return $query->post->ID;
|
return $query->post->ID;
|
||||||
|
|
Loading…
Reference in New Issue