Index: trunk/extensions/ConfirmEdit/ConfirmEdit.php |
— | — | @@ -56,6 +56,16 @@ |
57 | 57 | $wgGroupPermissions['bot' ]['skipcaptcha'] = true; // registered bots |
58 | 58 | $wgGroupPermissions['sysop' ]['skipcaptcha'] = true; |
59 | 59 | |
| 60 | +/** |
| 61 | + * List of IP ranges to allow to skip the captcha, similar to the group setting: |
| 62 | + * "$wgGroupPermission[...]['skipcaptcha'] = true" |
| 63 | + * |
| 64 | + * Specific IP addresses or CIDR-style ranges may be used, |
| 65 | + * for instance: |
| 66 | + * $wgCaptchaWhitelistIP = array('192.168.1.0/24', '10.1.0.0/16'); |
| 67 | + */ |
| 68 | +$wgCaptchaWhitelistIP = false; |
| 69 | + |
60 | 70 | global $wgCaptcha, $wgCaptchaClass, $wgCaptchaTriggers; |
61 | 71 | $wgCaptcha = null; |
62 | 72 | $wgCaptchaClass = 'SimpleCaptcha'; |
— | — | @@ -393,7 +403,17 @@ |
394 | 404 | wfDebug( "ConfirmEdit: user group allows skipping captcha\n" ); |
395 | 405 | return false; |
396 | 406 | } |
| 407 | + global $wgCaptchaWhitelistIP; |
| 408 | + if( !empty( $wgCaptchaWhitelistIP ) ) { |
| 409 | + $ip = wfGetIp(); |
| 410 | + foreach ( $wgCaptchaWhitelistIP as $range ) { |
| 411 | + if ( IP::isInRange( $ip, $range ) ) { |
| 412 | + return false; |
| 413 | + } |
| 414 | + } |
| 415 | + } |
397 | 416 | |
| 417 | + |
398 | 418 | global $wgEmailAuthentication, $ceAllowConfirmedEmail; |
399 | 419 | if( $wgEmailAuthentication && $ceAllowConfirmedEmail && |
400 | 420 | $wgUser->isEmailConfirmed() ) { |