Ticket #22235: 22235.diff

File 22235.diff, 3.2 KB (added by scribu, 6 months ago)
Line 
1diff --git wp-admin/network/site-info.php wp-admin/network/site-info.php
2index bcc71f9..8071b25 100644
3--- wp-admin/network/site-info.php
4+++ wp-admin/network/site-info.php
5@@ -49,8 +49,15 @@ if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] ) {
6 
7        switch_to_blog( $id );
8 
9+       $url_parts = parse_url( 'http://' . $_POST['blog']['url'] );
10+       unset( $_POST['blog']['url'] );
11+
12+       $_POST['blog']['domain'] = $url_parts['host'];
13+       $_POST['blog']['path'] = $url_parts['path'];
14+
15        if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) {
16                $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'] );
17+
18                if ( get_option( 'siteurl' ) != $blog_address )
19                        update_option( 'siteurl', $blog_address );
20 
21@@ -74,6 +81,7 @@ if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] ) {
22        update_blog_details( $id, $blog_data );
23 
24        restore_current_blog();
25+
26        wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php') );
27        exit;
28 }
29@@ -122,28 +130,24 @@ if ( ! empty( $messages ) ) {
30        <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
31        <table class="form-table">
32                <tr class="form-field form-required">
33-                       <th scope="row"><?php _e( 'Domain' ) ?></th>
34+                       <th scope="row"><?php _e( 'URL' ) ?></th>
35+                       <td>
36                        <?php
37                        $protocol = is_ssl() ? 'https://' : 'http://';
38+
39                        if ( $is_main_site ) { ?>
40-                       <td><code><?php echo $protocol; echo esc_attr( $details->domain ) ?></code></td>
41-                       <?php } else { ?>
42-                       <td><?php echo $protocol; ?><input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" size="33" /></td>
43-                       <?php } ?>
44-               </tr>
45-               <tr class="form-field form-required">
46-                       <th scope="row"><?php _e( 'Path' ) ?></th>
47-                       <?php if ( $is_main_site ) { ?>
48-                       <td><code><?php echo esc_attr( $details->path ) ?></code></td>
49-                       <?php
50-                       } else {
51+                       <code><?php echo $protocol; echo esc_html( $site_url_no_http );  ?></code>
52+                       <?php } else {
53                                switch_to_blog( $id );
54                        ?>
55-                       <td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" size="40" style='margin-bottom:5px;' />
56-                       <br /><input type="checkbox" style="width:20px;" name="update_home_url" value="update" <?php if ( get_option( 'siteurl' ) == untrailingslashit( get_blogaddress_by_id ($id ) ) || get_option( 'home' ) == untrailingslashit( get_blogaddress_by_id( $id ) ) ) echo 'checked="checked"'; ?> /> <?php _e( 'Update <code>siteurl</code> and <code>home</code> as well.' ); ?></td>
57+
58+                       <?php echo $protocol; ?><input name="blog[url]" type="text" id="url" value="<?php echo esc_attr( $site_url_no_http ) ?>" />
59+
60+                       <br /><input type="checkbox" style="width:20px;" name="update_home_url" value="update" <?php checked( get_option( 'siteurl' ) == untrailingslashit( get_blogaddress_by_id ($id ) ) || get_option( 'home' ) == untrailingslashit( get_blogaddress_by_id( $id ) ) ) ?> /> <?php _e( 'Update <code>siteurl</code> and <code>home</code> as well.' ); ?></td>
61                        <?php
62                                restore_current_blog();
63                        } ?>
64+                       </td>
65                </tr>
66                <tr class="form-field">
67                        <th scope="row"><?php _ex( 'Registered', 'site' ) ?></th>