* just slightly outta sync and soon corrected - safer to block slightly more that less.
* And it's cheaper to check slave first, then master if needed, than master always.
*/
- function getBlockedStatus( $bFromSlave = false ) {
- global $wgIP, $wgBlockCache, $wgProxyList;
+ function getBlockedStatus() {
+ global $wgIP, $wgBlockCache, $wgProxyList, $wgEnableSorbs, $bFromSlave;
if ( -1 != $this->mBlockedby ) { return; }
if ( $block->load( $wgIP , $this->mId ) ) {
$this->mBlockedby = $block->mBy;
$this->mBlockreason = $block->mReason;
+ $this->spreadBlock();
}
}
$this->mBlockreason = wfMsg( 'proxyblockreason' );
}
}
+
+ # DNSBL
+ if ( !$this->mBlockedby && $wgEnableSorbs ) {
+ if ( $this->inSorbsBlacklist( $wgIP ) ) {
+ $this->mBlockedby = wfMsg( 'sorbs' );
+ $this->mBlockreason = wfMsg( 'sorbsreason' );
+ }
+ }
+
}
+ function inSorbsBlacklist( $ip ) {
+ $fname = 'User::inSorbsBlacklist';
+ wfProfileIn( $fname );
+
+ $found = false;
+ $host = '';
+
+ if ( preg_match( '/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/', $ip, $m ) ) {
+ # Make hostname
+ for ( $i=4; $i>=1; $i-- ) {
+ $host .= $m[$i] . '.';
+ }
+ $host .= 'http.dnsbl.sorbs.net.';
+
+ # Send query
+ $ipList = gethostbynamel( $host );
+
+ if ( $ipList ) {
+ wfDebug( "Hostname $host is {$ipList[0]}, it's a proxy!\n" );
+ $found = true;
+ } else {
+ wfDebug( "Requested $host, not found.\n" );
+ }
+ }
+
+ wfProfileOut( $fname );
+ return $found;
+ }
+
/**
* Check if user is blocked
* @return bool True if blocked, false otherwise
else
wfDebug( "User::loadFromSession() unable to save to memcached\n" );
}
- $user->spreadBlock();
return $user;
}
return new User(); # Can't log in from session
// it will always be 0 when this function is called by parsercache.
$confstr = $this->getOption( 'math' );
- $confstr .= '!' . $this->getOption( 'highlightbroken' );
$confstr .= '!' . $this->getOption( 'stubthreshold' );
$confstr .= '!' . $this->getOption( 'editsection' );
- $confstr .= '!' . $this->getOption( 'editsectiononrightclick' );
- $confstr .= '!' . $this->getOption( 'showtoc' );
$confstr .= '!' . $this->getOption( 'date' );
$confstr .= '!' . $this->getOption( 'numberheadings' );
$confstr .= '!' . $this->getOption( 'language' );