r36851 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36850‎ | r36851 | r36852 >
Date:17:03, 1 July 2008
Author:demon
Status:old
Tags:
Comment:
bug 12232 - Return more than one result on attempted spoofing.
Modified paths:
  • /trunk/extensions/AntiSpoof/AntiSpoof.i18n.php (modified) (history)
  • /trunk/extensions/AntiSpoof/AntiSpoof.php (modified) (history)
  • /trunk/extensions/AntiSpoof/SpoofUser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AntiSpoof/AntiSpoof.i18n.php
@@ -9,7 +9,7 @@
1010
1111 $messages['en'] = array(
1212 '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 the existing account "$2".
 13+ 'antispoof-name-conflict' => 'The name "$1" is too similar to existing accounts: "$2".
1414 Please choose another name.',
1515 'antispoof-name-illegal' => 'The name "$1" is not allowed to prevent confusing or spoofed usernames: $2.
1616 Please choose another name.',
@@ -1513,3 +1513,4 @@
15141514 'right-override-antispoof' => '無視欺詐檢查',
15151515 );
15161516
 1517+
Index: trunk/extensions/AntiSpoof/AntiSpoof.php
@@ -85,9 +85,9 @@
8686 if( $conflict === false ) {
8787 wfDebugLog( 'antispoof', "{$mode}PASS new account '$name' [$normalized]" );
8888 } else {
89 - wfDebugLog( 'antispoof', "{$mode}CONFLICT new account '$name' [$normalized] spoofs '$conflict'" );
 89+ wfDebugLog( 'antispoof', "{$mode}CONFLICT new account '$name' [$normalized] spoofs: '" . implode( ', ', $conflict ) . "'" );
9090 if( $active ) {
91 - $message = wfMsg( 'antispoof-name-conflict', $name, $conflict );
 91+ $message = wfMsg( 'antispoof-name-conflict', $name, implode( ', ',$conflict ) );
9292 return false;
9393 }
9494 }
Index: trunk/extensions/AntiSpoof/SpoofUser.php
@@ -39,7 +39,7 @@
4040 /**
4141 * Does the username pass Unicode legality and script-mixing checks?
4242 *
43 - * @return mixed false if no conflict, or string with conflicting username
 43+ * @return mixed false if no conflict, or array with conflicting usernames
4444 */
4545 public function getConflict() {
4646 if( $this->isLegal() ) {
@@ -47,17 +47,26 @@
4848
4949 // Join against the user table to ensure that we skip stray
5050 // entries left after an account is renamed or otherwise munged.
51 - $row = $dbr->selectRow(
 51+ $spoofedUsers = $dbr->select(
5252 array( 'spoofuser', 'user' ),
5353 array( 'user_name' ),
5454 array(
5555 'su_normalized' => $this->mNormalized,
5656 'su_name=user_name',
5757 ),
58 - __METHOD__ );
 58+ __METHOD__,
 59+ array(
 60+ 'LIMIT' => 5
 61+ ) );
5962
60 - if( $row ) {
61 - return $row->user_name;
 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;
6271 } else {
6372 return false;
6473 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r36964Revert r36851 for now (bug 12232 - Return more than one result on attempted s...brion00:00, 3 July 2008
r37932Try again at bug 12232 - Return more than one result on attempted spoofing....sql03:39, 23 July 2008
r42240(bug 12232) AntiSpoof returns more than 1 result, and outputs it in a list. P...soxred9300:28, 20 October 2008

Status & tagging log