Ticket #14867: 14867-protocol-args.diff
File 14867-protocol-args.diff, 3.3 KB (added by , 14 years ago) |
---|
-
wp-includes/ms-blogs.php
30 30 * @since MU 31 31 * 32 32 * @param int $blog_id Blog ID 33 * @param bool $ssl true for https, false for http. null (default) for autodetect. 33 34 * @return string 34 35 */ 35 function get_blogaddress_by_id( $blog_id ) { 36 function get_blogaddress_by_id( $blog_id, $ssl = null ) { 37 if ( !isset($ssl) ) { 38 $ssl = is_ssl(); 39 } 40 $protocol = $ssl ? ' https://' : ' http://'; 41 36 42 $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details! 37 return esc_url( 'http://'. $bloginfo->domain . $bloginfo->path );43 return esc_url( $protocol . $bloginfo->domain . $bloginfo->path ); 38 44 } 39 45 40 46 /** … … 67 73 * 68 74 * @param string $domain 69 75 * @param string $path 76 * @param bool $ssl true for https, false for http. null (default) for autodetect. 70 77 * @return string 71 78 */ 72 function get_blogaddress_by_domain( $domain, $path ) { 79 function get_blogaddress_by_domain( $domain, $path, $ssl = null ) { 80 if ( !isset($ssl) ) { 81 $ssl = is_ssl(); 82 } 83 84 $protocol = $ssl ? ' https://' : ' http://'; 85 73 86 if ( is_subdomain_install() ) { 74 $url = "http://".$domain.$path;87 $url = $protocol.$domain.$path; 75 88 } else { 76 89 if ( $domain != $_SERVER['HTTP_HOST'] ) { 77 90 $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); 78 $url = 'http://'. substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;91 $url = $protocol . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path; 79 92 // we're not installing the main blog 80 93 if ( $blogname != 'www.' ) 81 94 $url .= $blogname . '/'; 82 95 } else { // main blog 83 $url = 'http://'. $domain . $path;96 $url = $protocol . $domain . $path; 84 97 } 85 98 } 86 99 return esc_url( $url ); -
wp-admin/network/site-info.php
33 33 switch_to_blog( $id ); 34 34 35 35 if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) { 36 $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'] ); 36 $ssl = 'https' === $_POST['blog']['protocol']; 37 $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'], $ssl ); 37 38 if ( get_option( 'siteurl' ) != $blog_address ) 38 39 update_option( 'siteurl', $blog_address ); 39 40 … … 104 105 if ( $is_main_site ) { ?> 105 106 <td><code><?php echo $protocol; echo esc_attr( $details->domain ) ?></code></td> 106 107 <?php } else { ?> 107 <td>< ?php echo $protocol; ?><input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" size="33" /></td>108 <td><input name="blog[protocol]" type="radio" id="protocol" value="http" style="width: 20px;" <?php if ( 'http://' === $protocol ) echo 'checked="checked"'; ?>>http:// <input name="blog[protocol]" type="radio" id="protocol" value="https" style="width: 20px; margin-left: 20px;" <?php if ( 'https://' === $protocol ) echo 'checked="checked"'; ?>>https:// <input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" size="33" /></td> 108 109 <?php } ?> 109 110 </tr> 110 111 <tr class="form-field form-required">