Ticket #23295: 23295-3.patch
File 23295-3.patch, 4.6 KB (added by , 12 years ago) |
---|
-
wp-includes/functions.php
3895 3895 */ 3896 3896 function wp_auth_check_load() { 3897 3897 wp_enqueue_script( 'heartbeat' ); 3898 wp_localize_script( 'heartbeat', 'wpAuthCheck', array( 'check' => ( is_admin() || is_user_logged_in() ) ) ); 3899 3898 3900 add_filter( 'heartbeat_received', 'wp_auth_check', 10, 2 ); 3899 3901 add_filter( 'heartbeat_nopriv_received', 'wp_auth_check', 10, 2 ); 3900 3901 if ( is_admin() )3902 add_action( 'admin_print_footer_scripts', 'wp_auth_check_js' );3903 elseif ( is_user_logged_in() )3904 add_action( 'wp_print_footer_scripts', 'wp_auth_check_js' );3905 3902 } 3906 3903 3907 3904 /** 3908 * Output the JS that shows the wp-login iframe when the user is no longer logged in3909 */3910 function wp_auth_check_js() {3911 ?>3912 <script type="text/javascript">3913 (function($){3914 $( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {3915 var wrap = $('#wp-auth-check-notice-wrap');3916 3917 if ( data['wp-auth-check-html'] && ! wrap.length ) {3918 $('body').append( data['wp-auth-check-html'] );3919 } else if ( !data['wp-auth-check-html'] && wrap.length && ! wrap.data('logged-in') ) {3920 wrap.remove();3921 }3922 }).on( 'heartbeat-send.wp-auth-check', function( e, data ) {3923 data['wp-auth-check'] = 1;3924 });3925 }(jQuery));3926 </script>3927 <?php3928 }3929 3930 /**3931 3905 * Check whether a user is still logged in, and act accordingly if not. 3932 3906 * 3933 3907 * @since 3.6.0 … … 3937 3911 return $response; 3938 3912 3939 3913 // If the user is logged in and we are outside the login grace period, bail. 3940 if ( is_user_logged_in() && empty( $GLOBALS['login_grace_period'] ) )3914 if ( is_user_logged_in() && wp_validate_auth_cookie( '', 'logged_in' ) && empty( $GLOBALS['login_grace_period'] ) ) 3941 3915 return $response; 3942 3916 3943 3917 return array_merge( $response, array( … … 3947 3921 position: fixed; 3948 3922 height: 90%; 3949 3923 left: 50%; 3950 max-height: 4 15px;3924 max-height: 425px; 3951 3925 overflow: auto; 3952 3926 top: 35px; 3953 width: 3 00px;3927 width: 330px; 3954 3928 margin: 0 0 0 -160px; 3955 padding: 12px 20px;3929 padding: 12px; 3956 3930 border: 1px solid #ddd; 3957 3931 background-color: #fbfbfb; 3958 3932 -webkit-border-radius: 3px; … … 3966 3940 #wp-auth-check-form iframe { 3967 3941 height: 100%; 3968 3942 overflow: hidden; 3943 border: 0; 3944 width: 320px; 3945 display: block; 3946 margin: auto; 3969 3947 } 3970 3948 #wp-auth-check a.wp-auth-check-close { 3971 3949 position: absolute; … … 3976 3954 background: url("' . includes_url('images/uploader-icons.png') . '") no-repeat scroll -95px center transparent; 3977 3955 } 3978 3956 #wp-auth-check h3 { 3979 margin: 0 012px;3957 margin: 0 auto 12px; 3980 3958 padding: 0; 3981 font-size: 1.25em; 3959 font-size: 16px; 3960 font-family: sans-serif; 3961 width: 320px; 3982 3962 } 3963 #wp-auth-check .offscreen-text { 3964 position: absolute; 3965 left: -1000em; 3966 height: 1px; 3967 width: 1px; 3968 overflow: hidden; 3969 } 3983 3970 @media print, 3984 3971 (-o-min-device-pixel-ratio: 5/4), 3985 3972 (-webkit-min-device-pixel-ratio: 1.25), … … 3992 3979 </style> 3993 3980 <div id="wp-auth-check" tabindex="0"> 3994 3981 <h3>' . __('Session expired') . '</h3> 3995 <a href="#" class="wp-auth-check-close"><span class=" screen-reader-text">' . __('close') . '</span></a>3982 <a href="#" class="wp-auth-check-close"><span class="offscreen-text">' . __('close') . '</span></a> 3996 3983 <div id="wp-auth-check-form"> 3997 3984 <iframe src="' . esc_url( add_query_arg( array( 'interim-login' => 1 ), wp_login_url() ) ) . '" frameborder="0"></iframe> 3998 3985 </div> … … 4008 3995 var height; 4009 3996 try { height = $(this.contentWindow.document).find("#login").height(); } catch(er){} 4010 3997 if ( height ) { 4011 $("#wp-auth-check").css("max-height", height + 40 + "px");4012 $(this).css("height", height + 5 + "px");3998 $("#wp-auth-check").css("max-height", height + 50 + "px"); 3999 $(this).css("height", height + 15 + "px"); 4013 4000 if ( height < 200 ) { 4014 4001 wrap.data("logged-in", true); 4015 4002 setTimeout( function(){ wrap.fadeOut(200, function(){ wrap.remove(); }); }, 5000 ); -
wp-includes/js/heartbeat.js
410 410 wp.heartbeat = new Heartbeat(); 411 411 412 412 }(jQuery)); 413 414 (function($){ 415 $( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) { 416 var wrap = $('#wp-auth-check-notice-wrap'); 417 418 if ( data['wp-auth-check-html'] && ! wrap.length ) { 419 $('body').append( data['wp-auth-check-html'] ); 420 } else if ( !data['wp-auth-check-html'] && wrap.length && ! wrap.data('logged-in') ) { 421 wrap.remove(); 422 } 423 }).on( 'heartbeat-send.wp-auth-check', function( e, data ) { 424 if ( window.wpAuthCheck && window.wpAuthCheck.check ) 425 data['wp-auth-check'] = 1; 426 }); 427 }(jQuery));