Provide feedback to sysops that their edit triggered the spam filter. No feedback...
authorJens Frank <jeluf@users.mediawiki.org>
Sat, 29 May 2004 07:41:16 +0000 (07:41 +0000)
committerJens Frank <jeluf@users.mediawiki.org>
Sat, 29 May 2004 07:41:16 +0000 (07:41 +0000)
includes/EditPage.php
includes/OutputPage.php
languages/Language.php

index 3cb0df7..61729bd 100644 (file)
@@ -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( "<pre>".$wgSpamRegex."</pre>" );
+               $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()
index 60f5221..fd72280 100644 (file)
@@ -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;
index 9ccfd5a..c647f3a 100644 (file)
@@ -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:"
+
 
 );