Ticket #9246: file.diff

File file.diff, 904 bytes (added by akd907, 4 years ago)

Patch for a modified version of get_home_path() in file.php

  • file.php

     
    6767 */ 
    6868function get_home_path() { 
    6969        $home = get_option( 'home' ); 
    70         if ( $home != '' && $home != get_option( 'siteurl' ) ) { 
    71                 $home_path = parse_url( $home ); 
    72                 $home_path = $home_path['path']; 
    73                 $root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] ); 
    74                 $home_path = trailingslashit( $root.$home_path ); 
     70        $siteurl = get_option( 'siteurl' ); 
     71        if ( $home != '' && $home != $siteurl ) { 
     72                $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */ 
     73                $pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home); 
     74                $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos);         
     75                $home_path = trailingslashit( $home_path ); 
    7576        } else { 
    7677                $home_path = ABSPATH; 
    7778        }