r20376 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20375‎ | r20376 | r20377 >
Date:21:56, 12 March 2007
Author:aaron
Status:old
Tags:
Comment:
*Get range blocks to consider "anononly" while I'm at it
Modified paths:
  • /trunk/phase3/includes/Block.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Block.php
@@ -147,7 +147,7 @@
148148 }
149149
150150 # Try range block
151 - if ( $this->loadRange( $address, $killExpired, $user == 0 ) ) {
 151+ if ( $this->loadRange( $address, $killExpired, $user ) ) {
152152 if ( $user && $this->mAnonOnly ) {
153153 $this->clear();
154154 return false;
@@ -212,7 +212,7 @@
213213 * Search the database for any range blocks matching the given address, and
214214 * load the row if one is found.
215215 */
216 - function loadRange( $address, $killExpired = true )
 216+ function loadRange( $address, $killExpired = true, $user = 0 )
217217 {
218218 $iaddr = IP::toHex( $address );
219219 if ( $iaddr === false ) {
@@ -231,6 +231,10 @@
232232 "ipb_range_start <= '$iaddr'",
233233 "ipb_range_end >= '$iaddr'"
234234 );
 235+
 236+ if ( $user ) {
 237+ $conds['ipb_anon_only'] = 0;
 238+ }
235239
236240 $res = $db->resultObject( $db->select( 'ipblocks', '*', $conds, __METHOD__, $options ) );
237241 $success = $this->loadFromResult( $res, $killExpired );