]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/ms-files.php
WordPress 3.3.2-scripts
[autoinstalls/wordpress.git] / wp-includes / ms-files.php
index f5af8e0370ac2903ce9687f7f2cf9b26162b34a3..e7ab0a4cccae0172f1220ce9756f58a51786d895 100644 (file)
@@ -23,22 +23,22 @@ if ( $current_blog->archived == '1' || $current_blog->spam == '1' || $current_bl
        die( '404 — File not found.' );
 }
 
-$file = BLOGUPLOADDIR . str_replace( '..', '', $_GET[ 'file' ] );
+$file = rtrim( BLOGUPLOADDIR, '/' ) . '/' . str_replace( '..', '', $_GET[ 'file' ] );
 if ( !is_file( $file ) ) {
        status_header( 404 );
        die( '404 — File not found.' );
 }
 
-$mime = wp_check_filetype( $_SERVER[ 'REQUEST_URI' ] );
+$mime = wp_check_filetype( $file );
 if( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) )
        $mime[ 'type' ] = mime_content_type( $file );
 
 if( $mime[ 'type' ] )
        $mimetype = $mime[ 'type' ];
 else
-       $mimetype = 'image/' . substr( $_SERVER[ 'REQUEST_URI' ], strrpos( $_SERVER[ 'REQUEST_URI' ], '.' ) + 1 );
+       $mimetype = 'image/' . substr( $file, strrpos( $file, '.' ) + 1 );
 
-header( 'Content-type: ' . $mimetype ); // always send this
+header( 'Content-Type: ' . $mimetype ); // always send this
 if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) )
        header( 'Content-Length: ' . filesize( $file ) );