Display the text the spam regexp matched. Patch by akl.

This commit is contained in:
Arne Heizmann 2004-08-13 20:52:15 +00:00
parent 117817252b
commit 01faac3d37
2 changed files with 8 additions and 4 deletions

View 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 );
}

View 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.",