MagicWord: Fix an indent
[lhc/web/wiklou.git] / includes / media / DjVu.php
index 2aeb35d..566efb2 100644 (file)
@@ -73,6 +73,11 @@ class DjVuHandler extends ImageHandler {
         * @return bool
         */
        function validateParam( $name, $value ) {
+               if ( $name === 'page' && trim( $value ) !== (string) intval( $value ) ) {
+                       // Extra junk on the end of page, probably actually a caption
+                       // e.g. [[File:Foo.djvu|thumb|Page 3 of the document shows foo]]
+                       return false;
+               }
                if ( in_array( $name, array( 'width', 'height', 'page' ) ) ) {
                        if ( $value <= 0 ) {
                                return false;
@@ -260,7 +265,7 @@ class DjVuHandler extends ImageHandler {
         * Get metadata, unserializing it if neccessary.
         *
         * @param File $file The DjVu file in question
-        * @return String XML metadata as a string.
+        * @return string XML metadata as a string.
         */
        private function getUnserializedMetadata( File $file ) {
                $metadata = $file->getMetadata();