Changeset 13611 for trunk/wp-admin/network.php
- Timestamp:
- 03/06/2010 08:01:32 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/network.php
r13572 r13611 90 90 <label><input type='checkbox' name='existing_network' value='1' /> <?php _e( 'Yes, keep the existing network of sites.' ); ?></label><br /> 91 91 </p> 92 93 92 <?php } else { ?> 94 93 <input type='hidden' name='existing_network' value='0' /> … … 106 105 <tr> 107 106 <th><label><input type='radio' name='vhost' value='yes'<?php checked( $rewrite_enabled ); ?> /> Sub-domains</label></th> 108 <td><?php _e('like <code> blog1.example.com</code> and <code>blog2.example.com</code>'); ?></td>107 <td><?php _e('like <code>site1.example.com</code> and <code>site2.example.com</code>'); ?></td> 109 108 </tr> 110 109 <tr> 111 110 <th><label><input type='radio' name='vhost' value='no'<?php checked( ! $rewrite_enabled ); ?> /> Sub-directories</label></th> 112 <td><?php _e('like <code>example.com/ blog1</code> and <code>example.com/blog2</code>'); ?></td>111 <td><?php _e('like <code>example.com/site1</code> and <code>example.com/site2</code>'); ?></td> 113 112 </tr> 114 113 </table> … … 169 168 ?> 170 169 <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3> 171 <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites. <strong>Note:</strong> We recommend you make a backup copy of your existing <code>wp-config.php</code> and <code>.htaccess</code> files.' ); ?></p> 170 <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p> 171 <div class="updated inline"><p><?php _e( '<strong>Caution:</strong> We recommend you backup your existing <code>wp-config.php</code> and <code>.htaccess</code> files.' ); ?></p></div> 172 172 <ol> 173 <li><?php printf( __( 'Create a <code>%s/blogs.dir</code> directory. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR ); ?></li> 174 <?php 175 $vhost = stripslashes( $_POST['vhost' ] ); 176 $prefix = $wpdb->base_prefix; 177 178 $config_sample = ABSPATH . 'wp-admin/includes/wp-config.ms'; 179 if ( ! file_exists( $config_sample ) ) 180 wp_die( sprintf( __( 'Sorry, I need a <code>%s</code> to work from. Please re-upload this file to your WordPress installation.' ), $config_sample ) ); 181 182 $wp_config_file = file( $config_sample ); 183 ?> 184 <li><p><?php printf( __( 'Replace the contents of <code>%swp-config.php</code> with the following:' ), ABSPATH ); ?></p> 185 <textarea name="wp-config" cols="120" rows="20"> 186 <?php 187 foreach ( $wp_config_file as $line ) { 188 switch ( trim( substr( $line, 0, 16 ) ) ) { 189 case "define('DB_NAME'": 190 $output = str_replace( "wordpress", DB_NAME, $line ); 191 break; 192 case "define('DB_USER'": 193 $output = str_replace( "username", DB_USER, $line ); 194 break; 195 case "define('DB_PASSW": 196 $output = str_replace( "password", DB_PASSWORD, $line ); 197 break; 198 case "define('DB_HOST'": 199 $output = str_replace( "localhost", DB_HOST, $line ); 200 break; 201 case "define('VHOST',": 202 $output = str_replace( "VHOSTSETTING", $vhost, $line ); 203 break; 204 case '$table_prefix =': 205 $output = str_replace( 'wp_', $prefix, $line ); 206 break; 207 case '$base = \'BASE\';': 208 $output = str_replace( 'BASE', $base, $line ); 209 break; 210 case "define('DOMAIN_C": 211 $domain = get_clean_basedomain(); 212 $output = str_replace( "current_site_domain", $domain, $line ); 213 break; 214 case "define('PATH_CUR": 215 $output = str_replace( "current_site_path", $base, $line ); 216 break; 217 case "define('AUTH_KEY": 218 case "define('AUTH_SAL": 219 case "define('LOGGED_I": 220 case "define('SECURE_A": 221 case "define('NONCE_KE": 222 $constant = substr( $line, 8, strpos( $line, "'", 9 ) - 8 ); 223 if ( defined( $constant ) ) 224 $hash = constant( $constant ); 225 else 226 $hash = md5( mt_rand() ) . md5( mt_rand() ); 227 $output = str_replace( 'put your unique phrase here', $hash, $line ); 228 break; 229 default: 230 $output = $line; 231 break; 232 } 233 echo $output; 234 } 235 ?> 236 </textarea> 237 </li> 173 <li><p><?php printf( __( 'Create a <code>blogs.dir</code> directory in <code>%s</code>. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR ); ?></p></li> 174 <li><p><?php printf( __( 'Add the following to your <code>wp-config.php</code> file in <code>%s</code>:' ), ABSPATH ); ?></p> 175 <textarea class="code" readonly="readonly" cols="100" rows="7"> 176 define( 'MULTISITE', true ); 177 define( 'VHOST', '<?php echo 'yes' == stripslashes( $_POST['vhost'] ) ? 'yes' : 'no'; ?>' ); 178 $base = '<?php echo $base; ?>'; 179 define( 'DOMAIN_CURRENT_SITE', '<?php echo get_clean_basedomain(); ?>' ); 180 define( 'PATH_CURRENT_SITE', '<?php echo $base; ?>' ); 181 define( 'SITE_ID_CURRENT_SITE', 1 ); 182 define( 'BLOG_ID_CURRENT_SITE', 1 );</textarea></li> 238 183 <?php 239 184 240 185 // remove ending slash from $base and $url 241 186 $htaccess = ''; 242 if ( substr( $base, -1 ) == '/' ) 243 $base = substr( $base, 0, -1 ); 244 245 $htaccess_sample = ABSPATH . 'wp-admin/includes/htaccess.ms'; 246 if ( ! file_exists( $htaccess_sample ) ) 247 wp_die( sprintf( __( 'Sorry, I need a %s to work from. Please re-upload this file to your WordPress installation.' ), $htaccess_sample ) ); 248 249 $htaccess_file = file( $htaccess_sample ); 250 $fp = @fopen( $htaccess_sample, "r" ); 251 if ( $fp ) { 252 while ( ! feof( $fp ) ) { 253 $htaccess .= fgets( $fp, 4096 ); 254 } 255 fclose( $fp ); 256 $htaccess_file = str_replace( "BASE", $base, $htaccess ); 257 } else { 258 wp_die( sprintf( __( 'Sorry, I need to be able to read %s. Please check the permissions on this file.' ), $htaccess_sample ) ); 259 } 260 ?> 261 <li><p><?php printf( __( 'Replace the contents of your <code>%s.htaccess</code> with the following:' ), ABSPATH ); ?></p> 262 <textarea name="htaccess" cols="120" rows="20"> 187 $base = rtrim( $base, '/' ); 188 189 $htaccess_file = 'RewriteEngine On 190 RewriteBase ' . $base . '/ 191 192 #uploaded files 193 RewriteRule ^(.*/)?files/$ index.php [L] 194 RewriteCond %{REQUEST_URI} !.*wp-content/plugins.* 195 RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L] 196 197 # add a trailing slash to /wp-admin 198 RewriteCond %{REQUEST_URI} ^.*/wp-admin$ 199 RewriteRule ^(.+)$ $1/ [R=301,L] 200 201 RewriteCond %{REQUEST_FILENAME} -f [OR] 202 RewriteCond %{REQUEST_FILENAME} -d 203 RewriteRule . - [L] 204 RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] 205 RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] 206 RewriteRule . index.php [L]'; 207 ?> 208 <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> 209 <textarea class="code" readonly="readonly" cols="100" rows="18"> 263 210 <?php echo wp_htmledit_pre( $htaccess_file ); ?> 264 </textarea> 265 </li> 211 </textarea></li> 266 212 </ol> 267 213 <?php … … 280 226 // create network tables 281 227 install_network(); 282 if ( !network_domain_check() || $_POST['existing_network'] == '0' )228 if ( !network_domain_check() || isset( $_POST['existing_network'] ) && $_POST['existing_network'] == '0' ) 283 229 populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $_POST['vhost'] ); 284 230 // create wp-config.php / htaccess
Note: See TracChangeset
for help on using the changeset viewer.