| Index: trunk/phase3/includes/User.php |
| — | — | @@ -99,7 +99,7 @@ |
| 100 | 100 | |
| 101 | 101 | /* private */ function getBlockedStatus() |
| 102 | 102 | { |
| 103 | | - global $wgIP, $wgBlockCache; |
| | 103 | + global $wgIP, $wgBlockCache, $wgProxyList; |
| 104 | 104 | |
| 105 | 105 | if ( -1 != $this->mBlockedby ) { return; } |
| 106 | 106 | |
| — | — | @@ -122,12 +122,20 @@ |
| 123 | 123 | $this->mBlockreason = $block->mReason; |
| 124 | 124 | } |
| 125 | 125 | } |
| | 126 | + |
| | 127 | + # Proxy blocking |
| | 128 | + if ( !$this->mBlockedby ) { |
| | 129 | + if ( array_key_exists( $wgIP, $wgProxyList ) ) { |
| | 130 | + $this->mBlockreason = wfMsg( 'proxyblockreason' ); |
| | 131 | + $this->mBlockedby = "Proxy blocker"; |
| | 132 | + } |
| | 133 | + } |
| 126 | 134 | } |
| 127 | 135 | |
| 128 | 136 | function isBlocked() |
| 129 | 137 | { |
| 130 | 138 | $this->getBlockedStatus(); |
| 131 | | - if ( 0 == $this->mBlockedby ) { return false; } |
| | 139 | + if ( 0 === $this->mBlockedby ) { return false; } |
| 132 | 140 | return true; |
| 133 | 141 | } |
| 134 | 142 | |
| Index: trunk/phase3/includes/DefaultSettings.php |
| — | — | @@ -181,6 +181,7 @@ |
| 182 | 182 | $wgProxyScriptPath = "$IP/proxy_check.php"; |
| 183 | 183 | $wgProxyMemcExpiry = 86400; |
| 184 | 184 | $wgProxyKey = 'W1svekXc5u6lZllTZOwnzEk1nbs'; |
| | 185 | +$wgProxyList = array(); # big list of banned IP addresses, in the keys not the values |
| 185 | 186 | |
| 186 | 187 | # Client-side caching: |
| 187 | 188 | $wgCachePages = true; # Allow client-side caching of pages |
| — | — | @@ -371,6 +372,8 @@ |
| 372 | 373 | # Text matching this regular expression will be recognised as spam |
| 373 | 374 | # See http://en.wikipedia.org/wiki/Regular_expression |
| 374 | 375 | $wgSpamRegex = false; |
| | 376 | +# Similarly if this function returns true |
| | 377 | +$wgFilterCallback = false; |
| 375 | 378 | |
| 376 | 379 | # Go button goes straight to the edit screen if the article doesn't exist |
| 377 | 380 | $wgGoToEdit = false; |
| Index: trunk/phase3/includes/EditPage.php |
| — | — | @@ -114,7 +114,7 @@ |
| 115 | 115 | global $wgLang, $wgParser, $wgTitle; |
| 116 | 116 | global $wgAllowAnonymousMinor; |
| 117 | 117 | global $wgWhitelistEdit; |
| 118 | | - global $wgSpamRegex; |
| | 118 | + global $wgSpamRegex, $wgFilterCallback; |
| 119 | 119 | |
| 120 | 120 | $sk = $wgUser->getSkin(); |
| 121 | 121 | $isConflict = false; |
| — | — | @@ -137,14 +137,13 @@ |
| 138 | 138 | if ( "save" == $formtype ) { |
| 139 | 139 | # Check for spam |
| 140 | 140 | if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1 ) ) { |
| 141 | | - if ( $wgUser->isSysop() ) { |
| 142 | | - $this->spamPage(); |
| 143 | | - } else { |
| 144 | | - sleep(10); |
| 145 | | - $wgOut->redirect( $this->mTitle->getFullURL() ); |
| 146 | | - } |
| 147 | | - return; |
| | 141 | + $this->spamPage(); |
| | 142 | + return; |
| 148 | 143 | } |
| | 144 | + if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section ) ) { |
| | 145 | + # Error messages or other handling should be performed by the filter function |
| | 146 | + return; |
| | 147 | + } |
| 149 | 148 | if ( $wgUser->isBlocked() ) { |
| 150 | 149 | $this->blockedIPpage(); |
| 151 | 150 | return; |
| — | — | @@ -467,7 +466,11 @@ |
| 468 | 467 | $reason = $wgUser->blockedFor(); |
| 469 | 468 | $ip = $wgIP; |
| 470 | 469 | |
| 471 | | - $name = User::whoIs( $id ); |
| | 470 | + if ( is_string( $id ) ) { |
| | 471 | + $name = $id; |
| | 472 | + } else { |
| | 473 | + $name = User::whoIs( $id ); |
| | 474 | + } |
| 472 | 475 | $link = "[[" . $wgLang->getNsText( Namespace::getUser() ) . |
| 473 | 476 | ":{$name}|{$name}]]"; |
| 474 | 477 | |
| — | — | @@ -491,13 +494,12 @@ |
| 492 | 495 | |
| 493 | 496 | function spamPage() |
| 494 | 497 | { |
| 495 | | - global $wgOut, $wgSpamRegex; |
| | 498 | + global $wgOut; |
| 496 | 499 | $wgOut->setPageTitle( wfMsg( "spamprotectiontitle" ) ); |
| 497 | 500 | $wgOut->setRobotpolicy( "noindex,nofollow" ); |
| 498 | 501 | $wgOut->setArticleRelated( false ); |
| 499 | 502 | |
| 500 | 503 | $wgOut->addWikiText( wfMsg( "spamprotectiontext" ) ); |
| 501 | | - $wgOut->addWikiText( "<pre>".$wgSpamRegex."</pre>" ); |
| 502 | 504 | $wgOut->returnToMain( false ); |
| 503 | 505 | } |
| 504 | 506 | |