Ticket #4478: 4478.diff
| File 4478.diff, 4.6 KB (added by ryan, 3 years ago) |
|---|
-
wp-login.php
11 11 /** Make sure that the WordPress bootstrap has ran before continuing. */ 12 12 require( dirname(__FILE__) . '/wp-load.php' ); 13 13 14 // load login theme template if present 15 locate_template(array('login.php'), true); 16 14 17 // Redirect to https login if forced to use SSL 15 18 if ( force_ssl_admin() && !is_ssl() ) { 16 19 if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) { … … 22 25 } 23 26 } 24 27 28 if ( !function_exists('login_header') ) : 25 29 /** 26 30 * Outputs the header for the login page. 27 31 * … … 38 42 * @param string $message Optional. Message to display in header. 39 43 * @param WP_Error $wp_error Optional. WordPress Error Object 40 44 */ 41 function login_header($title = 'Log In' , $message = '', $wp_error = '') {45 function login_header($title = 'Log In') { 42 46 global $error; 43 44 if ( empty($wp_error) )45 $wp_error = new WP_Error();46 47 ?> 47 48 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 48 49 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> … … 58 59 59 60 <div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1> 60 61 <?php 62 login_error($message = '', $wp_error = ''); 63 } // End of login_header() 64 65 endif; // End of login_header function check 66 67 // Default login_footer if not defined by the Theme 68 if ( !function_exists('login_footer') ) : 69 function login_footer() { 70 ?> 71 </body> 72 </html> 73 <?php 74 } 75 endif; 76 77 function login_error($message, $wp_error) { 78 global $error; 79 61 80 if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n"; 62 81 82 if ( empty($wp_error) ) 83 $wp_error = new WP_Error(); 84 63 85 // Incase a plugin uses $error rather than the $errors object 64 86 if ( !empty( $error ) ) { 65 87 $wp_error->add('error', $error); … … 83 105 if ( !empty($messages) ) 84 106 echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n"; 85 107 } 86 } // End of login_header ()108 } // End of login_header_error() 87 109 88 110 /** 89 111 * Handles sending password retrieval email to user. … … 297 319 if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.')); 298 320 299 321 do_action('lost_password'); 300 login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or e-mail address. You will receive a new password via e-mail.') . '</p>', $errors); 322 login_header(__('Lost Password')); 323 login_error('<p class="message">' . __('Please enter your username or e-mail address. You will receive a new password via e-mail.') . '</p>', $errors); 301 324 302 325 $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : ''; 303 326 … … 328 351 <script type="text/javascript"> 329 352 try{document.getElementById('user_login').focus();}catch(e){} 330 353 </script> 331 </body>332 </html>333 354 <?php 355 login_footer(); 334 356 break; 335 357 336 358 case 'resetpass' : … … 367 389 } 368 390 } 369 391 370 login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors); 392 login_header(__('Registration Form')); 393 login_error('<p class="message register">' . __('Register For This Site') . '</p>', $errors); 371 394 ?> 372 395 373 396 <form name="registerform" id="registerform" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post"> … … 396 419 <script type="text/javascript"> 397 420 try{document.getElementById('user_login').focus();}catch(e){} 398 421 </script> 399 </body>400 </html>401 422 <?php 423 login_footer(); 402 424 break; 403 425 404 426 case 'login' : … … 456 478 elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) $errors->add('newpass', __('Check your e-mail for your new password.'), 'message'); 457 479 elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) $errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message'); 458 480 459 login_header(__('Log In'), '', $errors); 481 login_header(__('Log In')); 482 login_error('', $errors); 460 483 461 484 if ( isset($_POST['log']) ) 462 485 $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? attribute_escape(stripslashes($_POST['log'])) : ''; … … 508 531 try{document.getElementById('user_login').focus();}catch(e){} 509 532 <?php } ?> 510 533 </script> 511 </body>512 </html>513 534 <?php 514 535 536 login_footer(); 515 537 break; 516 538 } // end action switch 517 539 ?>
