r95205 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95204‎ | r95205 | r95206 >
Date:14:50, 22 August 2011
Author:neilk
Status:ok
Tags:
Comment:
remove features made redundant by titleblacklist api
Modified paths:
  • /trunk/extensions/UploadWizard/resources/jquery/jquery.validate.wmCommonsBlacklist.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/jquery/jquery.validate.wmCommonsBlacklist.js
@@ -1,11 +1,10 @@
22 /**
3 - * One day this will look up an API method to determine if a filename is blacklisted by your local MediaWiki
4 - * For now we check with some regexes locally, with a Commons-specific blacklist
5 - * This is an incomplete rendering of the meta.wikimedia.org and commons.wikimedia.org blacklist as they existed on 2011-05-05, and
 3+ * Does some local checking of a file. For more specific filenames (such as bad words, other blacklisted stuff) use
 4+ * the Blacklist API.
 5+ *
 6+ * This is an incomplete rendering of some of the meta.wikimedia.org and commons.wikimedia.org blacklist as they existed on 2011-05-05, and
67 * ignores cases that are irrelevant to uploading new media images.
78 * - all regexes are case INsensitive by default
8 - * - casesensitive is considered
9 - * - errmsg is considered
109 * - namespaces and File: prefix are removed since everything we upload is under File: anyway
1110 * - noedit, moveonly, repuload is irrelevant
1211 * - we can't check autoconfirmed-ness of users here, so we ignore it
@@ -15,34 +14,7 @@
1615 ( function( $ ) {
1716
1817 var regexSets = {
19 -
20 - 'titleBlacklist': [
21 - /(?:suck|his|your|my) penis/i,
22 - /\bnimp\.org./i,
23 - /Lawl,/i,
24 - /HAGG[EA]R[^A-Z]*/i,
25 - /[–ùHŒó][E–ïŒï]R[M–úŒú][YŒ•]/,
26 - /[–ùHŒó][AŒëŒë]GG[E–ïŒï]R/,
27 - /[–ùH]\W*[AŒëŒë]\W*G\W*G\W*[E–ïŒï]\W*R(?!ston)/i,
28 - /\bHERMY/,
29 - / on wheels/i,
30 - /(?:.*?\/)?index\.php(?:\/.*)?/i,
31 - /(?:http|https|ftp|mailto|torrent|ed2k)\:\/\/[\w\d:@\-]+\.[\w\d\-]+/i,
32 - /http:\/\//i,
33 - /\/wiki\//i,
34 - /\bis\s+(?:a|an)\s+(?:dick|cunt|fag|bitch|shit|fuck|fucker|loser|ass|gay|ghey|moron|retard|stupid|slut|pa?edo)/i,
35 - /\sprefix:/i, // search from inputboxes (f.e. in the village pumps)
36 - /.*[!?]{3,}.* /i,
37 - /(?:[^\/i]+[\/:])?(index\.php|w\/wiki)(?:\/.+)?/,
38 - /[–ùHŒóÔº®‚±ß][E–ïŒï√ãÔº•ƒñ][RÔº≤–Ø][M–úŒúÔº≠][YŒ•Ôºπ]/i,
39 - /JEWS DID/i,
40 - /ON WHE/,
41 - /(?:Moulton|Barsoom Tork|Pocoyo Albatross|Anything Muppets|Moosey Mouse|Inbloomed Muppets).*/,
42 - /Jorge Queirolo Bravo/i,
43 - /Vasilisa(\d)+/i,
44 - /google.*\.html/i
45 - ],
46 -
 18+
4719 'titleBadchars': [
4820 /[\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]/, // NBSP and other unusual spaces
4921 /[\u202A-\u202E]/, // BiDi overrides
@@ -74,23 +46,6 @@
7547 /^SANY[\d\s]+$/ // Sanyo
7648 ],
7749
78 - // filename from elsewhere
79 - 'titleHosting': [
80 - /^\d{9}[A-Z]{6}_[A-Z]{2}[^A-Za-z]*$/, // some image hosting site?
81 - /^\d{8,}_[\dA-F]{10}(_[A-Z])?[^A-Za-z]*$/i, // http://www.flickr.com/services/api/misc.urls.html/i,
82 - /^([\dA-F]{8}-)?[\dA-F]{4}-[\dA-F]{4}-[\dA-F]{4}-?[\dA-F]{12}.*$/, // [[w:UUID]] (with some variations included)
83 - /^([SML]|\d+)_[\dA-F]{10,}(-\d+-|_?(\w\w?|full))?$/, // L_9173c67eae58edc35ba7f2df08a7d5c6.jpg, 2421601587_abaf4e3e81.jpg, 1_bf38bcd9c5512a5ab99ca2219a4b1e2f_full.gif, etc.
84 - /^AT[AEIMQUYcgkosw048]AAA[A-D][-_A-Za-z0-9]+$/, // see Commons:Village pump#File ATgAAA... (Jan 20, 2009, full link in edit comment)
85 - /^(\d+_){2,}[qtsn]$/, // Facebook: \d+_\d+_(\d+)_(\d+)_\d+_[qtsn]\.jpg -> photo.php?id=$1&pid=$2
86 - /^[qtsn]\d+(_\d+)+$/, // Facebook (older?): [qtsn](\d+)_(\d+)_\d+\.jpg -> photo.php?id=$1&pid=$2
87 - /^Tumblr_[a-z\d]{19}_\d$/, // Tumblr
88 - /^File$/,
89 - /^[^A-Za-z]*(small|medium|large)\)?$/,
90 - /^(Untitled|No[-_]?name|Picture|Pict?|Image[mn]?|Img|Immagine|Photo|Foto|Bild|Scan|Panorama|Sin_t√≠tulo)[^A-Za-z]*$/,
91 - /^(January|Jan|February|Febr?|March|Mar|April|Apr|May|June?|July?|August|Aug|September|Sept?|October|Oct|November|Nov|December|Dec)[^A-Za-z]*$/,
92 - /^[0-9 ]*([A-Z][0-9 ]*){30,}$/
93 - ],
94 -
9550 'titleThumbnail': [
9651 /^\d+px-.*/
9752 ],
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js
@@ -273,18 +273,14 @@
274274 _this.$form.find( '.mwe-title' )
275275 .rules( "add", {
276276 required: true,
277 - titleBlacklist: true,
278277 titleBadchars: true,
279278 titleSenselessimagename: true,
280 - titleHosting: true,
281279 titleThumbnail: true,
282280 titleExtension: true,
283281 messages: {
284282 required: gM( 'mwe-upwiz-error-blank' ),
285 - titleBlacklist: gM( 'mwe-upwiz-error-title-blacklisted' ),
286283 titleBadchars: gM( 'mwe-upwiz-error-title-badchars' ),
287284 titleSenselessimagename: gM( 'mwe-upwiz-error-title-senselessimagename' ),
288 - titleHosting: gM( 'mwe-upwiz-error-title-hosting' ),
289285 titleThumbnail: gM( 'mwe-upwiz-error-title-thumbnail' ),
290286 titleExtension: gM( 'mwe-upwiz-error-title-extension' )
291287 }

Status & tagging log