diff --git a/src/wp-admin/includes/network.php b/src/wp-admin/includes/network.php
index da7aec3..b008176 100644
a
|
b
|
function allow_subdomain_install() { |
52 | 52 | */ |
53 | 53 | function allow_subdirectory_install() { |
54 | 54 | global $wpdb; |
55 | | /** |
56 | | * Filters whether to enable the subdirectory installation feature in Multisite. |
57 | | * |
58 | | * @since 3.0.0 |
59 | | * |
60 | | * @param bool $allow Whether to enable the subdirectory installation feature in Multisite. Default is false. |
61 | | */ |
| 55 | /** |
| 56 | * Filters whether to enable the subdirectory installation feature in Multisite. |
| 57 | * |
| 58 | * @since 3.0.0 |
| 59 | * |
| 60 | * @param bool $allow Whether to enable the subdirectory installation feature in Multisite. Default is false. |
| 61 | */ |
62 | 62 | if ( apply_filters( 'allow_subdirectory_install', false ) ) { |
63 | 63 | return true; |
64 | 64 | } |
… |
… |
function network_step1( $errors = false ) { |
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 | * Filters allowed HTTP ports in Multisite. |
| 138 | * |
| 139 | * @since 5.0.0 |
| 140 | * |
| 141 | * @param array $allowed_ports The allowed ports. Default is [ ':80', ':443' ]. |
| 142 | */ |
| 143 | if ( ( false !== $has_ports && ! in_array( $has_ports, apply_filters( 'allowed_multisite_ports', array( ':80', ':443' ) ) ) ) ) { |
137 | 144 | echo '<div class="error"><p><strong>' . __( 'ERROR:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; |
138 | 145 | echo '<p>' . sprintf( |
139 | 146 | /* translators: %s: port number */ |
diff --git a/src/wp-admin/network/site-info.php b/src/wp-admin/network/site-info.php
index 83e05ae..facec76 100644
a
|
b
|
if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] ) { |
67 | 67 | |
68 | 68 | $blog_data['scheme'] = $update_parsed_url['scheme']; |
69 | 69 | $blog_data['domain'] = $update_parsed_url['host']; |
| 70 | // Add port (if it's in allowed list) |
| 71 | if ( ! empty( $update_parsed_url['port'] && in_array( ':' . $update_parsed_url['port'], apply_filters( 'allowed_multisite_ports', array( ':80', ':443' ) ) ) ) ) { |
| 72 | $blog_data['domain'] .= ':' . $update_parsed_url['port']; |
| 73 | } |
70 | 74 | $blog_data['path'] = $update_parsed_url['path']; |
71 | 75 | } |
72 | | |
73 | 76 | $existing_details = get_site( $id ); |
74 | 77 | $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' ); |
75 | 78 | foreach ( $blog_data_checkboxes as $c ) { |
diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
index 984a69c..962998e 100644
a
|
b
|
function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $n |
1272 | 1272 | ); |
1273 | 1273 | $meta = wp_parse_args( $meta, $defaults ); |
1274 | 1274 | |
| 1275 | add_filter( 'sanitize_user', 'wpmu_sanitize_domain_filter', 1, 3 ); |
1275 | 1276 | $domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) ); |
| 1277 | remove_filter( 'sanitize_user', 'wpmu_sanitize_domain_filter', 1, 3 ); |
1276 | 1278 | |
1277 | 1279 | if ( is_subdomain_install() ) { |
1278 | 1280 | $domain = str_replace( '@', '', $domain ); |
… |
… |
function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $n |
1339 | 1341 | } |
1340 | 1342 | |
1341 | 1343 | /** |
| 1344 | * Callback for 'sanitize_user' filter allowing ports in domain string. |
| 1345 | * |
| 1346 | * @since 5.0.0 |
| 1347 | * |
| 1348 | * @param string $domain Sanitized domain. |
| 1349 | * @param string $raw_domain The domain prior to sanitization. |
| 1350 | * @param bool $strict Whether to limit the sanitization to specific characters. Default false. |
| 1351 | */ |
| 1352 | function wpmu_sanitize_domain_filter ( $domain, $raw_domain, $strict ) { |
| 1353 | $port = parse_url( $raw_domain, PHP_URL_PORT ); |
| 1354 | if ( ! empty($port) && in_array( ':' . $port, apply_filters( 'allowed_multisite_ports', array( ':80', ':443' ) ) ) ) { |
| 1355 | $domain = preg_replace( "/{$port}$/", ':' . $port, $domain ); |
| 1356 | } |
| 1357 | return $domain; |
| 1358 | } |
| 1359 | |
| 1360 | /** |
1342 | 1361 | * Notifies the network admin that a new site has been activated. |
1343 | 1362 | * |
1344 | 1363 | * Filter {@see 'newblog_notify_siteadmin'} to change the content of |