WordPress.org

Make WordPress Core

Changeset 21664 for trunk/wp-login.php


Ignore:
Timestamp:
08/30/2012 01:33:00 PM (9 years ago)
Author:
ryan
Message:

Use set_url_scheme(). Props johnbillion, MarcusPope. see #19037 #20759

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-login.php

    r21507 r21664  
    1313
    1414// Redirect to https login if forced to use SSL
    15 if ( force_ssl_admin() && !is_ssl() ) {
     15if ( force_ssl_admin() && ! is_ssl() ) {
    1616    if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
    17         wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
     17        wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
    1818        exit();
    1919    } else {
    20         wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     20        wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
    2121        exit();
    2222    }
     
    366366        $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
    367367
    368     $schema = is_ssl() ? 'https://' : 'http://';
    369     if ( dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_option('siteurl') )
    370         update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) );
     368    $url = dirname( set_url_scheme( 'http://' .  $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) );
     369    if ( $url != get_option( 'siteurl' ) )
     370        update_option( 'siteurl', $url );
    371371}
    372372
Note: See TracChangeset for help on using the changeset viewer.