]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/post-template.php
Wordpress 3.5.2
[autoinstalls/wordpress.git] / wp-includes / post-template.php
index 21620b456f85e07264d800cd918cc00638aa204e..d51d00953ee3494eefcff76216067e833ec83938 100644 (file)
@@ -567,8 +567,6 @@ function get_body_class( $class = '' ) {
  * @return bool false if a password is not required or the correct password cookie is present, true otherwise.
  */
 function post_password_required( $post = null ) {
  * @return bool false if a password is not required or the correct password cookie is present, true otherwise.
  */
 function post_password_required( $post = null ) {
-       global $wp_hasher;
-
        $post = get_post($post);
 
        if ( empty( $post->post_password ) )
        $post = get_post($post);
 
        if ( empty( $post->post_password ) )
@@ -577,15 +575,14 @@ function post_password_required( $post = null ) {
        if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
                return true;
 
        if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
                return true;
 
-       if ( empty( $wp_hasher ) ) {
-               require_once( ABSPATH . 'wp-includes/class-phpass.php');
-               // By default, use the portable hash from phpass
-               $wp_hasher = new PasswordHash(8, true);
-       }
+       require_once ABSPATH . 'wp-includes/class-phpass.php';
+       $hasher = new PasswordHash( 8, true );
 
        $hash = stripslashes( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
 
        $hash = stripslashes( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
+       if ( 0 !== strpos( $hash, '$P$B' ) )
+               return true;
 
 
-       return ! $wp_hasher->CheckPassword( $post->post_password, $hash );
+       return ! $hasher->CheckPassword( $post->post_password, $hash );
 }
 
 /**
 }
 
 /**