X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=thumb.php;h=ad5239e297223dbbc1b451c86b1980e99ef79fa7;hb=754334f92a637190b7d6786413319f6e687779f0;hp=4ffefb686c8ca4fc80cb8cf29cb11f4074491e24;hpb=bd5fe058ff70ec76a59761203b6a080d2686496e;p=lhc%2Fweb%2Fwiklou.git diff --git a/thumb.php b/thumb.php index 4ffefb686c..ad5239e297 100644 --- a/thumb.php +++ b/thumb.php @@ -107,6 +107,15 @@ function wfStreamThumb( array $params ) { $fileName = isset( $params['f'] ) ? $params['f'] : ''; + // Backwards compatibility parameters + if ( isset( $params['w'] ) ) { + $params['width'] = $params['w']; + unset( $params['w'] ); + } + if ( isset( $params['p'] ) ) { + $params['page'] = $params['p']; + } + // Is this a thumb of an archived file? $isOld = ( isset( $params['archived'] ) && $params['archived'] ); unset( $params['archived'] ); // handlers don't care @@ -171,7 +180,6 @@ function wfStreamThumb( array $params ) { return; } - // Check the source file storage path if ( !$img->exists() ) { $redirectedLocation = false; @@ -235,18 +243,9 @@ function wfStreamThumb( array $params ) { } } - // Backwards compatibility parameters - if ( isset( $params['w'] ) ) { - $params['width'] = $params['w']; - unset( $params['w'] ); - } - if ( isset( $params['p'] ) ) { - $params['page'] = $params['p']; - } unset( $params['r'] ); // ignore 'r' because we unconditionally pass File::RENDER unset( $params['f'] ); // We're done with 'f' parameter. - // Get the normalized thumbnail name from the parameters... try { $thumbName = $img->thumbName( $params ); @@ -304,6 +303,12 @@ function wfStreamThumb( array $params ) { return; } + $user = RequestContext::getMain()->getUser(); + if ( $user->pingLimiter( 'renderfile' ) ) { + wfThumbError( 500, wfMessage( 'actionthrottledtext' ) ); + return; + } + // Thumbnail isn't already there, so create the new thumbnail... try { $thumb = $img->transform( $params, File::RENDER_NOW );