WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Fixed HTTPS related issues in ms-blogs.php (3 posts)

  1. Mark C
    Member
    Posted 3 years ago #

    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, if you require this functionality.

    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 );
    }
  2. tdjcbe
    Member
    Posted 3 years ago #

    You may want to open up a trac ticket about this. Putting this up on the forums does little good since the developers don;pt normally hang out here.

    I;d leave a link to the trac but am getting tired of having to 'modlook' every time I do so since they get caught by the antispam system.

  3. Mark C
    Member
    Posted 3 years ago #

    Right, I had intended to add it to trac, just wanted to put it in the forum for folks needing it before a new release...

    It's in trac: Ticket #14867

Topic Closed

This topic has been closed to new replies.

About this Topic