Index: trunk/extensions/AntiSpoof/AntiSpoof.i18n.php |
— | — | @@ -21,6 +21,7 @@ |
22 | 22 | 'antispoof-noletters' => 'Does not contain any letters', |
23 | 23 | 'antispoof-mixedscripts' => 'Contains incompatible mixed scripts', |
24 | 24 | 'antispoof-tooshort' => 'Canonicalized name too short', |
| 25 | + 'antispoof-ignore' => 'Ignore spoofing checks', |
25 | 26 | |
26 | 27 | 'right-override-antispoof' => 'Override the spoofing checks', |
27 | 28 | ); |
Index: trunk/extensions/AntiSpoof/AntiSpoof.php |
— | — | @@ -43,6 +43,7 @@ |
44 | 44 | |
45 | 45 | global $wgHooks; |
46 | 46 | $wgHooks['AbortNewAccount'][] = 'asAbortNewAccountHook'; |
| 47 | + $wgHooks['UserCreateForm'][] = 'asUserCreateFormHook'; |
47 | 48 | $wgHooks['AddNewAccount'][] = 'asAddNewAccountHook'; |
48 | 49 | } |
49 | 50 | |
— | — | @@ -61,13 +62,14 @@ |
62 | 63 | * @return bool true to continue, false to abort user creation |
63 | 64 | */ |
64 | 65 | function asAbortNewAccountHook( $user, &$message ) { |
65 | | - global $wgAntiSpoofAccounts, $wgUser; |
| 66 | + global $wgAntiSpoofAccounts, $wgUser, $wgRequest; |
66 | 67 | wfLoadExtensionMessages( 'AntiSpoof' ); |
67 | 68 | |
68 | 69 | if( !$wgAntiSpoofAccounts ) { |
69 | 70 | $mode = 'LOGGING '; |
70 | 71 | $active = false; |
71 | | - } elseif( $wgUser->isAllowed( 'override-antispoof' ) ) { |
| 72 | + } elseif( $wgRequest->getCheck('wpIgnoreAntiSpoof') && |
| 73 | + $wgUser->isAllowed( 'override-antispoof' ) ) { |
72 | 74 | $mode = 'OVERRIDE '; |
73 | 75 | $active = false; |
74 | 76 | } else { |
— | — | @@ -101,6 +103,21 @@ |
102 | 104 | } |
103 | 105 | |
104 | 106 | /** |
| 107 | + * Set the ignore spoof thingie |
| 108 | + */ |
| 109 | +function asUserCreateFormHook( &$template ) { |
| 110 | + global $wgRequest, $wgAntiSpoofAccounts, $wgUser; |
| 111 | + |
| 112 | + wfLoadExtensionMessages( 'AntiSpoof' ); |
| 113 | + |
| 114 | + if( $wgAntiSpoofAccounts && $wgUser->isAllowed( 'override-antispoof' ) ) |
| 115 | + $template->addInputItem( 'wpIgnoreAntiSpoof', |
| 116 | + $wgRequest->getCheck('wpIgnoreAntiSpoof'), |
| 117 | + 'checkbox', 'antispoof-ignore' ); |
| 118 | + return true; |
| 119 | +} |
| 120 | + |
| 121 | +/** |
105 | 122 | * On new account creation, record the username's thing-bob. |
106 | 123 | */ |
107 | 124 | function asAddNewAccountHook( $user ) { |