r36760 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36759‎ | r36760 | r36761 >
Date:19:49, 27 June 2008
Author:btongminh
Status:old
Tags:
Comment:
Only ignore the antispoof if the wpIgnoreAntiSpoof checkbox is set (fixes bug 13426)
Modified paths:
  • /trunk/extensions/AntiSpoof/AntiSpoof.i18n.php (modified) (history)
  • /trunk/extensions/AntiSpoof/AntiSpoof.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AntiSpoof/AntiSpoof.i18n.php
@@ -21,6 +21,7 @@
2222 'antispoof-noletters' => 'Does not contain any letters',
2323 'antispoof-mixedscripts' => 'Contains incompatible mixed scripts',
2424 'antispoof-tooshort' => 'Canonicalized name too short',
 25+ 'antispoof-ignore' => 'Ignore spoofing checks',
2526
2627 'right-override-antispoof' => 'Override the spoofing checks',
2728 );
Index: trunk/extensions/AntiSpoof/AntiSpoof.php
@@ -43,6 +43,7 @@
4444
4545 global $wgHooks;
4646 $wgHooks['AbortNewAccount'][] = 'asAbortNewAccountHook';
 47+ $wgHooks['UserCreateForm'][] = 'asUserCreateFormHook';
4748 $wgHooks['AddNewAccount'][] = 'asAddNewAccountHook';
4849 }
4950
@@ -61,13 +62,14 @@
6263 * @return bool true to continue, false to abort user creation
6364 */
6465 function asAbortNewAccountHook( $user, &$message ) {
65 - global $wgAntiSpoofAccounts, $wgUser;
 66+ global $wgAntiSpoofAccounts, $wgUser, $wgRequest;
6667 wfLoadExtensionMessages( 'AntiSpoof' );
6768
6869 if( !$wgAntiSpoofAccounts ) {
6970 $mode = 'LOGGING ';
7071 $active = false;
71 - } elseif( $wgUser->isAllowed( 'override-antispoof' ) ) {
 72+ } elseif( $wgRequest->getCheck('wpIgnoreAntiSpoof') &&
 73+ $wgUser->isAllowed( 'override-antispoof' ) ) {
7274 $mode = 'OVERRIDE ';
7375 $active = false;
7476 } else {
@@ -101,6 +103,21 @@
102104 }
103105
104106 /**
 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+/**
105122 * On new account creation, record the username's thing-bob.
106123 */
107124 function asAddNewAccountHook( $user ) {

Status & tagging log