Ticket #15936: 15936.4.diff
File 15936.4.diff, 3.7 KB (added by , 5 years ago) |
---|
-
src/wp-admin/includes/network.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
135 135 136 136 $hostname = get_clean_basedomain(); 137 137 $has_ports = strstr( $hostname, ':' ); 138 if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { 138 139 /** This filter is documented in wp-includes/ms-settings.php */ 140 $allowed_ports = apply_filters( 'allowed_multisite_ports', array( ':80', ':443' ) ); 141 142 if ( ( false !== $has_ports && ! in_array( $has_ports, $allowed_ports ) ) ) { 139 143 echo '<div class="error"><p><strong>' . __( 'ERROR:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; 140 144 echo '<p>' . sprintf( 141 145 /* translators: %s: Port number. */ -
src/wp-includes/ms-settings.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
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 * @param array $allowed_ports The allowed ports. Default is [ ':80', ':443' ]. 63 * 64 * @since 5.3.0 65 * 66 */ 67 $allowed_ports = apply_filters( 'allowed_multisite_ports', array( ':80', ':443' ) ); 68 69 foreach ( $allowed_ports as $allowed_port ) { 70 $str_length = strlen( $allowed_port ); 71 if ( substr( $domain, - $str_length ) == $allowed_port ) { 72 $domain = substr( $domain, 0, - $str_length ); 73 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, - $str_length ); 74 } 64 75 } 65 76 66 77 $path = stripslashes( $_SERVER['REQUEST_URI'] ); -
src/wp-includes/ms-site.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
534 534 // Sanitize domain if passed. 535 535 if ( array_key_exists( 'domain', $data ) ) { 536 536 $data['domain'] = trim( $data['domain'] ); 537 $data['domain'] = preg_replace( '|:\d+$|', '', $data['domain'] ); 537 538 $data['domain'] = preg_replace( '/\s+/', '', sanitize_user( $data['domain'], true ) ); 538 539 if ( is_subdomain_install() ) { 539 540 $data['domain'] = str_replace( '@', '', $data['domain'] ); -
tests/phpunit/tests/multisite/site.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
1385 1385 'lang_id' => 1, 1386 1386 ), 1387 1387 ), 1388 array( 1389 array( 1390 'domain' => 'example.com:443', 1391 ), 1392 array( 1393 'domain' => 'example.com', 1394 'path' => '/', 1395 ), 1396 ), 1397 array( 1398 array( 1399 'domain' => 'example.com:80', 1400 'path' => '/foo', 1401 ), 1402 array( 1403 'domain' => 'example.com', 1404 'path' => '/foo/', 1405 ), 1406 ), 1388 1407 ); 1389 1408 } 1390 1409