Opened 3 years ago
Last modified 20 months ago
#14867 reopened defect (bug)
HTTPS related issues in ms-blogs.php (with fix)
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Multisite | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | adambackstrom |
Description
Two functions in ms-blogs.php have issues due to hard-coding "http://" versus using the is_ssl() check. I have corrected them below. Just copy and paste these over the ones in your ms-blogs.php.
function get_blogaddress_by_id( $blog_id ) {
$bloginfo = get_blog_details( (int) $blog_id, false ); only get bare details!
return esc_url( $protocol . $bloginfo->domain . $bloginfo->path );
}
function get_blogaddress_by_domain( $domain, $path ){
if ( is_subdomain_install() ) {
$url = $protocol.$domain.$path;
} else {
if ( $domain != $_SERVERHTTP_HOST? ) {
$blogname = substr( $domain, 0, strpos( $domain, '.' ) );
$url = $protocol . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
we're not installing the main blog
if ( $blogname != 'www.' )
$url .= $blogname . '/';
} else { main blog
$url = $protocol . $domain . $path;
}
}
return esc_url( $url );
}
Attachments (2)
Change History (16)
comment:2
scribu
— 3 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 3.1
comment:4
follow-up:
↓ 5
ryan
— 3 years ago
I think we would have to add a protocol argument to these functions.
adambackstrom
— 3 years ago
comment:6
adambackstrom
— 3 years ago
Added patch for $ssl argument to both functions. Modified wp-admin/network/site-info.php to have a UI for this flag.
install_blog(), wpmu_welcome_notification(), and wpmu_activate_stylesheet() were left alone, and will autodetect SSL.
comment:7
adambackstrom
— 3 years ago
- Cc adambackstrom added
- Keywords has-patch added; needs-patch removed
comment:8
nacin
— 3 years ago
This looks good. Notes:
- No need for the UI option. The changes in site-info.php can be entirely dropped I think.
- Argument should be $scheme and should take 'https' and 'http' as valid values, default null at which point we use is_ssl. This allows us to add other protocols and it is also in line with functions in wp-includes/link-template.php.
- General whitespace. Looks good mostly, but !isset($ssl) should be ! isset( $ssl ).
Going to run with this. Thanks for the initial patch.
comment:10
ryan
— 3 years ago
comment:11
ryan
— 3 years ago
- Milestone changed from 3.1 to Future Release
- Resolution fixed deleted
- Status changed from closed to reopened
comment:12
exell.christopher
— 2 years ago
Any news on this? This is turning out to be quite the maintenance headache for my particular install as we are running everything under ssl and have to go change the siteurl and home settings every time we setup a new blog.
comment:13
scribu
— 2 years ago
You can automate that by hooking into the 'wpmu_new_blog' action.
comment:14
SergeyBiryukov
— 20 months ago
Closed #18931 as a duplicate.
Can you submit a patch?
http://core.trac.wordpress.org/#HowtoSubmitPatches