Ticket #16167: 16167.patch
| File 16167.patch, 8.9 KB (added by kurtpayne, 19 months ago) |
|---|
-
wp-includes/admin-bar.php
231 231 232 232 $blogname = get_bloginfo('name'); 233 233 234 if ( empty( $blogname ) ) 234 if ( empty( $blogname ) ) { 235 235 $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() ); 236 237 // Strip out port numbers 238 if ( 80 != WP_HTTP_PORT || 443 != WP_HTTPS_PORT ) 239 $blogname = str_replace( array(':' . WP_HTTPS_PORT, ':' . WP_HTTP_PORT), '', $blogname ); 240 } 236 241 237 242 if ( is_network_admin() ) { 238 243 $blogname = sprintf( __('Network Admin: %s'), esc_html( $current_site->site_name ) ); -
wp-includes/canonical.php
44 44 // build the URL in the address bar 45 45 $requested_url = is_ssl() ? 'https://' : 'http://'; 46 46 $requested_url .= $_SERVER['HTTP_HOST']; 47 if ( is_ssl() && 443 != WP_HTTPS_PORT ) { 48 $requested_url .= ':' . WP_HTTPS_PORT; 49 } elseif ( 80 != WP_HTTP_PORT ) { 50 $requested_url .= ':' . WP_HTTP_PORT; 51 } 47 52 $requested_url .= $_SERVER['REQUEST_URI']; 48 53 } 49 54 -
wp-includes/class-wp-editor.php
214 214 215 215 foreach ( $mce_external_plugins as $name => $url ) { 216 216 217 if ( is_ssl() ) $url = str_replace('http://', 'https://', $url); 217 if ( is_ssl() ) 218 $url = make_https( $url ); 218 219 219 220 $plugins[] = '-' . $name; 220 221 -
wp-admin/includes/class-wp-list-table.php
486 486 487 487 $current = $this->get_pagenum(); 488 488 489 $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 489 $current_url = 'http://' . $_SERVER['HTTP_HOST'] . (80 != WP_HTTP_PORT ? ':' . WP_HTTP_PORT : '') . $_SERVER['REQUEST_URI']; 490 if ( is_ssl() ) 491 $current_url = make_https($current_url); 490 492 491 493 $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url ); 492 494 -
wp-admin/includes/class-wp-themes-list-table.php
141 141 $theme_root_uri = $themes[$theme_name]['Theme Root URI']; 142 142 $preview_link = esc_url( get_option( 'home' ) . '/' ); 143 143 if ( is_ssl() ) 144 $preview_link = str_replace( 'http://', 'https://', $preview_link ); 144 $preview_link = make_https ($preview_link); 145 145 146 $preview_link = htmlspecialchars( add_query_arg( array( 'preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => true, 'TB_iframe' => 'true' ), $preview_link ) ); 146 147 $preview_text = esc_attr( sprintf( __( 'Preview of “%s”' ), $title ) ); 147 148 $tags = $themes[$theme_name]['Tags']; -
wp-includes/default-constants.php
246 246 if ( !defined('FORCE_SSL_LOGIN') ) 247 247 define('FORCE_SSL_LOGIN', false); 248 248 force_ssl_login(FORCE_SSL_LOGIN); 249 250 if ( !defined('WP_HTTPS_PORT') ) 251 define('WP_HTTPS_PORT', 443); 252 if ( !defined('WP_HTTP_PORT') ) 253 define('WP_HTTP_PORT', 80); 249 254 } 250 255 251 256 /** -
wp-includes/functions.php
3650 3650 return true; 3651 3651 if ( '1' == $_SERVER['HTTPS'] ) 3652 3652 return true; 3653 } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {3653 } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] || WP_HTTPS_PORT == $_SERVER['SERVER_PORT'] ) ) { 3654 3654 return true; 3655 3655 } 3656 3656 return false; … … 3711 3711 $url = WP_SITEURL; 3712 3712 } else { 3713 3713 $schema = is_ssl() ? 'https://' : 'http://'; 3714 $url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 3714 $port = ''; 3715 if ( is_ssl() && 443 != WP_HTTPS_PORT ) { 3716 $port = ':' . WP_HTTPS_PORT; 3717 } elseif ( 80 != WP_HTTP_PORT ) { 3718 $port = ':' . WP_HTTP_PORT; 3719 } 3720 $url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $port . $_SERVER['REQUEST_URI']); 3715 3721 } 3716 3722 return rtrim($url, '/'); 3717 3723 } -
wp-includes/link-template.php
1934 1934 if ( 'http' != $scheme ) 1935 1935 $url = str_replace( 'http://', "{$scheme}://", $url ); 1936 1936 1937 // Replace the port, use what's in the URL, not what the requestor specified 1938 if ( ( 'http' == parse_url($url, PHP_URL_SCHEME) && 80 != WP_HTTP_PORT ) || ( 'https' == parse_url($url, PHP_URL_SCHEME) && 443 != WP_HTTPS_PORT ) ) { 1939 $url = str_replace(':' . parse_url($url, PHP_URL_PORT), '', $url); 1940 $port = ''; 1941 if ( 'https' == parse_url($url, PHP_URL_SCHEME) && 443 != WP_HTTPS_PORT ) { 1942 $port = ':' . WP_HTTPS_PORT; 1943 } elseif ( 'http' == parse_url($url, PHP_URL_SCHEME) && 80 != WP_HTTP_PORT ) { 1944 $port = ':' . WP_HTTP_PORT; 1945 } 1946 $url = str_replace(parse_url($url, PHP_URL_SCHEME) . '://' . parse_url($url, PHP_URL_HOST), parse_url($url, PHP_URL_SCHEME) . '://' . parse_url($url, PHP_URL_HOST) . $port, $url); 1947 } 1948 1937 1949 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) 1938 1950 $url .= '/' . ltrim( $path, '/' ); 1939 1951 … … 1975 1987 } 1976 1988 1977 1989 /** 1990 * Switch an http url to https 1991 * @param string $url 1992 * @return string 1993 */ 1994 function make_https($url) { 1995 1996 // If the URL isn't parsable return 1997 $parts = parse_url($url); 1998 if ( null === $parts ) 1999 return $url; 2000 2001 // Set port number 2002 $port = ''; 2003 if ( 443 != WP_HTTPS_PORT ) 2004 $port = ':' . WP_HTTPS_PORT; 2005 2006 // Make the swaps 2007 $url = preg_replace('/http[s]:\/\/' . $parts['host'] . ':\d+/', 'https://' . $parts['host'] . $port, $url); 2008 2009 // Done 2010 return $url; 2011 } 2012 2013 /** 2014 * Switch an https url to http 2015 * @param string $url 2016 * @return string 2017 */ 2018 function make_http($url) { 2019 2020 // If the URL isn't parsable return 2021 $parts = parse_url($url); 2022 if ( null === $parts ) 2023 return $url; 2024 2025 // Set port number 2026 $port = ''; 2027 if ( 80 != WP_HTTP_PORT ) 2028 $port = ':' . WP_HTTP_PORT; 2029 2030 // Make the swaps 2031 $url = preg_replace('/http[s]:\/\/' . $parts['host'] . ':\d+/', 'http://' . $parts['host'] . $port, $url); 2032 2033 // Done 2034 return $url; 2035 } 2036 2037 /** 1978 2038 * Retrieve the url to the includes directory. 1979 2039 * 1980 2040 * @package WordPress -
wp-includes/pluggable.php
739 739 // If https is required and request is http, redirect 740 740 if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) { 741 741 if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) { 742 wp_redirect( preg_replace('|^http://|', 'https://',$_SERVER['REQUEST_URI']));742 wp_redirect(make_https($_SERVER['REQUEST_URI'])); 743 743 exit(); 744 744 } else { 745 wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);745 wp_redirect(make_https('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])); 746 746 exit(); 747 747 } 748 748 } … … 758 758 // If the user wants ssl but the session is not ssl, redirect. 759 759 if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) { 760 760 if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) { 761 wp_redirect( preg_replace('|^http://|', 'https://',$_SERVER['REQUEST_URI']));761 wp_redirect(make_https($_SERVER['REQUEST_URI'])); 762 762 exit(); 763 763 } else { 764 wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);764 wp_redirect(make_https('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])); 765 765 exit(); 766 766 } 767 767 } -
wp-includes/theme.php
1448 1448 $url = get_random_header_image(); 1449 1449 1450 1450 if ( is_ssl() ) 1451 $url = str_replace( 'http://', 'https://', $url);1451 $url = make_https($url); 1452 1452 else 1453 $url = str_replace( 'https://', 'http://', $url);1453 $url = make_http($url); 1454 1454 1455 1455 return esc_url_raw( $url ); 1456 1456 }
