[wp-trac] [WordPress Trac] #14867: HTTPS related issues in ms-blogs.php (with fix)

WordPress Trac noreply at wordpress.org
Tue Aug 27 19:55:26 UTC 2013


#14867: HTTPS related issues in ms-blogs.php (with fix)
--------------------------+-----------------------------
 Reporter:  mareck        |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  Future Release
Component:  Multisite     |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+-----------------------------
Description changed by johnbillion:

Old 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 ) {
>         $protocol = is_ssl() ? 'https://' : 'http://';
>
>         $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 ){
>
>         $protocol = is_ssl() ? 'https://' : 'http://';
>
>         if ( is_subdomain_install() ) {
>                 $url = $protocol.$domain.$path;
>         } else {
>                 if ( $domain != $_SERVER['HTTP_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 );
> }

New 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 ) {
         $protocol = is_ssl() ? 'https://' : 'http://';

         $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 ){

         $protocol = is_ssl() ? 'https://' : 'http://';

         if ( is_subdomain_install() ) {
                 $url = $protocol.$domain.$path;
         } else {
                 if ( $domain != $_SERVER['HTTP_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 );
 }
 }}}

--

--
Ticket URL: <http://core.trac.wordpress.org/ticket/14867#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list