Make WordPress Core

Ticket #25317: 25317.patch

File 25317.patch, 2.1 KB (added by SergeyBiryukov, 12 years ago)
  • src/wp-includes/functions.php

     
    32333233        if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
    32343234                $url = WP_SITEURL;
    32353235        } else {
     3236                $abspath_fix = str_replace( '\\', '/', ABSPATH );
     3237                $script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] );
     3238
    32363239                // The request is for the admin
    32373240                if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false ) {
    32383241                        $path = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI'] );
    32393242
    32403243                // The request is for a file in ABSPATH
    3241                 } elseif ( dirname( $_SERVER['SCRIPT_FILENAME'] ) . '/' == ABSPATH ) {
     3244                } elseif ( $script_filename_dir . '/' == $abspath_fix ) {
    32423245                        // Strip off any file/query params in the path
    32433246                        $path = preg_replace( '#/[^/]*$#i', '', $_SERVER['PHP_SELF'] );
    32443247
    32453248                } else {
    3246                         if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], ABSPATH ) ) {
     3249                        if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) {
    32473250                                // Request is hitting a file inside ABSPATH
    3248                                 $directory = str_replace( ABSPATH, '', dirname( $_SERVER['SCRIPT_FILENAME'] ) );
     3251                                $directory = str_replace( ABSPATH, '', $script_filename_dir );
    32493252                                // Strip off the sub directory, and any file/query paramss
    32503253                                $path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] );
    3251                         } else {
     3254                        } elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) {
    32523255                                // Request is hitting a file above ABSPATH
    3253                                 $subdirectory = str_replace( dirname( $_SERVER['SCRIPT_FILENAME'] ), '', ABSPATH );
     3256                                $subdirectory = str_replace( $script_filename_dir, '', $abspath_fix );
    32543257                                // Strip off any file/query params from the path, appending the sub directory to the install
    32553258                                $path = preg_replace( '#/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] ) . $subdirectory;
     3259                        } else {
     3260                                $path = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI'] );
    32563261                        }
    32573262                }
    32583263