WordPress.org

Make WordPress Core

Changeset 14513


Ignore:
Timestamp:
05/08/10 15:25:33 (4 years ago)
Author:
wpmuguru
Message:

add network install rule, filter & UI tweaks, see #12931

File:
1 edited

Legend:

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

    r14463 r14513  
    4949 
    5050    return true; 
     51} 
     52/** 
     53 * Allow folder install 
     54 * 
     55 * @since 3.0.0 
     56 * @return bool Whether folder install is allowed 
     57 */ 
     58function allow_folder_install() { 
     59    global $wpdb; 
     60    if ( apply_filters( 'allow_folder_install', false ) ) 
     61        return true; 
     62 
     63    $post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" ); 
     64    if ( empty( $post ) ) 
     65        return true; 
     66 
     67    return false; 
    5168} 
    5269/** 
     
    109126    if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { 
    110127        echo '<div class="error"><p><strong>' . __( 'Error:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</strong></p></div>'; 
    111         if ( $no_ip ) 
    112             echo '<p>' . __( 'You cannot use an IP address such as <code>127.0.0.1</code>.' ) . '</p>'; 
    113         else 
    114             echo '<p>' . sprintf( __( 'You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>'; 
     128        echo '<p>' . sprintf( __( 'You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>'; 
    115129        echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>'; 
    116130        include( './admin-footer.php' ); 
     
    140154        $subdomain_install = (bool) $_POST['subdomain_install']; 
    141155    } elseif ( apache_mod_loaded('mod_rewrite') ) { // assume nothing 
     156        $subdomain_install = true; 
     157    } elseif ( !allow_folder_install() ) { 
    142158        $subdomain_install = true; 
    143159    } else { 
     
    150166    } 
    151167 
    152     if ( allow_subdomain_install() ) : ?> 
     168    if ( allow_subdomain_install() && allow_folder_install() ) : ?> 
    153169        <h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3> 
    154170        <p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>' ); ?></p> 
     
    238254 
    239255    if ( $_POST ) { 
    240         $subdomain_install = allow_subdomain_install() ? ! empty( $_POST['subdomain_install'] ) : false; 
     256        $subdomain_install = allow_subdomain_install() ? ( allow_folder_install() ? ! empty( $_POST['subdomain_install'] ) : true ) : false; 
    241257    } else { 
    242258        if ( is_multisite() ) { 
     
    333349        </ol> 
    334350<?php if ( !is_multisite() ) { ?> 
    335         <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> 
     351        <p><?php printf( __( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.') ); ?> <a href="<?php echo esc_url( site_url( 'wp-login.php' ) ); ?>"><?php _e( 'Log In' ); ?></a></p> 
    336352<?php 
    337353    } 
Note: See TracChangeset for help on using the changeset viewer.