X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=img_auth.php;h=391fb291b8b539a0eb47371e05cb5821b445dd4f;hb=e3825282d11dbbf86d3e4a963cc0b7f1b4d7ed25;hp=2d2db9a5ed1035a448a2161cf07ac7ff112488f4;hpb=91e41289558af817650354c6988a0708dc051e35;p=lhc%2Fweb%2Fwiklou.git diff --git a/img_auth.php b/img_auth.php index 2d2db9a5ed..391fb291b8 100644 --- a/img_auth.php +++ b/img_auth.php @@ -2,7 +2,7 @@ /** * Image authorisation script * - * To use this, see http://www.mediawiki.org/wiki/Manual:Image_Authorization + * To use this, see https://www.mediawiki.org/wiki/Manual:Image_Authorization * * - Set $wgUploadDirectory to a non-public directory (not web accessible) * - Set $wgUploadPath to point to this file @@ -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; }