allow subdir multisite on ip address, see #12142

git-svn-id: http://svn.automattic.com/wordpress/trunk@14386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
wpmuguru 2010-05-03 19:23:37 +00:00
parent a42ee2366e
commit 7832748847
1 changed files with 2 additions and 3 deletions

View File

@ -44,7 +44,7 @@ function network_domain_check() {
*/ */
function allow_subdomain_install() { function allow_subdomain_install() {
$domain = preg_replace( '|https?://[^/]|', '', get_option( 'siteurl' ) ); $domain = preg_replace( '|https?://[^/]|', '', get_option( 'siteurl' ) );
if( false !== strpos( $domain, '/' ) || 'localhost' == $_SERVER[ 'HTTP_HOST' ] ) if( false !== strpos( $domain, '/' ) || 'localhost' == $domain || preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $domain ) )
return false; return false;
return true; return true;
@ -106,8 +106,7 @@ function network_step1( $errors = false ) {
$hostname = get_clean_basedomain(); $hostname = get_clean_basedomain();
$has_ports = strstr( $hostname, ':' ); $has_ports = strstr( $hostname, ':' );
if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) {
|| ( $no_ip = preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $hostname ) ) ) {
echo '<div class="error"><p><strong>' . __( 'Error:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</strong></p></div>'; echo '<div class="error"><p><strong>' . __( 'Error:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</strong></p></div>';
if ( $no_ip ) if ( $no_ip )
echo '<p>' . __( 'You cannot use an IP address such as <code>127.0.0.1</code>.' ) . '</p>'; echo '<p>' . __( 'You cannot use an IP address such as <code>127.0.0.1</code>.' ) . '</p>';