Spam regex feature
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 4 May 2004 12:49:41 +0000 (12:49 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 4 May 2004 12:49:41 +0000 (12:49 +0000)
includes/DefaultSettings.php
includes/EditPage.php

index ec7ce9f..cf47423 100644 (file)
@@ -353,4 +353,6 @@ $wgImportSources = array();
 # For credit to authors. Set to zero to hide attribution block.
 $wgMaxCredits = 0;
 
+# Text matching this regex will be recognised as spam
+$wgSpamRegex   = false; 
 ?>
index f41ce5c..de75631 100644 (file)
@@ -108,6 +108,7 @@ class EditPage {
                global $wgLang, $wgParser, $wgTitle;
            global $wgAllowAnonymousMinor;
            global $wgWhitelistEdit;
+               global $wgSpamRegex;
 
                $sk = $wgUser->getSkin();
                $isConflict = false;
@@ -126,6 +127,12 @@ class EditPage {
                # in the back door with a hand-edited submission URL.
 
                if ( "save" == $formtype ) {
+                       # Check for spam
+                       if ( $wgSpamRegex && preg_match( $wgSpamRegex, $wpTextbox1 ) ) {
+                                       sleep(10);
+                                       $wgOut->redirect( $this->mTitle->getFullURL() );
+                                       return;
+                       }
                        if ( $wgUser->isBlocked() ) {
                                $this->blockedIPpage();
                                return;