Update docs and declare visibility on class props
[lhc/web/wiklou.git] / thumb.php
index bb9c4d6..913adc1 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -304,6 +304,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 );
@@ -425,7 +431,7 @@ function wfExtractThumbParams( $file, $params ) {
        if ( $handler && $fileNamePos !== false ) {
                $paramString = substr( $thumbname, 0, $fileNamePos - 1 );
                $extraParams = $handler->parseParamString( $paramString );
-               if ( $handler !== false ) {
+               if ( $extraParams !== false ) {
                        return $params + $extraParams;
                }
        }
@@ -463,6 +469,7 @@ function wfThumbError( $status, $msg ) {
                header( 'HTTP/1.1 500 Internal server error' );
        }
        if ( $wgShowHostnames ) {
+               header( 'X-MW-Thumbnail-Renderer: ' . wfHostname() );
                $url = htmlspecialchars( isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '' );
                $hostname = htmlspecialchars( wfHostname() );
                $debug = "<!-- $url -->\n<!-- $hostname -->\n";