Index: trunk/extensions/AntiSpoof/AntiSpoof.i18n.php
===================================================================
--- trunk/extensions/AntiSpoof/AntiSpoof.i18n.php (revision 42239)
+++ trunk/extensions/AntiSpoof/AntiSpoof.i18n.php (revision 42240)
@@ -9,8 +9,9 @@
$messages['en'] = array(
'antispoof-desc' => 'Blocks the creation of accounts with mixed-script, confusing and similar usernames',
- 'antispoof-name-conflict' => 'The name "$1" is too similar to the existing account "$2".
-Please choose another name.',
+ 'antispoof-conflict-top' => 'The name "$1" is too similar to {{PLURAL:$2|the existing account|the following $2 accounts}}:',
+ 'antispoof-conflict-item' => '$1',
+ 'antispoof-conflict-bottom' => 'Please choose another name.',
'antispoof-name-illegal' => 'The name "$1" is not allowed to prevent confusing or spoofed usernames: $2.
Please choose another name.',
'antispoof-badtype' => 'Bad data type',
Index: trunk/extensions/AntiSpoof/AntiSpoof.php
===================================================================
--- trunk/extensions/AntiSpoof/AntiSpoof.php (revision 42239)
+++ trunk/extensions/AntiSpoof/AntiSpoof.php (revision 42240)
@@ -81,13 +81,19 @@
$spoof = new SpoofUser( $name );
if( $spoof->isLegal() ) {
$normalized = $spoof->getNormalized();
- $conflict = $spoof->getConflict();
- if( $conflict === false ) {
+ $conflicts = $spoof->getConflicts();
+ if( empty($conflicts) ) {
wfDebugLog( 'antispoof', "{$mode}PASS new account '$name' [$normalized]" );
} else {
- wfDebugLog( 'antispoof', "{$mode}CONFLICT new account '$name' [$normalized] spoofs '$conflict'" );
+ wfDebugLog( 'antispoof', "{$mode}CONFLICT new account '$name' [$normalized] spoofs " . implode( ',', $conflicts ) );
if( $active ) {
- $message = wfMsg( 'antispoof-name-conflict', $name, $conflict );
+ $numConflicts = count( $conflicts );
+ $message = wfMsgExt( 'antispoof-conflict-top', array('parsemag'), $name, $numConflicts );
+ $message .= '<ul>';
+ foreach( $conflicts as $simUser ) {
+ $message .= '<li>' . wfMsg( 'antispoof-conflict-item', $simUser ) . '</li>';
+ }
+ $message .= '</ul>' . wfMsg( 'antispoof-conflict-bottom' );
return false;
}
}
Index: trunk/extensions/AntiSpoof/SpoofUser.php
===================================================================
--- trunk/extensions/AntiSpoof/SpoofUser.php (revision 42239)
+++ trunk/extensions/AntiSpoof/SpoofUser.php (revision 42240)
@@ -39,31 +39,30 @@
/**
* Does the username pass Unicode legality and script-mixing checks?
*
- * @return mixed false if no conflict, or string with conflicting username
+ * @return array empty if no conflict, or array containing conflicting usernames
*/
- public function getConflict() {
- if( $this->isLegal() ) {
- $dbr = wfGetDB( DB_SLAVE );
+ public function getConflicts() {
+ $dbr = wfGetDB( DB_SLAVE );
- // Join against the user table to ensure that we skip stray
- // entries left after an account is renamed or otherwise munged.
- $row = $dbr->selectRow(
- array( 'spoofuser', 'user' ),
- array( 'user_name' ),
- array(
- 'su_normalized' => $this->mNormalized,
- 'su_name=user_name',
- ),
- __METHOD__ );
+ // Join against the user table to ensure that we skip stray
+ // entries left after an account is renamed or otherwise munged.
+ $spoofedUsers = $dbr->select(
+ array( 'spoofuser', 'user' ),
+ array( 'user_name' ),
+ array(
+ 'su_normalized' => $this->mNormalized,
+ 'su_name=user_name',
+ ),
+ __METHOD__,
+ array(
+ 'LIMIT' => 5
+ ) );
- if( $row ) {
- return $row->user_name;
- } else {
- return false;
- }
- } else {
- return false;
+ $spoofs = array();
+ while( $row = $dbr->fetchObject( $spoofedUsers ) ) {
+ array_push( $spoofs, $row->user_name );
}
+ return $spoofs;
}
/**