Make WordPress Core

Ticket #32354: 32354.2.patch

File 32354.2.patch, 1.3 KB (added by chriscct7, 10 years ago)

If port for HTTPS is used set SERVER var

  • wp-includes/functions.php

     
    36813681 * @return bool True if SSL, false if not used.
    36823682 */
    36833683function is_ssl() {
     3684        $is_ssl = false;
    36843685        if ( isset($_SERVER['HTTPS']) ) {
    3685                 if ( 'on' == strtolower($_SERVER['HTTPS']) )
    3686                         return true;
    3687                 if ( '1' == $_SERVER['HTTPS'] )
    3688                         return true;
     3686                if ( 'on' == strtolower($_SERVER['HTTPS']) ) {
     3687                        $is_ssl = true;
     3688                }
     3689                if ( '1' == $_SERVER['HTTPS'] ) {
     3690                        $is_ssl = true;
     3691                }
    36893692        } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
    3690                 return true;
     3693                if ( empty( $_SERVER['HTTPS'] ) || $_SERVER['HTTPS'] != 'on' ){
     3694                        $_SERVER['HTTPS'] = 'on';
     3695                }
     3696                $is_ssl = true;
     3697        } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && ( 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] )) {
     3698                if ( empty( $_SERVER['HTTPS'] ) || $_SERVER['HTTPS'] != 'on' ){
     3699                        $_SERVER['HTTPS'] = 'on';
     3700                }
     3701                $is_ssl = true;
     3702        } else if (stripos( get_option( 'siteurl' ), 'https://' ) === 0 ) {
     3703                if ( empty( $_SERVER['HTTPS'] ) || $_SERVER['HTTPS'] != 'on' ) {
     3704                        $_SERVER['HTTPS'] = 'on';
     3705                }
     3706                $is_ssl = true;
    36913707        }
    3692         return false;
     3708        return apply_filters( 'is_ssl', $is_ssl );
    36933709}
    36943710
    36953711/**