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(); } # Write file $type = wfGetType( $filename ); if ( $type ) { header("Content-type: $type"); } readfile( $filename ); function wfGetType( $filename ) { # There's probably a better way to do this $types = <<

Access denied

You need to log in to access files on this server

"; exit; } ?>