$wgProxyScriptPath = "$IP/proxy_check.php";
$wgProxyMemcExpiry = 86400;
$wgProxyKey = 'W1svekXc5u6lZllTZOwnzEk1nbs';
+$wgProxyList = array(); # big list of banned IP addresses, in the keys not the values
# Client-side caching:
$wgCachePages = true; # Allow client-side caching of pages
# Text matching this regular expression will be recognised as spam
# See http://en.wikipedia.org/wiki/Regular_expression
$wgSpamRegex = false;
+# Similarly if this function returns true
+$wgFilterCallback = false;
# Go button goes straight to the edit screen if the article doesn't exist
$wgGoToEdit = false;
global $wgLang, $wgParser, $wgTitle;
global $wgAllowAnonymousMinor;
global $wgWhitelistEdit;
- global $wgSpamRegex;
+ global $wgSpamRegex, $wgFilterCallback;
$sk = $wgUser->getSkin();
$isConflict = false;
if ( "save" == $formtype ) {
# Check for spam
if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1 ) ) {
- if ( $wgUser->isSysop() ) {
- $this->spamPage();
- } else {
- sleep(10);
- $wgOut->redirect( $this->mTitle->getFullURL() );
- }
- return;
+ $this->spamPage();
+ return;
+ }
+ if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section ) ) {
+ # Error messages or other handling should be performed by the filter function
+ return;
}
if ( $wgUser->isBlocked() ) {
$this->blockedIPpage();
$reason = $wgUser->blockedFor();
$ip = $wgIP;
- $name = User::whoIs( $id );
+ if ( is_string( $id ) ) {
+ $name = $id;
+ } else {
+ $name = User::whoIs( $id );
+ }
$link = "[[" . $wgLang->getNsText( Namespace::getUser() ) .
":{$name}|{$name}]]";
function spamPage()
{
- global $wgOut, $wgSpamRegex;
+ global $wgOut;
$wgOut->setPageTitle( wfMsg( "spamprotectiontitle" ) );
$wgOut->setRobotpolicy( "noindex,nofollow" );
$wgOut->setArticleRelated( false );
$wgOut->addWikiText( wfMsg( "spamprotectiontext" ) );
- $wgOut->addWikiText( "<pre>".$wgSpamRegex."</pre>" );
$wgOut->returnToMain( false );
}
/* private */ function getBlockedStatus()
{
- global $wgIP, $wgBlockCache;
+ global $wgIP, $wgBlockCache, $wgProxyList;
if ( -1 != $this->mBlockedby ) { return; }
$this->mBlockreason = $block->mReason;
}
}
+
+ # Proxy blocking
+ if ( !$this->mBlockedby ) {
+ if ( array_key_exists( $wgIP, $wgProxyList ) ) {
+ $this->mBlockreason = wfMsg( 'proxyblockreason' );
+ $this->mBlockedby = "Proxy blocker";
+ }
+ }
}
function isBlocked()
{
$this->getBlockedStatus();
- if ( 0 == $this->mBlockedby ) { return false; }
+ if ( 0 === $this->mBlockedby ) { return false; }
return true;
}