class Block
{
/* public*/ var $mAddress, $mUser, $mBy, $mReason, $mTimestamp, $mAuto, $mId, $mExpiry;
- /* private */ var $mNetworkBits, $mIntegerAddr, $mForUpdate;
+ /* private */ var $mNetworkBits, $mIntegerAddr, $mForUpdate, $mByName;
function Block( $address = '', $user = '', $by = 0, $reason = '',
$timestamp = '' , $auto = 0, $expiry = '' )
}
$this->mForUpdate = false;
+ $this->mByName = false;
$this->initialiseRange();
}
function clear()
{
- $mAddress = $mReason = $mTimestamp = '';
- $mUser = $mBy = 0;
+ $this->mAddress = $this->mReason = $this->mTimestamp = '';
+ $this->mUser = $this->mBy = 0;
+ $this->mByName = false;
+
}
/**
$this->mExpiry = $row->ipb_expiry ?
wfTimestamp(TS_MW,$row->ipb_expiry) :
$row->ipb_expiry;
+ if ( isset( $row->user_name ) ) {
+ $this->mByName = $row->user_name;
+ } else {
+ $this->mByName = false;
+ }
$this->initialiseRange();
}
$options = '';
}
if ( $flags & EB_RANGE_ONLY ) {
- $cond = " WHERE ipb_address LIKE '%/%'";
+ $cond = " AND ipb_address LIKE '%/%'";
} else {
$cond = '';
}
- $ipblocks = $db->tableName( 'ipblocks' );
+ extract( $db->tableNames( 'ipblocks', 'user' ) );
- $sql = "SELECT * FROM $ipblocks $cond ORDER BY ipb_timestamp DESC $options";
+ $sql = "SELECT ipblocks.*,user_name FROM $ipblocks,$user " .
+ "WHERE user_id=ipb_by $cond ORDER BY ipb_timestamp DESC $options";
$res = $db->query( $sql, 'Block::enumBans' );
$num_rows = $db->numRows( $res );
return $this->mNetworkBits;
}
+ function getByName()
+ {
+ if ( $this->mByName === false ) {
+ $this->mByName = User::whoIs( $this->mBy );
+ }
+ return $this->mByName;
+ }
+
function forUpdate( $x = NULL ) {
return wfSetVar( $this->mForUpdate, $x );
}