From b872622410c5725139c3b3abc6772567e6a51bcd Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 4 May 2004 12:49:41 +0000 Subject: [PATCH] Spam regex feature --- includes/DefaultSettings.php | 2 ++ includes/EditPage.php | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index ec7ce9f0a4..cf47423c8e 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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; ?> diff --git a/includes/EditPage.php b/includes/EditPage.php index f41ce5c78a..de75631c01 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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; -- 2.20.1