X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=img_auth.php;h=24bda422a0d3426e6134963844cc1bf2ec8a3de2;hb=2d92044bb7e31646bbd8432ed7440b211ec707c1;hp=4ec68ea44b0683809f319c26c7733e4aa8434a86;hpb=53856406a6bf2dc9fe01fdd3a47f2e428abb0671;p=lhc%2Fweb%2Fwiklou.git diff --git a/img_auth.php b/img_auth.php index 4ec68ea44b..24bda422a0 100644 --- a/img_auth.php +++ b/img_auth.php @@ -1,187 +1,63 @@ getNsText( NS_IMAGE ) . ":" . basename( $_SERVER['PATH_INFO'] ); +$imageName = $wgContLang->getNsText( NS_IMAGE ) . ":" . wfBaseName( $_SERVER['PATH_INFO'] ); # Check if the filename is in the correct directory if ( substr( $filename, 0, strlen( $realUploadDirectory ) ) != $realUploadDirectory ) { + wfDebugLog( 'img_auth', "requested path not in upload dir: $filename" ); wfForbidden(); } if ( is_array( $wgWhitelistRead ) && !in_array( $imageName, $wgWhitelistRead ) && !$wgUser->getID() ) { + wfDebugLog( 'img_auth', "not logged in and requested file not in whitelist: $imageName" ); wfForbidden(); } if( !file_exists( $filename ) ) { + wfDebugLog( 'img_auth', "requested file does not exist: $filename" ); wfForbidden(); } if( is_dir( $filename ) ) { + wfDebugLog( 'img_auth', "requested file is a directory: $filename" ); wfForbidden(); } # Write file -$type = wfGetType( $filename ); -if ( $type ) { - header("Content-type: $type"); -} else { - header("Content-type: application/x-wiki"); -} - -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

"; + wfLogProfilingData(); exit; } -?> +