jenkins-bot has submitted this change and it was merged.
Change subject: Merge SimpleAntiSpam extension into core
......................................................................
Merge SimpleAntiSpam extension into core
Adds an empty, hidden input field to the edit interface, and will
reject any edit if that field is filled in. This will protect
against the simplest form of spambots.
Localized messages will be imported separately.
Bug: 52063
Change-Id: I185b6a1e232299f496244a23f4bf0dc6ea22b6c9
(cherry picked from commit 0988d1200dd5d67719baf076cdbe3e363801ac23)
---
M RELEASE-NOTES-1.22
M includes/EditPage.php
M languages/messages/MessagesEn.php
M maintenance/language/messages.inc
4 files changed, 32 insertions(+), 0 deletions(-)
Approvals:
MarkAHershberger: Looks good to me, approved
jenkins-bot: Verified
diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index d6a75ba..091a04a 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -256,6 +256,9 @@
* Added a hook, SpecialWatchlistGetNonRevisionTypes, to allow extensions
with custom recentchanges entries to hook into the Watchlist without
clobbering each other.
+* A hidden, empty input field was added to the edit form, and any edit that
fills
+ it in will be rejected. This prevents against the simplest form of spambots.
+ Previously in the "SimpleAntiSpam" extension by Ryan Schmidt.
=== Bug fixes in 1.22 ===
* Disable Special:PasswordReset when $wgEnableEmail is false. Previously one
diff --git a/includes/EditPage.php b/includes/EditPage.php
index d7b2b5e..530e267 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -1381,6 +1381,24 @@
return $status;
}
+ $spam = $wgRequest->getText( 'wpAntispam' );
+ if ( $spam !== '' ) {
+ wfDebugLog(
+ 'SimpleAntiSpam',
+ $wgUser->getName() .
+ ' editing "' .
+ $this->mTitle->getPrefixedText() .
+ '" submitted bogus field "' .
+ $spam .
+ '"'
+ );
+ $status->fatal( 'spamprotectionmatch', false );
+ $status->value = self::AS_SPAM_ERROR;
+ wfProfileOut( __METHOD__ . '-checks' );
+ wfProfileOut( __METHOD__ );
+ return $status;
+ }
+
try {
# Construct Content object
$textbox_content = $this->toEditContent(
$this->textbox1 );
@@ -2190,6 +2208,14 @@
call_user_func_array( $formCallback, array( &$wgOut ) );
}
+ // Add an empty field to trip up spambots
+ $wgOut->addHTML(
+ Xml::openElement( 'div', array( 'id' =>
'antispam-container', 'style' => 'display: none;' ) )
+ . Html::rawElement( 'label', array( 'for' =>
'wpAntiSpam' ), wfMessage( 'simpleantispam-label' )->parse() )
+ . Xml::element( 'input', array( 'type' => 'text',
'name' => 'wpAntispam', 'id' => 'wpAntispam', 'value' => '' ) )
+ . Xml::closeElement( 'div' )
+ );
+
wfRunHooks( 'EditPage::showEditForm:fields', array( &$this,
&$wgOut ) );
// Put these up at the top to ensure they aren't lost on early
form submission
diff --git a/languages/messages/MessagesEn.php
b/languages/messages/MessagesEn.php
index 2cefeb8..0c1b560 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -3851,6 +3851,8 @@
'spam_reverting' => 'Reverting to last revision not containing links to
$1',
'spam_blanking' => 'All revisions contained links to $1, blanking',
'spam_deleting' => 'All revisions contained links to $1, deleting',
+'simpleantispam-label' => "Anti-spam check.
+Do '''NOT''' fill this in!",
# Info page
'pageinfo-header' => '-', # do not translate or duplicate this
message to other languages
diff --git a/maintenance/language/messages.inc
b/maintenance/language/messages.inc
index a94b6d5..a4fc922 100644
--- a/maintenance/language/messages.inc
+++ b/maintenance/language/messages.inc
@@ -2776,6 +2776,7 @@
'spam_reverting',
'spam_blanking',
'spam_deleting',
+ 'simpleantispam-label',
),
'info' => array(
'pageinfo-header',
--
To view, visit https://gerrit.wikimedia.org/r/91650
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I185b6a1e232299f496244a23f4bf0dc6ea22b6c9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_22
Gerrit-Owner: Bartosz DziewoĆski <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: MarkAHershberger <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits