From 3a9b95d4c1568de701c65fcb8123c51c8b79ea7e Mon Sep 17 00:00:00 2001 From: Jens Frank Date: Sat, 29 May 2004 07:41:16 +0000 Subject: [PATCH] Provide feedback to sysops that their edit triggered the spam filter. No feedback to anons, would someone miss the point. --- includes/EditPage.php | 20 ++++++++++++++++++-- includes/OutputPage.php | 3 +++ languages/Language.php | 7 ++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 3cb0df75af..61729bde87 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -131,8 +131,12 @@ class EditPage { if ( "save" == $formtype ) { # Check for spam if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1 ) ) { - sleep(10); - $wgOut->redirect( $this->mTitle->getFullURL() ); + if ( $wgUser->isSysop() ) { + $this->spamPage(); + } else { + sleep(10); + $wgOut->redirect( $this->mTitle->getFullURL() ); + } return; } if ( $wgUser->isBlocked() ) { @@ -471,6 +475,18 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . $wgOut->returnToMain( false ); } + function spamPage() + { + global $wgOut, $wgSpamRegex; + $wgOut->setPageTitle( wfMsg( "spamprotectiontitle" ) ); + $wgOut->setRobotpolicy( "noindex,nofollow" ); + $wgOut->setArticleRelated( false ); + + $wgOut->addWikiText( wfMsg( "spamprotectiontext" ) ); + $wgOut->addWikiText( "
".$wgSpamRegex."
" ); + $wgOut->returnToMain( false ); + } + # Forks processes to scan the originating IP for an open proxy server # MemCached can be used to skip IPs that have already been scanned function proxyCheck() diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 60f522130e..fd7228045e 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -586,6 +586,9 @@ class OutputPage { $this->fatalError( wfMsg( "filenotfound", $name ) ); } + // return from error messages or notes + // auto: automatically redirect the user after 10 seconds + // returnto: page title to return to. Default is Main Page. function returnToMain( $auto = true, $returnto = NULL ) { global $wgUser, $wgOut, $wgRequest; diff --git a/languages/Language.php b/languages/Language.php index 9ccfd5a419..c647f3a1e0 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1547,7 +1547,12 @@ amusement.", "lastmodifiedby" => "This page was last modified $1 by $2.", "and" => "and", "othercontribs" => "Based on work by $1.", -"siteusers" => "$wgSitename user(s) $1" +"siteusers" => "$wgSitename user(s) $1", +"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. + +You might want to check the following regular expression for patterns that are currently blocked:" + ); -- 2.20.1