From 8768a7ae96d457d38aa9468a410522db56906202 Mon Sep 17 00:00:00 2001 From: Jacob G Date: Tue, 26 May 2015 22:02:11 -0400 Subject: [PATCH] added limited alt account checking (#14) --- .../business/AccountConfirmSubmission.php | 4 +-- .../language/ConfirmAccountPage.i18n.php | 2 ++ .../actions/ConfirmAccount_body.php | 29 +++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/ConfirmAccount/business/AccountConfirmSubmission.php b/ConfirmAccount/business/AccountConfirmSubmission.php index f0af483..231ba45 100644 --- a/ConfirmAccount/business/AccountConfirmSubmission.php +++ b/ConfirmAccount/business/AccountConfirmSubmission.php @@ -294,10 +294,10 @@ class AccountConfirmSubmission { } # Actually send out the email (@TODO: rollback on failure including $wgAuth) - $result = $user->sendMail( + /*$result = $user->sendMail( $context->msg( 'confirmaccount-email-subj' )->inContentLanguage()->text(), $ebody - ); + );*/ # Update user count $ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 ); diff --git a/ConfirmAccount/frontend/language/ConfirmAccountPage.i18n.php b/ConfirmAccount/frontend/language/ConfirmAccountPage.i18n.php index 3e9ed71..23a1103 100644 --- a/ConfirmAccount/frontend/language/ConfirmAccountPage.i18n.php +++ b/ConfirmAccount/frontend/language/ConfirmAccountPage.i18n.php @@ -135,6 +135,8 @@ There may be contact lists on site that you can use if you want to know more abo $2 There may be contact lists on site that you can use if you want to know more about user account policy.', + 'confirmaccount-altwarning' => 'The following accounts have made edits from the same IP address as this user:', + 'confirmaccount-warning' => 'Warning', ); diff --git a/ConfirmAccount/frontend/specialpages/actions/ConfirmAccount_body.php b/ConfirmAccount/frontend/specialpages/actions/ConfirmAccount_body.php index 696e4c4..026d539 100644 --- a/ConfirmAccount/frontend/specialpages/actions/ConfirmAccount_body.php +++ b/ConfirmAccount/frontend/specialpages/actions/ConfirmAccount_body.php @@ -421,6 +421,20 @@ class ConfirmAccountsPage extends SpecialPage { } $form .= ''; } + + //search for possible alt accounts + $ip = $accountReq->getIP(); + $alts = $this->getUsersFromIP($ip); + if (!empty($alts)) { + foreach ($alts as &$user) { + + } + $form .= '
'; + $form .= '' . $this->msg('confirmaccount-warning') . ''; + $form .= '' . $this->msg('confirmaccount-altwarning') . ''; + $form .= ''; + $form .= '
'; + } $form .= '
'; $form .= '' . $this->msg( 'confirmaccount-legend' )->escaped() . ''; @@ -746,6 +760,21 @@ class ConfirmAccountsPage extends SpecialPage { return $r; } + + function getUsersFromIP($ip) { + global $wgShowExceptionDetails ; + $wgShowExceptionDetails = true; + $dbr = wfGetDB( DB_SLAVE ); + $result = $dbr->select('recentchanges', array('DISTINCT(rc_user_text)'), 'rc_ip=\'' . $ip . '\''); + + $return = array(); + foreach ($result as $row) { + $return[] = (string)$row->rc_user_text; + } + array_unique($return); + + return $return; + } } /**