From 01faac3d376d363b090266a0cbeb559a73c3ab4b Mon Sep 17 00:00:00 2001 From: Arne Heizmann Date: Fri, 13 Aug 2004 20:52:15 +0000 Subject: [PATCH] Display the text the spam regexp matched. Patch by akl. --- includes/EditPage.php | 11 +++++++---- languages/Language.php | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index acbdc598a8..fc4503a7f5 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -130,8 +130,8 @@ class EditPage { if ( "save" == $formtype ) { # Check for spam - if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1 ) ) { - $this->spamPage(); + if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1, $matches ) ) { + $this->spamPage ( $matches ); return; } if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section ) ) { @@ -486,14 +486,17 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . $wgOut->returnToMain( false ); } - function spamPage() + function spamPage ( $matches = array() ) { global $wgOut; $wgOut->setPageTitle( wfMsg( "spamprotectiontitle" ) ); $wgOut->setRobotpolicy( "noindex,nofollow" ); $wgOut->setArticleRelated( false ); - $wgOut->addWikiText( wfMsg( "spamprotectiontext" ) ); + $wgOut->addWikiText( wfMsg( 'spamprotectiontext' ) ); + if ( isset ( $matches[0] ) ) { + $wgOut->addWikiText( wfMsg( 'spamprotectionmatch', "{$matches[0]}" ) ); + } $wgOut->returnToMain( false ); } diff --git a/languages/Language.php b/languages/Language.php index e78bae00e5..ed6c53d34a 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1420,6 +1420,7 @@ amusement.', 'spamprotectiontitle' => 'Spam protection filter', 'spamprotectiontext' => 'The page you wanted to save was blocked by the spam filter. This is probably caused by a link to an external site.', +'spamprotectionmatch' => 'The following text is what triggered our spam filter: $1', 'subcategorycount' => "There are $1 subcategories to this category.", 'subcategorycount1' => "There is $1 subcategorie to this category.", 'categoryarticlecount' => "There are $1 articles in this category.", -- 2.20.1