Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/90291
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
---
M includes/EditPage.php
M languages/messages/MessagesEn.php
M maintenance/language/messages.inc
3 files changed, 29 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/91/90291/1
diff --git a/includes/EditPage.php b/includes/EditPage.php
index 12cd4b3..3f638e6 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -1382,6 +1382,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 );
@@ -2191,6 +2209,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 e247442..aab9378 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -3855,6 +3855,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 ca3a4f5..a6f5364 100644
--- a/maintenance/language/messages.inc
+++ b/maintenance/language/messages.inc
@@ -2779,6 +2779,7 @@
'spam_reverting',
'spam_blanking',
'spam_deleting',
+ 'simpleantispam-label',
),
'info' => array(
'pageinfo-header',
--
To view, visit https://gerrit.wikimedia.org/r/90291
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I185b6a1e232299f496244a23f4bf0dc6ea22b6c9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits