]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-wp.php
Wordpress 3.6-scripts
[autoinstalls/wordpress.git] / wp-includes / class-wp.php
index b1b1e2876e301b26441d011eb0731f4f42bd5347..dc7768865074ee92d0aefbe6a6aa0af1a3029fb9 100644 (file)
@@ -25,7 +25,7 @@ class WP {
         * @since 2.0.0
         * @var array
         */
-       var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in');
+       var $private_query_vars = array( 'offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in', 'post_parent__in', 'post_parent__not_in' );
 
        /**
         * Extra query variables set by the user.
@@ -356,7 +356,7 @@ class WP {
 
                        // Support for Conditional GET
                        if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
-                               $client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
+                               $client_etag = wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] );
                        else $client_etag = false;
 
                        $client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']);
@@ -378,12 +378,29 @@ class WP {
 
                if ( ! empty( $status ) )
                        status_header( $status );
+
+               // If Last-Modified is set to false, it should not be sent (no-cache situation).
+               if ( isset( $headers['Last-Modified'] ) && false === $headers['Last-Modified'] ) {
+                       unset( $headers['Last-Modified'] );
+
+                       // In PHP 5.3+, make sure we are not sending a Last-Modified header.
+                       if ( function_exists( 'header_remove' ) ) {
+                               @header_remove( 'Last-Modified' );
+                       } else {
+                               // In PHP 5.2, send an empty Last-Modified header, but only as a
+                               // last resort to override a header already sent. #WP23021
+                               foreach ( headers_list() as $header ) {
+                                       if ( 0 === stripos( $header, 'Last-Modified' ) ) {
+                                               $headers['Last-Modified'] = '';
+                                               break;
+                                       }
+                               }
+                       }
+               }
+
                foreach( (array) $headers as $name => $field_value )
                        @header("{$name}: {$field_value}");
 
-               if ( isset( $headers['Last-Modified'] ) && empty( $headers['Last-Modified'] ) && function_exists( 'header_remove' ) )
-                       @header_remove( 'Last-Modified' );
-
                if ( $exit_required )
                        exit();