Ticket #15936: 15936.2.diff
File 15936.2.diff, 2.7 KB (added by , 6 years ago) |
---|
-
src/wp-admin/includes/network.php
133 133 134 134 $hostname = get_clean_basedomain(); 135 135 $has_ports = strstr( $hostname, ':' ); 136 if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { 136 137 /** This filter is documented in wp-includes/ms-settings.php */ 138 $allowed_ports = apply_filters( 'allowed_multisite_ports', array( ':80', ':443' ) ); 139 140 if ( ( false !== $has_ports && ! in_array( $has_ports, $allowed_ports ) ) ) { 137 141 echo '<div class="error"><p><strong>' . __( 'ERROR:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; 138 142 echo '<p>' . sprintf( 139 143 /* translators: %s: port number */ -
src/wp-includes/ms-blogs.php
902 902 // Sanitize domain if passed. 903 903 if ( array_key_exists( 'domain', $data ) ) { 904 904 $data['domain'] = trim( $data['domain'] ); 905 $data['domain'] = preg_replace( '|:\d+$|', '', $data['domain'] ); 905 906 $data['domain'] = preg_replace( '/\s+/', '', sanitize_user( $data['domain'], true ) ); 906 907 if ( is_subdomain_install() ) { 907 908 $data['domain'] = str_replace( '@', '', $data['domain'] ); -
src/wp-includes/ms-settings.php
55 55 if ( ! isset( $current_site ) || ! isset( $current_blog ) ) { 56 56 57 57 $domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) ); 58 if ( substr( $domain, -3 ) == ':80' ) { 59 $domain = substr( $domain, 0, -3 ); 60 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 ); 61 } elseif ( substr( $domain, -4 ) == ':443' ) { 62 $domain = substr( $domain, 0, -4 ); 63 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 ); 58 59 /** 60 * Filters allowed HTTP ports in Multisite. 61 * 62 * @since 5.1.0 63 * 64 * @param array $allowed_ports The allowed ports. Default is [ ':80', ':443' ]. 65 */ 66 $allowed_ports = apply_filters( 'allowed_multisite_ports', array( ':80', ':443' ) ); 67 68 foreach ( $allowed_ports as $allowed_port ) { 69 $str_length = strlen( $allowed_port ); 70 if ( substr( $domain, -$str_length ) == $allowed_port ) { 71 $domain = substr( $domain, 0, -$str_length ); 72 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -$str_length); 73 } 64 74 } 65 75 66 76 $path = stripslashes( $_SERVER['REQUEST_URI'] );