Ticket #19796: 19796-hack-day.diff
File 19796-hack-day.diff, 6.5 KB (added by , 12 years ago) |
---|
-
wp-includes/link-template.php
2129 2129 if ( 'relative' == $scheme ) 2130 2130 $url = $current_site->path; 2131 2131 else 2132 $url = $scheme . '://' . $current_site->domain . $current_site->path;2132 $url = $scheme . '://' . trailingslashit( $current_site->domain ) . trailingslashit( $current_site->wp_siteurl_subdir ); 2133 2133 2134 2134 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 2135 2135 $url .= ltrim($path, '/'); -
wp-includes/ms-load.php
142 142 $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1; 143 143 $current_site->domain = DOMAIN_CURRENT_SITE; 144 144 $current_site->path = $path = PATH_CURRENT_SITE; 145 if( defined( 'WP_SITEURL_SUBDIR' ) ) 146 $current_site->wp_siteurl_subdir = WP_SITEURL_SUBDIR; 147 else 148 $current_site->wp_siteurl_subdir = $current_site->path; 145 149 if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) 146 150 $current_site->blog_id = BLOG_ID_CURRENT_SITE; 147 151 elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) // deprecated. -
wp-includes/ms-functions.php
1150 1150 populate_roles(); 1151 1151 $wp_roles->_init(); 1152 1152 1153 $url = untrailingslashit( $url );1153 $url = $siteurl = untrailingslashit( $url ); 1154 1154 // fix url. 1155 update_option('siteurl', $url); 1155 if ( defined( 'WP_SITEURL_SUBDIR' ) && WP_SITEURL_SUBDIR ) { 1156 $siteurl = trailingslashit( $siteurl ) . WP_SITEURL_SUBDIR; 1157 } 1158 1159 update_option('siteurl', $siteurl); 1156 1160 update_option('home', $url); 1157 1161 update_option('fileupload_url', $url . "/files" ); 1158 1162 update_option('upload_path', UPLOADBLOGSDIR . "/$blog_id/files"); -
wp-includes/ms-default-constants.php
47 47 * @since 1.5.0 48 48 */ 49 49 if ( !defined( 'SITECOOKIEPATH' ) ) 50 define( 'SITECOOKIEPATH', $current_site-> path);50 define( 'SITECOOKIEPATH', $current_site->wp_siteurl_subdir ); 51 51 52 52 /** 53 53 * @since 2.6.0 -
wp-admin/network.php
51 51 * @return bool Whether subdomain install is allowed 52 52 */ 53 53 function allow_subdomain_install() { 54 $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( ' siteurl' ) );55 if( false !== strpos( $domain, '/' ) || 'localhost' == $domain || preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $domain ) )54 $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) ); 55 if( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) 56 56 return false; 57 57 58 58 return true; … … 144 144 function network_step1( $errors = false ) { 145 145 global $is_apache; 146 146 147 if ( get_option( 'siteurl' ) != get_option( 'home' ) ) {148 echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . sprintf( __( 'Your <strong>WordPress address</strong> must match your <strong>Site address</strong> before creating a Network. See <a href="%s">General Settings</a>.' ), esc_url( admin_url( 'options-general.php' ) ) ) . '</p></div>';149 echo '</div>';150 include ( ABSPATH . 'wp-admin/admin-footer.php' );151 die();152 }153 154 147 if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) { 155 148 echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '</p></div>'; 156 149 echo '</div>'; … … 316 309 function network_step2( $errors = false ) { 317 310 global $base, $wpdb; 318 311 $hostname = get_clean_basedomain(); 312 $wp_siteurl_subdir = str_replace( trailingslashit( home_url() ), '', site_url() ); 319 313 320 314 if ( ! isset( $base ) ) 321 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ));315 $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH ); 322 316 323 317 // Wildcard DNS message. 324 318 if ( is_wp_error( $errors ) ) … … 366 360 echo ' <strong>' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</strong>'; 367 361 ?></p></li> 368 362 <li><p><?php printf( __( 'Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That’s all, stop editing! Happy blogging. */</code>:' ), ABSPATH ); ?></p> 369 <textarea class="code" readonly="readonly" cols="100" rows=" 7">363 <textarea class="code" readonly="readonly" cols="100" rows="8"> 370 364 define('MULTISITE', true); 371 365 define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>); 372 366 $base = '<?php echo $base; ?>'; 373 367 define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>'); 374 368 define('PATH_CURRENT_SITE', '<?php echo $base; ?>'); 375 369 define('SITE_ID_CURRENT_SITE', 1); 376 define('BLOG_ID_CURRENT_SITE', 1);</textarea> 370 define('BLOG_ID_CURRENT_SITE', 1); 371 define('WP_SITEURL_SUBDIR', '<?php echo $wp_siteurl_subdir; ?>');</textarea> 377 372 <?php 378 373 $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' ); 379 374 foreach ( $keys_salts as $c => $v ) { … … 504 499 RewriteRule ^ - [L]'; 505 500 506 501 // @todo custom content dir. 507 if ( ! $subdomain_install ) 508 $htaccess_file .= "\nRewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]\nRewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]"; 502 if ( ! $subdomain_install ) { 503 $base = empty( $wp_siteurl_subdir ) ? '' : trailingslashit( $wp_siteurl_subdir ); 504 $htaccess_file .= "\nRewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $base$1 [L]\nRewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $base$1 [L]"; 505 } 509 506 510 507 $htaccess_file .= "\nRewriteRule . index.php [L]"; 511 508 … … 525 522 526 523 if ( $_POST ) { 527 524 528 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ));525 $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH ); 529 526 530 527 check_admin_referer( 'install-network-1' ); 531 528