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

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 14 15:09:14 UTC 2010


#14867: HTTPS related issues in ms-blogs.php (with fix)
--------------------------+-------------------------------------------------
 Reporter:  mareck        |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Multisite     |     Version:                 
 Severity:  normal        |    Keywords:                 
--------------------------+-------------------------------------------------
 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>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list