$GLOBALS overwrite vulnerability'; die( -1 ); } require_once( 'includes/Defines.php' ); require_once( './LocalSettings.php' ); require_once( 'includes/Setup.php' ); require_once( 'includes/StreamFile.php' ); if( !isset( $_SERVER['PATH_INFO'] ) ) { wfForbidden(); } # Get filenames/directories $filename = realpath( $wgUploadDirectory . $_SERVER['PATH_INFO'] ); $realUploadDirectory = realpath( $wgUploadDirectory ); $imageName = $wgLang->getNsText( NS_IMAGE ) . ":" . basename( $_SERVER['PATH_INFO'] ); # Check if the filename is in the correct directory if ( substr( $filename, 0, strlen( $realUploadDirectory ) ) != $realUploadDirectory ) { wfForbidden(); } if ( is_array( $wgWhitelistRead ) && !in_array( $imageName, $wgWhitelistRead ) && !$wgUser->getID() ) { wfForbidden(); } if( !file_exists( $filename ) ) { wfForbidden(); } if( is_dir( $filename ) ) { wfForbidden(); } # Write file wfStreamFile( $filename ); function wfForbidden() { header( 'HTTP/1.0 403 Forbidden' ); print "

Access denied

You need to log in to access files on this server

"; exit; } ?>