r3737 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r3736‎ | r3737 | r3738 >
Date:07:41, 29 May 2004
Author:jeluf
Status:old
Tags:
Comment:
Provide feedback to sysops that their edit triggered the spam filter. No feedback to anons, would someone miss the point.
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -131,8 +131,12 @@
132132 if ( "save" == $formtype ) {
133133 # Check for spam
134134 if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1 ) ) {
135 - sleep(10);
136 - $wgOut->redirect( $this->mTitle->getFullURL() );
 135+ if ( $wgUser->isSysop() ) {
 136+ $this->spamPage();
 137+ } else {
 138+ sleep(10);
 139+ $wgOut->redirect( $this->mTitle->getFullURL() );
 140+ }
137141 return;
138142 }
139143 if ( $wgUser->isBlocked() ) {
@@ -471,6 +475,18 @@
472476 $wgOut->returnToMain( false );
473477 }
474478
 479+ function spamPage()
 480+ {
 481+ global $wgOut, $wgSpamRegex;
 482+ $wgOut->setPageTitle( wfMsg( "spamprotectiontitle" ) );
 483+ $wgOut->setRobotpolicy( "noindex,nofollow" );
 484+ $wgOut->setArticleRelated( false );
 485+
 486+ $wgOut->addWikiText( wfMsg( "spamprotectiontext" ) );
 487+ $wgOut->addWikiText( "<pre>".$wgSpamRegex."</pre>" );
 488+ $wgOut->returnToMain( false );
 489+ }
 490+
475491 # Forks processes to scan the originating IP for an open proxy server
476492 # MemCached can be used to skip IPs that have already been scanned
477493 function proxyCheck()
Index: trunk/phase3/includes/OutputPage.php
@@ -586,6 +586,9 @@
587587 $this->fatalError( wfMsg( "filenotfound", $name ) );
588588 }
589589
 590+ // return from error messages or notes
 591+ // auto: automatically redirect the user after 10 seconds
 592+ // returnto: page title to return to. Default is Main Page.
590593 function returnToMain( $auto = true, $returnto = NULL )
591594 {
592595 global $wgUser, $wgOut, $wgRequest;
Index: trunk/phase3/languages/Language.php
@@ -1547,8 +1547,13 @@
15481548 "lastmodifiedby" => "This page was last modified $1 by $2.",
15491549 "and" => "and",
15501550 "othercontribs" => "Based on work by $1.",
1551 -"siteusers" => "$wgSitename user(s) $1"
 1551+"siteusers" => "$wgSitename user(s) $1",
 1552+"spamprotectiontitle" => "Spam protection filter",
 1553+"spamprotectiontext" => "The page you wanted to save was blocked by the spam filter. This is probably caused by a link to an external site.
15521554
 1555+You might want to check the following regular expression for patterns that are currently blocked:"
 1556+
 1557+
15531558 );
15541559
15551560 #--------------------------------------------------------------------------

Status & tagging log