Ticket #19796: 19796-hack-day.13.diff
File 19796-hack-day.13.diff, 26.8 KB (added by , 12 years ago) |
---|
-
wp-includes/canonical.php
18 18 * one or the other. 19 19 * 20 20 * Prevents redirection for feeds, trackbacks, searches, comment popup, and 21 * admin URLs. Does not redirect on non-pretty-permalink-supporting IIS 7, 21 * admin URLs. Does not redirect on non-pretty-permalink-supporting IIS 7, 22 22 * page/post previews, WP admin, Trackbacks, robots.txt, searches, or on POST 23 23 * requests. 24 24 * … … 282 282 283 283 if ( 'wp-register.php' == basename( $redirect['path'] ) ) { 284 284 if ( is_multisite() ) 285 $redirect_url = apply_filters( 'wp_signup_location', site_url( 'wp-signup.php' ) );285 $redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ); 286 286 else 287 287 $redirect_url = site_url( 'wp-login.php?action=register' ); 288 288 wp_redirect( $redirect_url, 301 ); … … 517 517 site_url( 'dashboard', 'relative' ), 518 518 site_url( 'admin', 'relative' ), 519 519 ); 520 if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) {520 if ( parse_url( admin_url( '', 'relative' ), PHP_URL_PATH ) !== $_SERVER['REQUEST_URI'] && in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) { 521 521 wp_redirect( admin_url() ); 522 522 exit; 523 523 } -
wp-includes/functions.php
1434 1434 function wp_upload_dir( $time = null ) { 1435 1435 global $_wp_switched; 1436 1436 $siteurl = get_option( 'siteurl' ); 1437 $homeurl = get_option( 'home' ); 1438 $baseurl = is_multisite() && defined( 'MULTISITE' ) ? $homeurl : $siteurl; 1437 1439 $upload_path = get_option( 'upload_path' ); 1438 1440 $upload_path = trim($upload_path); 1439 1441 $main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site(); … … 1453 1455 if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) ) 1454 1456 $url = WP_CONTENT_URL . '/uploads'; 1455 1457 else 1456 $url = trailingslashit( $ siteurl ) . $upload_path;1458 $url = trailingslashit( $baseurl ) . $upload_path; 1457 1459 } 1458 1460 1459 1461 if ( defined('UPLOADS') && ! $main_override && ! $_wp_switched ) { 1460 1462 $dir = ABSPATH . UPLOADS; 1461 $url = trailingslashit( $ siteurl ) . UPLOADS;1463 $url = trailingslashit( $baseurl ) . UPLOADS; 1462 1464 } 1463 1465 1464 1466 if ( is_multisite() && ! $main_override && ! $_wp_switched ) { -
wp-includes/rewrite.php
1726 1726 <rewrite> 1727 1727 <rules>'; 1728 1728 } 1729 if ( !is_multisite() ) { 1730 $rules .= ' 1731 <rule name="wordpress" patternSyntax="Wildcard"> 1732 <match url="*" /> 1733 <conditions> 1734 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 1735 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 1736 </conditions> 1737 <action type="Rewrite" url="index.php" /> 1738 </rule>'; 1739 } else { 1740 if (is_subdomain_install()) { 1741 $rules .= ' 1742 <rule name="wordpress - Rule 1" stopProcessing="true"> 1743 <match url="^index\.php$" ignoreCase="false" /> 1744 <action type="None" /> 1745 </rule> 1746 <rule name="wordpress - Rule 2" stopProcessing="true"> 1747 <match url="^files/(.+)" ignoreCase="false" /> 1748 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> 1749 </rule> 1750 <rule name="wordpress - Rule 3" stopProcessing="true"> 1751 <match url="^" ignoreCase="false" /> 1752 <conditions logicalGrouping="MatchAny"> 1753 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> 1754 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> 1729 1730 $rules .= ' 1731 <rule name="wordpress" patternSyntax="Wildcard"> 1732 <match url="*" /> 1733 <conditions> 1734 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 1735 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 1755 1736 </conditions> 1756 <action type="None" /> 1757 </rule> 1758 <rule name="wordpress - Rule 4" stopProcessing="true"> 1759 <match url="." ignoreCase="false" /> 1760 <action type="Rewrite" url="index.php" /> 1761 </rule>'; 1762 } else { 1763 $rules .= ' 1764 <rule name="wordpress - Rule 1" stopProcessing="true"> 1765 <match url="^index\.php$" ignoreCase="false" /> 1766 <action type="None" /> 1767 </rule> 1768 <rule name="wordpress - Rule 2" stopProcessing="true"> 1769 <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" /> 1770 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" /> 1771 </rule> 1772 <rule name="wordpress - Rule 3" stopProcessing="true"> 1773 <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> 1774 <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> 1775 </rule> 1776 <rule name="wordpress - Rule 4" stopProcessing="true"> 1777 <match url="^" ignoreCase="false" /> 1778 <conditions logicalGrouping="MatchAny"> 1779 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> 1780 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> 1781 </conditions> 1782 <action type="None" /> 1783 </rule> 1784 <rule name="wordpress - Rule 5" stopProcessing="true"> 1785 <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" /> 1786 <action type="Rewrite" url="{R:1}" /> 1787 </rule> 1788 <rule name="wordpress - Rule 6" stopProcessing="true"> 1789 <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> 1790 <action type="Rewrite" url="{R:2}" /> 1791 </rule> 1792 <rule name="wordpress - Rule 7" stopProcessing="true"> 1793 <match url="." ignoreCase="false" /> 1794 <action type="Rewrite" url="index.php" /> 1795 </rule>'; 1796 } 1797 } 1737 <action type="Rewrite" url="index.php" /> 1738 </rule>'; 1739 1798 1740 if ( $add_parent_tags ) { 1799 1741 $rules .= ' 1800 1742 </rules> -
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 145 146 if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) 146 147 $current_site->blog_id = BLOG_ID_CURRENT_SITE; 147 148 elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) // deprecated. -
wp-includes/ms-settings.php
86 86 if ( '%siteurl%' == $destination ) 87 87 $destination = "http://" . $current_site->domain . $current_site->path; 88 88 } else { 89 $destination = 'http://' . $current_site->domain . $current_site-> path. 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );89 $destination = 'http://' . $current_site->domain . $current_site->wp_siteurl_subdir . 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain ); 90 90 } 91 91 header( 'Location: ' . $destination ); 92 92 die(); -
wp-includes/formatting.php
1355 1355 } 1356 1356 1357 1357 /** 1358 * Removes trailing and leading strings from elements (array), then combines elements 1359 * with a string in between each element. Leading and trailing strings should be 1360 * manually concatenated. 1361 * 1362 * @since 3.5.0 1363 * 1364 * @param array $parts Items to be combined 1365 * @param string $string String to be used to combine items 1366 * @return string Concatenated parts with given strings in between each element. 1367 */ 1368 function join_with_string( $parts, $string ) { 1369 $members = array(); 1370 foreach ( (array) $parts as $part ) { 1371 if ( is_array( $part ) ) { 1372 foreach ( $part as $member ) { 1373 $members[] = trim( $member, $string ); 1374 } 1375 } else { 1376 $members[] = trim( $part, $string ); 1377 } 1378 } 1379 1380 return implode( $string, $members ); 1381 } 1382 1383 /** 1384 * Removes trailing and leading slashes from elements (array or string args), then combines elements 1385 * with a slash in between each element. Leading and trailing slashes should be 1386 * manually concatenated. 1387 * 1388 * @since 3.5.0 1389 * 1390 * @return string Concatenated string with slashes in between each element. 1391 */ 1392 function join_with_slashes() { 1393 $args = func_get_args(); 1394 return join_with_string( $args, '/' ); 1395 } 1396 1397 /** 1358 1398 * Adds slashes to escape strings. 1359 1399 * 1360 1400 * Slashes will first be removed if magic_quotes_gpc is set, see {@link -
wp-includes/ms-functions.php
595 595 $mydomain = $blogname . '.' . preg_replace( '|^www\.|', '', $domain ); 596 596 $path = $base; 597 597 } else { 598 $mydomain = "$domain";599 $path = $base.$blogname.'/';598 $mydomain = $domain; 599 $path = '/' . join_with_slashes( $base, $blogname ) . '/'; 600 600 } 601 601 if ( domain_exists($mydomain, $path) ) 602 602 $errors->add('blogname', __('Sorry, that site already exists!')); … … 1142 1142 1143 1143 $wpdb->suppress_errors(false); 1144 1144 1145 $ url = get_blogaddress_by_id($blog_id);1145 $homeurl = $siteurl = untrailingslashit( get_blogaddress_by_id( $blog_id ) ); 1146 1146 1147 1147 // Set everything up 1148 1148 make_db_current_silent( 'blog' ); … … 1150 1150 populate_roles(); 1151 1151 $wp_roles->_init(); 1152 1152 1153 $url = untrailingslashit( $url ); 1154 // fix url. 1155 update_option('siteurl', $url); 1156 update_option('home', $url); 1157 update_option('fileupload_url', $url . "/files" ); 1158 update_option('upload_path', UPLOADBLOGSDIR . "/$blog_id/files"); 1153 // Maybe fix url 1154 if ( defined( 'WP_SITEURL_SUBDIR' ) && WP_SITEURL_SUBDIR ) 1155 $siteurl = join_with_slashes( $siteurl, WP_SITEURL_SUBDIR, '/' ); 1156 1157 update_option('siteurl', $siteurl); 1158 update_option('home', $homeurl); 1159 update_option('fileupload_url', join_with_slashes( $homeurl, 'files', '/' ) ); 1160 update_option('upload_path', join_with_slashes( UPLOADBLOGSDIR, $blog_id, 'files', '/' ) ); 1159 1161 update_option('blogname', stripslashes( $blog_title ) ); 1160 1162 update_option('admin_email', ''); 1161 1163 $wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') ); 1162 1164 1163 1165 // remove all perms 1164 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix.'user_level' ) ); 1166 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix . 'user_level' ) ); 1167 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix . 'capabilities' ) ); 1165 1168 1166 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix.'capabilities' ) );1167 1168 1169 $wpdb->suppress_errors( false ); 1169 1170 } 1170 1171 -
wp-includes/link-template.php
1964 1964 $scheme = ( is_ssl() ? 'https' : 'http' ); 1965 1965 } 1966 1966 1967 if ( empty( $blog_id ) || !is_multisite() ) { 1968 $url = get_option( 'siteurl' ); 1967 if ( empty( $blog_id ) ) { 1968 if ( is_multisite() ) 1969 $url = get_option( 'home' ); 1970 else 1971 $url = get_option( 'siteurl' ); 1969 1972 } else { 1970 1973 switch_to_blog( $blog_id ); 1971 $url = get_option( ' siteurl' );1974 $url = get_option( 'home' ); 1972 1975 restore_current_blog(); 1973 1976 } 1974 1977 -
wp-admin/network/site-new.php
62 62 63 63 if ( is_subdomain_install() ) { 64 64 $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); 65 $path = $base;65 $path = $current_site->path; 66 66 } else { 67 67 $newdomain = $current_site->domain; 68 $path = $base. $domain . '/';68 $path = $current_site->path . $domain . '/'; 69 69 } 70 70 71 71 $password = 'N/A'; -
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>'; … … 314 307 * @since 3.0.0 315 308 */ 316 309 function network_step2( $errors = false ) { 317 global $base, $wpdb; 318 $hostname = get_clean_basedomain(); 310 global $wpdb; 319 311 320 if ( ! isset( $base ) ) 321 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) ); 312 $hostname = get_clean_basedomain(); 313 $slashed_home = trailingslashit( get_option( 'home' ) ); 314 $slashed_siteurl = trailingslashit( get_option( 'siteurl' ) ); 315 $wp_siteurl_subdir = '/' . str_replace( $slashed_home, '', $slashed_siteurl ); 316 $rewrite_base = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : ''; 317 $base = parse_url( $slashed_home, PHP_URL_PATH ); 322 318 323 319 // Wildcard DNS message. 324 320 if ( is_wp_error( $errors ) ) 325 321 echo '<div class="error">' . $errors->get_error_message() . '</div>'; 326 322 327 if ( $_POST) {328 if ( allow_subdomain_install() ) 323 if ( ! empty( $_POST ) ) { 324 if ( allow_subdomain_install() ) { 329 325 $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; 330 else326 } else { 331 327 $subdomain_install = false; 328 } 332 329 } else { 333 330 if ( is_multisite() ) { 334 331 $subdomain_install = is_subdomain_install(); … … 337 334 <?php 338 335 } else { 339 336 $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); 337 338 $subdir_match = $subdomain_install ? '' : '(?:[_0-9a-zA-Z-]+/)?'; 339 $subdir_replacement = $subdomain_install ? '' : '$1'; 340 340 341 ?> 341 342 <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div> 342 343 <p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p> … … 344 345 } 345 346 } 346 347 347 if ( $_POST|| ! is_multisite() ) {348 if ( ! empty( $_POST ) || ! is_multisite() ) { 348 349 ?> 349 350 <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3> 350 351 <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p> … … 369 370 <textarea class="code" readonly="readonly" cols="100" rows="7"> 370 371 define('MULTISITE', true); 371 372 define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>); 372 $base = '<?php echo $base; ?>';373 373 define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>'); 374 374 define('PATH_CURRENT_SITE', '<?php echo $base; ?>'); 375 375 define('SITE_ID_CURRENT_SITE', 1); 376 define('BLOG_ID_CURRENT_SITE', 1);</textarea> 376 define('BLOG_ID_CURRENT_SITE', 1); 377 <?php if ( $wp_siteurl_subdir ): ?> 378 define('WP_SITEURL_SUBDIR', '<?php echo $wp_siteurl_subdir; ?>'); 379 <?php endif; // $wp_siteurl_subdir ?> 380 </textarea> 377 381 <?php 378 382 $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' ); 379 383 foreach ( $keys_salts as $c => $v ) { 380 if ( defined( $c ) ) 384 if ( defined( $c ) ) { 381 385 unset( $keys_salts[ $c ] ); 386 } 382 387 } 388 383 389 if ( ! empty( $keys_salts ) ) { 384 390 $keys_salts_str = ''; 385 $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );391 $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); 386 392 if ( is_wp_error( $from_api ) ) { 387 393 foreach ( $keys_salts as $c => $v ) { 388 394 $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; … … 404 410 </li> 405 411 <?php 406 412 if ( iis7_supports_permalinks() ) : 413 // IIS doesn't support RewriteBase, all your RewriteBase are belong to us 414 $iis_subdir_match = ltrim( $base, '/' ) . $subdir_match; 415 $iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base; 416 $iis_subdir_replacement = $subdomain_install ? '' : '{R:1}'; 407 417 408 if ( $subdomain_install ) { 409 $web_config_file = 410 '<?xml version="1.0" encoding="UTF-8"?> 418 $web_config_file = <<<EOF 419 <?xml version="1.0" encoding="UTF-8"?> 411 420 <configuration> 412 421 <system.webServer> 413 422 <rewrite> … … 417 426 <action type="None" /> 418 427 </rule> 419 428 <rule name="WordPress Rule 2" stopProcessing="true"> 420 <match url="^ files/(.+)" ignoreCase="false" />421 <action type="Rewrite" url=" wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />429 <match url="^{$iis_subdir_match}files/(.+)" ignoreCase="false" /> 430 <action type="Rewrite" url="{$iis_rewrite_base}wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> 422 431 </rule> 423 432 <rule name="WordPress Rule 3" stopProcessing="true"> 424 <match url="^" ignoreCase="false" /> 425 <conditions logicalGrouping="MatchAny"> 426 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> 427 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> 428 </conditions> 429 <action type="None" /> 433 <match url="^{$iis_subdir_match}wp-admin$" ignoreCase="false" /> 434 <action type="Redirect" url="{$iis_subdir_replacement}wp-admin/" redirectType="Permanent" /> 430 435 </rule> 431 436 <rule name="WordPress Rule 4" stopProcessing="true"> 432 <match url="." ignoreCase="false" />433 <action type="Rewrite" url="index.php" />434 </rule>435 </rules>436 </rewrite>437 </system.webServer>438 </configuration>';439 } else {440 $web_config_file =441 '<?xml version="1.0" encoding="UTF-8"?>442 <configuration>443 <system.webServer>444 <rewrite>445 <rules>446 <rule name="WordPress Rule 1" stopProcessing="true">447 <match url="^index\.php$" ignoreCase="false" />448 <action type="None" />449 </rule>450 <rule name="WordPress Rule 2" stopProcessing="true">451 <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />452 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />453 </rule>454 <rule name="WordPress Rule 3" stopProcessing="true">455 <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />456 <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />457 </rule>458 <rule name="WordPress Rule 4" stopProcessing="true">459 437 <match url="^" ignoreCase="false" /> 460 438 <conditions logicalGrouping="MatchAny"> 461 439 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> … … 464 442 <action type="None" /> 465 443 </rule> 466 444 <rule name="WordPress Rule 5" stopProcessing="true"> 467 <match url="^ [_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" />468 <action type="Rewrite" url="{ R:1}" />445 <match url="^{$iis_subdir_match}(wp-(content|admin|includes).*)" ignoreCase="false" /> 446 <action type="Rewrite" url="{$iis_rewrite_base}{R:1}" /> 469 447 </rule> 470 448 <rule name="WordPress Rule 6" stopProcessing="true"> 471 <match url="^ ([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />472 <action type="Rewrite" url="{ R:2}" />449 <match url="^{$iis_subdir_match}([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> 450 <action type="Rewrite" url="{$iis_rewrite_base}{R:2}" /> 473 451 </rule> 474 452 <rule name="WordPress Rule 7" stopProcessing="true"> 475 453 <match url="." ignoreCase="false" /> … … 478 456 </rules> 479 457 </rewrite> 480 458 </system.webServer> 481 </configuration>'; 482 } 459 </configuration> 460 EOF; 461 483 462 ?> 484 <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>463 <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), $wp_siteurl_subdir ? dirname( ABSPATH ) : ABSPATH ); ?></p> 485 464 <textarea class="code" readonly="readonly" cols="100" rows="20"> 486 465 <?php echo esc_textarea( $web_config_file ); ?> 487 466 </textarea></li> 488 467 </ol> 489 468 490 469 <?php else : // end iis7_supports_permalinks(). construct an htaccess file instead: 491 492 $htaccess_file = 'RewriteEngine On493 RewriteBase ' . $base . '470 $htaccess_file = <<<EOF 471 RewriteEngine On 472 RewriteBase {$base} 494 473 RewriteRule ^index\.php$ - [L] 495 474 496 475 # uploaded files 497 RewriteRule ^ ' . ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n";476 RewriteRule ^{$subdir_match}files/(.+) {$rewrite_base}wp-includes/ms-files.php?file=$1 [L] 498 477 499 if ( ! $subdomain_install ) 500 $htaccess_file .= "\n# add a trailing slash to /wp-admin\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . "\n"; 478 # add a trailing slash to /wp-admin 479 RewriteRule ^{$subdir_match}wp-admin$ {$subdir_replacement}wp-admin/ [R=301,L] 501 480 502 $htaccess_file .= "\n" . 'RewriteCond %{REQUEST_FILENAME} -f [OR]481 RewriteCond %{REQUEST_FILENAME} -f [OR] 503 482 RewriteCond %{REQUEST_FILENAME} -d 504 RewriteRule ^ - [L]'; 483 RewriteRule ^ - [L] 484 RewriteRule ^{$subdir_match}(wp-(content|admin|includes).*) {$rewrite_base}$1 [L] 485 RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$1 [L] 486 RewriteRule . index.php [L] 487 EOF; 505 488 506 // @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]";509 510 $htaccess_file .= "\nRewriteRule . index.php [L]";511 512 489 ?> 513 <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>514 <textarea class="code" readonly="readonly" cols="100" rows=" <?php echo $subdomain_install ? 11 : 16; ?>">490 <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), $wp_siteurl_subdir ? dirname( ABSPATH ) : ABSPATH ); ?></p> 491 <textarea class="code" readonly="readonly" cols="100" rows="16"> 515 492 <?php echo esc_textarea( $htaccess_file ); ?></textarea></li> 516 493 </ol> 517 494 … … 523 500 } 524 501 } 525 502 526 if ( $_POST) {503 if ( ! empty( $_POST ) ) { 527 504 528 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );529 530 505 check_admin_referer( 'install-network-1' ); 531 506 532 507 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 508 533 509 // create network tables 534 510 install_network(); 535 $hostname = get_clean_basedomain(); 511 512 $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH ); 536 513 $subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false; 514 537 515 if ( ! network_domain_check() ) { 538 516 $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), stripslashes( $_POST['sitename'] ), $base, $subdomain_install ); 539 517 if ( is_wp_error( $result ) ) { 540 if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) 518 if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) { 541 519 network_step2( $result ); 542 else520 } else { 543 521 network_step1( $result ); 522 } 544 523 } else { 545 524 network_step2(); 546 525 } -
wp-admin/includes/ms.php
673 673 <?php if ( in_array( get_site_option( 'registration' ), array( 'all', 'blog' ) ) ) : ?> 674 674 <tr> 675 675 <th scope="row" colspan="2" class="th-full"> 676 <a href="<?php echo apply_filters( 'wp_signup_location', network_ home_url( 'wp-signup.php' ) ); ?>"><?php _e( 'Create a New Site' ); ?></a>676 <a href="<?php echo apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ); ?>"><?php _e( 'Create a New Site' ); ?></a> 677 677 </th> 678 678 </tr> 679 679 <?php endif; ?> -
wp-signup.php
394 394 $proto = 'https://'; 395 395 else 396 396 $proto = 'http://'; 397 $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode( $proto . $_SERVER['HTTP_HOST'] . '/wp-signup.php' ));397 $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode( network_site_url( 'wp-signup.php' ) ) ); 398 398 echo sprintf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url ); 399 399 } else { 400 400 $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; -
wp-login.php
509 509 case 'register' : 510 510 if ( is_multisite() ) { 511 511 // Multisite uses wp-signup.php 512 wp_redirect( apply_filters( 'wp_signup_location', site_url('wp-signup.php') ) );512 wp_redirect( apply_filters( 'wp_signup_location', network_site_url('wp-signup.php') ) ); 513 513 exit; 514 514 } 515 515