function loadDefaults()
{
- global $wgLang ;
+ global $wgLang, $wgIP;
global $wgNamespacesToBeSearchedDefault;
$this->mId = $this->mNewtalk = 0;
- $this->mName = getenv( "REMOTE_ADDR" );
+ $this->mName = $wgIP;
$this->mEmail = "";
$this->mPassword = $this->mNewpassword = "";
$this->mRights = array();
/* private */ function getBlockedStatus()
{
- global $wgBadRanges, $wgBadUserAgents, $wgRangeBlockUser, $wgRangeBlockReason;
+ global $wgBadRanges, $wgBadUserAgents, $wgRangeBlockUser, $wgRangeBlockReason, $wgIP;
if ( -1 != $this->mBlockedby ) { return; }
array_key_exists( getenv( "HTTP_USER_AGENT" ), $wgBadUserAgents ) ) &&
is_array( $wgBadRanges ) )
{
- $iIp = ip2long( getenv( "REMOTE_ADDR" ) );
+ $iIp = ip2long( $wgIP );
foreach ( $wgBadRanges as $range ) {
$start = ip2long( $range[0] );
$end = ip2long( $range[1] );
# User/IP blocking
$block = new Block();
- if ( !$block->load( getenv( "REMOTE_ADDR" ), $this->mId ) ) {
- wfDebug( getenv( "REMOTE_ADDR" ) ." is not blocked\n" );
+ if ( !$block->load( $wgIP , $this->mId ) ) {
+ wfDebug( $wgIP ." is not blocked\n" );
$this->mBlockedby = 0;
return;
}
return $this->mBlockreason;
}
+ function SetupSession() {
+ global $wgSessionsInMemcached, $wgCookiePath, $wgCookieDomain;
+ global $wsUserID, $wsUserName, $wsUserPassword, $wsUploadFiles;
+ if( $wgSessionsInMemcached ) {
+ include_once( "MemcachedSessions.php" );
+ }
+ session_set_cookie_params( 0, $wgCookiePath, $wgCookieDomain );
+ session_cache_limiter( "private, must-revalidate" );
+ session_start();
+ session_register( "wsUserID" );
+ session_register( "wsUserName" );
+ session_register( "wsUserPassword" );
+ session_register( "wsUploadFiles" );
+ }
+
/* static */ function loadFromSession()
{
global $HTTP_COOKIE_VARS, $wsUserID, $wsUserName, $wsUserPassword;
function spreadBlock()
{
+ global $wgIP;
# If the (non-anonymous) user is blocked, this function will block any IP address
# that they successfully log on from.
$fname = "User::spreadBlock";
}
# Check if this IP address is already blocked
- $addr = getenv( "REMOTE_ADDR" );
- $ipblock = Block::newFromDB( $addr );
+ $ipblock = Block::newFromDB( $wgIP );
if ( $ipblock->isValid() ) {
# Just update the timestamp
$ipblock->updateTimestamp();
}
# Make a new block object with the desired properties
- wfDebug( "Autoblocking {$this->mUserName}@{$addr}\n" );
- $ipblock->mAddress = $addr;
+ wfDebug( "Autoblocking {$this->mUserName}@{$wgIP}\n" );
+ $ipblock->mAddress = $wgIP;
$ipblock->mUser = 0;
$ipblock->mBy = $userblock->mBy;
$ipblock->mReason = wfMsg( "autoblocker", $this->getName(), $userblock->mReason );