Index: trunk/extensions/AntiSpoof/AntiSpoof.i18n.php |
— | — | @@ -9,13 +9,8 @@ |
10 | 10 | |
11 | 11 | $messages['en'] = array( |
12 | 12 | 'antispoof-desc' => 'Blocks the creation of accounts with mixed-script, confusing and similar usernames', |
13 | | - 'antispoof-name-conflict' => 'The name "$1" is too similar to existing $2. |
| 13 | + 'antispoof-name-conflict' => 'The name "$1" is too similar to the existing account "$2". |
14 | 14 | Please choose another name.', |
15 | | - 'antispoof-name-conflict1' => 'account: "$1"', |
16 | | - 'antispoof-name-conflict2' => 'accounts: "$1", "$2"', |
17 | | - 'antispoof-name-conflict3' => 'accounts: "$1", "$2", "$3"', |
18 | | - 'antispoof-name-conflict4' => 'accounts: "$1", "$2", "$3", "$4"', |
19 | | - 'antispoof-name-conflict5' => 'accounts: "$1", "$2", "$3", "$4", "$5"', |
20 | 15 | 'antispoof-name-illegal' => 'The name "$1" is not allowed to prevent confusing or spoofed usernames: $2. |
21 | 16 | Please choose another name.', |
22 | 17 | 'antispoof-badtype' => 'Bad data type', |
Index: trunk/extensions/AntiSpoof/AntiSpoof.php |
— | — | @@ -85,34 +85,9 @@ |
86 | 86 | if( $conflict === false ) { |
87 | 87 | wfDebugLog( 'antispoof', "{$mode}PASS new account '$name' [$normalized]" ); |
88 | 88 | } else { |
89 | | - wfDebugLog( 'antispoof', "{$mode}CONFLICT new account '$name' [$normalized] spoofs: '" . implode( ', ', $conflict ) . "'" ); |
| 89 | + wfDebugLog( 'antispoof', "{$mode}CONFLICT new account '$name' [$normalized] spoofs '$conflict'" ); |
90 | 90 | if( $active ) { |
91 | | - $numConflicts = count( $conflict ); |
92 | | - switch ( $numConflicts ) { |
93 | | - case 1: |
94 | | - $message = wfMsg( 'antispoof-name-conflict', $name, |
95 | | - wfMsg( 'antispoof-name-conflict1', $conflict['0'] ) ); |
96 | | - break; |
97 | | - case 2: |
98 | | - $message = wfMsg( 'antispoof-name-conflict', $name, |
99 | | - wfMsg( 'antispoof-name-conflict2', $conflict['0'], $conflict['1'] ) ); |
100 | | - break; |
101 | | - case 3: |
102 | | - $message = wfMsg( 'antispoof-name-conflict', $name, |
103 | | - wfMsg( 'antispoof-name-conflict3', $conflict['0'], $conflict['1'], $conflict['2'] ) ); |
104 | | - break; |
105 | | - case 4: |
106 | | - $message = wfMsg( 'antispoof-name-conflict', $name, |
107 | | - wfMsg( 'antispoof-name-conflict4', $conflict['0'], $conflict['1'], |
108 | | - $conflict['2'], $conflict['3'] ) ); |
109 | | - break; |
110 | | - case 5: |
111 | | - $message = wfMsg( 'antispoof-name-conflict', $name, |
112 | | - wfMsg( 'antispoof-name-conflict5', $conflict['0'], $conflict['1'], $conflict['2'], |
113 | | - $conflict['3'], $conflict['4'] ) ); |
114 | | - break; |
115 | | - } |
116 | | - |
| 91 | + $message = wfMsg( 'antispoof-name-conflict', $name, $conflict ); |
117 | 92 | return false; |
118 | 93 | } |
119 | 94 | } |
Index: trunk/extensions/AntiSpoof/SpoofUser.php |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | /** |
41 | 41 | * Does the username pass Unicode legality and script-mixing checks? |
42 | 42 | * |
43 | | - * @return mixed false if no conflict, or array with up to five conflicting usernames |
| 43 | + * @return mixed false if no conflict, or string with conflicting username |
44 | 44 | */ |
45 | 45 | public function getConflict() { |
46 | 46 | if( $this->isLegal() ) { |
— | — | @@ -47,26 +47,17 @@ |
48 | 48 | |
49 | 49 | // Join against the user table to ensure that we skip stray |
50 | 50 | // entries left after an account is renamed or otherwise munged. |
51 | | - $spoofedUsers = $dbr->select( |
| 51 | + $row = $dbr->selectRow( |
52 | 52 | array( 'spoofuser', 'user' ), |
53 | 53 | array( 'user_name' ), |
54 | 54 | array( |
55 | 55 | 'su_normalized' => $this->mNormalized, |
56 | 56 | 'su_name=user_name', |
57 | 57 | ), |
58 | | - __METHOD__, |
59 | | - array( |
60 | | - 'LIMIT' => 5 |
61 | | - ) ); |
| 58 | + __METHOD__ ); |
62 | 59 | |
63 | | - $spoofs = array(); |
64 | | - |
65 | | - while( $row = $dbr->fetchObject( $spoofedUsers ) ) { |
66 | | - array_push( $spoofs, $row->user_name ); |
67 | | - } |
68 | | - |
69 | | - if( count( $spoofs ) > 0 ) { |
70 | | - return $spoofs; |
| 60 | + if( $row ) { |
| 61 | + return $row->user_name; |
71 | 62 | } else { |
72 | 63 | return false; |
73 | 64 | } |