Ticket #4606: wp2-4606.002.diff

File wp2-4606.002.diff, 1.9 kB (added by snakefoot, 11 months ago)

Fix for branch 2.0

  • wp-includes/pluggable-functions.php

    old new  
    284284} 
    285285endif; 
    286286 
     287if ( !function_exists('wp_safe_redirect') ) :  
     288/**  
     289* performs a safe (local) redirect, using wp_redirect()  
     290* @return void  
     291**/  
     292function wp_safe_redirect($location, $status = 302) {  
     293        if ( $location{0} == '/' ) {  
     294                if ( $location{1} == '/' )  
     295                        $location = get_option('home') . '/';  
     296        } else {  
     297                if ( substr($location, 0, strlen(get_option('home'))) != get_option('home') )  
     298                        $location = get_option('home') . '/';  
     299        }  
     300  
     301        wp_redirect($location, $status);  
     302} 
     303endif;  
     304 
    287305if ( !function_exists('wp_get_cookie_login') ): 
    288306function wp_get_cookie_login() { 
    289307        if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) ) 
  • wp-login.php

    old new  
    2929        if ( isset($_REQUEST['redirect_to']) ) 
    3030                $redirect_to = $_REQUEST['redirect_to']; 
    3131                         
    32         wp_redirect($redirect_to); 
     32        wp_safe_redirect($redirect_to); 
    3333        exit(); 
    3434 
    3535break; 
     
    198198                        if ( !$using_cookie ) 
    199199                                wp_setcookie($user_login, $user_pass, false, '', '', $rememberme); 
    200200                        do_action('wp_login', $user_login); 
    201                         wp_redirect($redirect_to); 
     201                        wp_safe_redirect($redirect_to); 
    202202                        exit; 
    203203                } else { 
    204204                        if ( $using_cookie )                     
  • wp-pass.php

    old new  
    77// 10 days 
    88setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 864000, COOKIEPATH); 
    99 
    10 wp_redirect(wp_get_referer()); 
     10wp_safe_redirect(wp_get_referer()); 
    1111?>