WordPress.org

Make WordPress Core

Changeset 13637


Ignore:
Timestamp:
03/09/2010 10:01:49 PM (10 years ago)
Author:
nacin
Message:

Check and error out on port numbers in Tools > Network, which aren't allowed in multisite. see #11816, see #11644

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/network.php

    r13634 r13637  
    5454    $active_plugins = get_option( 'active_plugins' );
    5555    if ( ! empty( $active_plugins ) ) {
    56         printf( '<p>' . __( 'Please <a href="%s">deactivate</a> your plugins before enabling the Network feature. Once the network is created, you may reactivate your plugins.' ) . '</p>', admin_url( 'plugins.php' ) );
     56        echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf( __( 'Please <a href="%s">deactivate</a> your plugins before enabling the Network feature.' ), admin_url( 'plugins.php' ) ) . '</p></div><p>' . __(' Once the network is created, you may reactivate your plugins.' ) . '</p>';
    5757        include( './admin-footer.php' );
    5858        die();
     
    6060
    6161    $hostname = get_clean_basedomain();
    62     if ( preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $hostname ) ) {
    63         echo '<p><strong>' . __('You cannot install a network of sites with your server address.' ) . '</strong></p>';
    64         echo '<p>' . __('You cannot use an IP address such as <code>127.0.0.1</code>.' ) . '</p>';
     62    $has_ports = strstr( $hostname, ':' );
     63    if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) )
     64        || ( $no_ip = preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $hostname ) ) ) {
     65        echo '<div class="error"><p><strong>' . __( 'Error:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</strong></p></div>';
     66        if ( $no_ip )
     67            echo '<p>' . __('You cannot use an IP address such as <code>127.0.0.1</code>.' ) . '</p>';
     68        else
     69            echo '<p>' . sprintf( __('You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>';
     70        echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>';
    6571        include( './admin-footer.php' );
    6672        die();
     
    245251</textarea></li>
    246252        </ol>
    247         <p>Once you complete these steps, your network is enabled and configured. <a href="<?php echo esc_url( admin_url() ); ?>">Return to Dashboard</a></p>
     253        <p><?php printf( __( 'Once you complete these steps, your network is enabled and configured.') ); ?> <a href="<?php echo esc_url( admin_url() ); ?>"><?php _e( 'Return to Dashboard' ); ?></a></p>
    248254<?php
    249255}
Note: See TracChangeset for help on using the changeset viewer.