Index: branches/extensionless-files/includes/StreamFile.php |
— | — | @@ -90,13 +90,13 @@ |
91 | 91 | * have changed since. |
92 | 92 | */ |
93 | 93 | if ( $safe ) { |
94 | | - global $wgFileBlacklist, $wgCheckFileExtensions, $wgStrictFileExtensions, |
| 94 | + global $wgFileBlacklist, $wgStrictFileExtensions, |
95 | 95 | $wgFileExtensions, $wgVerifyMimeType, $wgMimeTypeBlacklist, $wgRequest; |
96 | 96 | list( $partName, $extList ) = UploadBase::splitExtensions( $filename ); |
97 | 97 | if ( UploadBase::checkFileExtensionList( $extList, $wgFileBlacklist ) ) { |
98 | 98 | return 'unknown/unknown'; |
99 | 99 | } |
100 | | - if ( $wgCheckFileExtensions && $wgStrictFileExtensions |
| 100 | + if ( $wgStrictFileExtensions |
101 | 101 | && !UploadBase::checkFileExtensionList( $extList, $wgFileExtensions ) ) |
102 | 102 | { |
103 | 103 | return 'unknown/unknown'; |
Index: branches/extensionless-files/includes/filerepo/FSRepo.php |
— | — | @@ -310,9 +310,9 @@ |
311 | 311 | * @return FileRepoStatus |
312 | 312 | */ |
313 | 313 | function prepTarget( $targetRel ) { |
314 | | - global $wgCheckFileExtensions; |
315 | | - global $wgCheckFileExtensions, $wgStrictFileExtensions; |
316 | | - global $wgFileExtensions, $wgFileBlacklist; |
| 314 | + global $wgStrictFileExtensions; |
| 315 | + global $wgFileExtensions, $wgFileBlacklist; |
| 316 | + |
317 | 317 | $status = $this->newGood(); |
318 | 318 | if ( !$this->validateFilename( $targetRel ) ) { |
319 | 319 | throw new MWException( 'Validation error in $targetRel' ); |
— | — | @@ -333,8 +333,7 @@ |
334 | 334 | $status->fatal( 'filetype-badmime', $mime ); |
335 | 335 | return $status; |
336 | 336 | } |
337 | | - if ( $wgCheckFileExtensions |
338 | | - && $wgStrictFileExtensions |
| 337 | + if ( $wgStrictFileExtensions |
339 | 338 | && !in_array( $ext, $wgFileExtensions ) ) |
340 | 339 | { |
341 | 340 | $status->fatal( 'filetype-badmime', $mime ); |
Index: branches/extensionless-files/includes/DefaultSettings.php |
— | — | @@ -2173,14 +2173,6 @@ |
2174 | 2174 | ); |
2175 | 2175 | |
2176 | 2176 | /** |
2177 | | - * This is a flag to determine whether or not to check file extensions of |
2178 | | - * resulting uploaded files from uploading or moving a file. This acts as a |
2179 | | - * proxy for checking MIME types, and ensures files placed in $wgUploadDirectory |
2180 | | - * have approved file extensions. |
2181 | | - */ |
2182 | | -$wgCheckFileExtensions = true; |
2183 | | - |
2184 | | -/** |
2185 | 2177 | * This is a flag to determine whether or not to enforce matching of page title |
2186 | 2178 | * with file extensions of uploaded files (e.g if true, disallow a JPEG called |
2187 | 2179 | * "File:Foo", but allow "File:Foo.jpg"). |
Index: branches/extensionless-files/includes/specials/SpecialUpload.php |
— | — | @@ -827,27 +827,25 @@ |
828 | 828 | protected function getExtensionsMessage() { |
829 | 829 | # Print a list of allowed file extensions, if so configured. We ignore |
830 | 830 | # MIME type here, it's incomprehensible to most people and too long. |
831 | | - global $wgLang, $wgCheckFileExtensions, $wgStrictFileExtensions, |
| 831 | + global $wgLang, $wgStrictFileExtensions, |
832 | 832 | $wgFileExtensions, $wgFileBlacklist; |
833 | 833 | |
834 | 834 | $allowedExtensions = ''; |
835 | | - if( $wgCheckFileExtensions ) { |
836 | | - if( $wgStrictFileExtensions ) { |
837 | | - # Everything not permitted is banned |
838 | | - $extensionsList = |
839 | | - '<div id="mw-upload-permitted">' . |
840 | | - wfMsgWikiHtml( 'upload-permitted', $wgLang->commaList( $wgFileExtensions ) ) . |
841 | | - "</div>\n"; |
842 | | - } else { |
843 | | - # We have to list both preferred and prohibited |
844 | | - $extensionsList = |
845 | | - '<div id="mw-upload-preferred">' . |
846 | | - wfMsgWikiHtml( 'upload-preferred', $wgLang->commaList( $wgFileExtensions ) ) . |
847 | | - "</div>\n" . |
848 | | - '<div id="mw-upload-prohibited">' . |
849 | | - wfMsgWikiHtml( 'upload-prohibited', $wgLang->commaList( $wgFileBlacklist ) ) . |
850 | | - "</div>\n"; |
851 | | - } |
| 835 | + if( $wgStrictFileExtensions ) { |
| 836 | + # Everything not permitted is banned |
| 837 | + $extensionsList = |
| 838 | + '<div id="mw-upload-permitted">' . |
| 839 | + wfMsgWikiHtml( 'upload-permitted', $wgLang->commaList( $wgFileExtensions ) ) . |
| 840 | + "</div>\n"; |
| 841 | + } elseif( !empty( $wgFileExtensions ) ) { |
| 842 | + # We have to list both preferred and prohibited |
| 843 | + $extensionsList = |
| 844 | + '<div id="mw-upload-preferred">' . |
| 845 | + wfMsgWikiHtml( 'upload-preferred', $wgLang->commaList( $wgFileExtensions ) ) . |
| 846 | + "</div>\n" . |
| 847 | + '<div id="mw-upload-prohibited">' . |
| 848 | + wfMsgWikiHtml( 'upload-prohibited', $wgLang->commaList( $wgFileBlacklist ) ) . |
| 849 | + "</div>\n"; |
852 | 850 | } else { |
853 | 851 | # We still block the blacklisted stuff, because it's just nasty |
854 | 852 | $extensionsList = |