Display the text the spam regexp matched. Patch by akl.
authorArne Heizmann <timwi@users.mediawiki.org>
Fri, 13 Aug 2004 20:52:15 +0000 (20:52 +0000)
committerArne Heizmann <timwi@users.mediawiki.org>
Fri, 13 Aug 2004 20:52:15 +0000 (20:52 +0000)
includes/EditPage.php
languages/Language.php

index acbdc59..fc4503a 100644 (file)
@@ -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', "<nowiki>{$matches[0]}</nowiki>" ) );
+               }
                $wgOut->returnToMain( false );
        }
 
index e78bae0..ed6c53d 100644 (file)
@@ -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.",