X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=img_auth.php;h=72a7dab85536e74eed2cf48230d1d3ae80400711;hb=3dbfd49793a479efb2fb8b968ccb7f4902287b67;hp=2d2db9a5ed1035a448a2161cf07ac7ff112488f4;hpb=6abd85ca9210551ad8f09d2d2424350fc0b21cb3;p=lhc%2Fweb%2Fwiklou.git diff --git a/img_auth.php b/img_auth.php index 2d2db9a5ed..72a7dab855 100644 --- a/img_auth.php +++ b/img_auth.php @@ -92,12 +92,17 @@ function wfImageAuthMain() { if ( strpos( $path, $prefix ) === 0 ) { $be = FileBackendGroup::singleton()->backendFromPath( $storageDir ); $filename = $storageDir . substr( $path, strlen( $prefix ) ); // strip prefix + // Check basic user authorization + if ( !RequestContext::getMain()->getUser()->isAllowed( 'read' ) ) { + wfForbidden( 'img-auth-accessdenied', 'img-auth-noread', $path ); + return; + } if ( $be->fileExists( array( 'src' => $filename ) ) ) { wfDebugLog( 'img_auth', "Streaming `" . $filename . "`." ); $be->streamFile( array( 'src' => $filename ), array( 'Cache-Control: private', 'Vary: Cookie' ) ); } else { - wfForbidden( 'img-auth-accessdenied', 'img-auth-nofile', $filename ); + wfForbidden( 'img-auth-accessdenied', 'img-auth-nofile', $path ); } return; }