Index: trunk/extensions/CheckUser/CheckUser.php |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | # Mass block limits |
36 | 36 | $wgCheckUserMaxBlocks = 200; |
37 | 37 | |
38 | | -$wgCheckUserStyleVersion = 2; |
| 38 | +$wgCheckUserStyleVersion = 3; |
39 | 39 | |
40 | 40 | # Recent changes data hook |
41 | 41 | global $wgHooks; |
Index: trunk/extensions/CheckUser/checkuser.js |
— | — | @@ -12,8 +12,18 @@ |
13 | 13 | form.style.display = 'inline'; // unhide form (JS active) |
14 | 14 | var iplist = document.getElementById( 'mw-checkuser-iplist' ); |
15 | 15 | if( !iplist ) return; // no JS form |
16 | | - // Each line has one IP or range |
17 | | - var ips = iplist.value.split("\n"); |
| 16 | + var text = iplist.value; |
| 17 | + // Each line should have one IP or range |
| 18 | + if( text.indexOf("\n") != -1 ) { |
| 19 | + var ips = text.split("\n"); |
| 20 | + // Try some other delimiters too |
| 21 | + } else if( text.indexOf("\t") != -1 ) { |
| 22 | + var ips = text.split("\t"); |
| 23 | + } else if( text.indexOf(",") != -1 ) { |
| 24 | + var ips = text.split(","); |
| 25 | + } else { |
| 26 | + var ips = text.split(";"); |
| 27 | + } |
18 | 28 | var bin_prefix = 0; |
19 | 29 | var prefix_cidr = 0; |
20 | 30 | var prefix = new String( "" ); |
— | — | @@ -25,14 +35,14 @@ |
26 | 36 | // ...in the spirit of block.js, call this "addy" |
27 | 37 | var addy = ips[i]; |
28 | 38 | // Match the first IP in each list (ignore other garbage) |
29 | | - var ipV4 = addy.match(/\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(\/\d+)?\b/); |
30 | | - var ipV6 = addy.match(/\b(:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7})(\/\d+)?\b/); |
| 39 | + var ipV4 = addy.match(/(^|\b)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(\/\d+)?\b/); |
| 40 | + var ipV6 = addy.match(/(^|\b)(:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7})(\/\d+)?\b/); |
31 | 41 | // Binary form |
32 | 42 | var bin = new String( "" ); |
33 | 43 | // Convert the IP to binary form: IPv4 |
34 | 44 | if( ipV4 ) { |
35 | | - var ip = ipV4[1]; |
36 | | - var cidr = ipV4[2]; // CIDR, if it exists |
| 45 | + var ip = ipV4[2]; |
| 46 | + var cidr = ipV4[3]; // CIDR, if it exists |
37 | 47 | // Get each quad integer |
38 | 48 | var blocs = ip.split('.'); |
39 | 49 | for( var x=0; x<blocs.length; x++ ) { |
— | — | @@ -87,8 +97,8 @@ |
88 | 98 | if( prefix_cidr == 32 ) prefix_cidr = false; |
89 | 99 | // Convert the IP to binary form: IPv6 |
90 | 100 | } else if( ipV6 ) { |
91 | | - var ip = ipV6[1]; |
92 | | - var cidr = ipV6[2]; |
| 101 | + var ip = ipV6[2]; |
| 102 | + var cidr = ipV6[3]; |
93 | 103 | // Get each hex octant |
94 | 104 | var blocs = ip.split(':'); |
95 | 105 | for( var x=0; x<=7; x++ ) { |