Index: trunk/phase3/includes/ProxyTools.php |
— | — | @@ -10,8 +10,13 @@ |
11 | 11 | |
12 | 12 | /** Work out the IP address based on various globals */ |
13 | 13 | function wfGetIP() { |
14 | | - global $wgSquidServers, $wgSquidServersNoPurge; |
| 14 | + global $wgSquidServers, $wgSquidServersNoPurge, $wgIP; |
15 | 15 | |
| 16 | + # Return cached result |
| 17 | + if ( !empty( $wgIP ) ) { |
| 18 | + return $wgIP; |
| 19 | + } |
| 20 | + |
16 | 21 | /* collect the originating ips */ |
17 | 22 | # Client connecting to this webserver |
18 | 23 | if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { |
— | — | @@ -45,6 +50,8 @@ |
46 | 51 | } |
47 | 52 | } |
48 | 53 | |
| 54 | + wfDebug( "IP: $ip\n" ); |
| 55 | + $wgIP = $ip; |
49 | 56 | return $ip; |
50 | 57 | } |
51 | 58 | |
— | — | @@ -89,5 +96,51 @@ |
90 | 97 | } |
91 | 98 | return true; |
92 | 99 | } |
| 100 | + |
| 101 | +/** |
| 102 | + * Forks processes to scan the originating IP for an open proxy server |
| 103 | + * MemCached can be used to skip IPs that have already been scanned |
| 104 | + */ |
| 105 | +function wfProxyCheck() { |
| 106 | + global $wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath; |
| 107 | + global $wgUseMemCached, $wgMemc, $wgDBname, $wgProxyMemcExpiry; |
| 108 | + |
| 109 | + if ( !$wgBlockOpenProxies ) { |
| 110 | + return; |
| 111 | + } |
| 112 | + |
| 113 | + $ip = wfGetIP(); |
93 | 114 | |
| 115 | + # Get MemCached key |
| 116 | + $skip = false; |
| 117 | + if ( $wgUseMemCached ) { |
| 118 | + $mcKey = "$wgDBname:proxy:ip:$ip"; |
| 119 | + $mcValue = $wgMemc->get( $mcKey ); |
| 120 | + if ( $mcValue ) { |
| 121 | + $skip = true; |
| 122 | + } |
| 123 | + } |
| 124 | + |
| 125 | + # Fork the processes |
| 126 | + if ( !$skip ) { |
| 127 | + $title = Title::makeTitle( NS_SPECIAL, 'Blockme' ); |
| 128 | + $iphash = md5( $ip . $wgProxyKey ); |
| 129 | + $url = $title->getFullURL( 'ip='.$iphash ); |
| 130 | + |
| 131 | + foreach ( $wgProxyPorts as $port ) { |
| 132 | + $params = implode( ' ', array( |
| 133 | + escapeshellarg( $wgProxyScriptPath ), |
| 134 | + escapeshellarg( $ip ), |
| 135 | + escapeshellarg( $port ), |
| 136 | + escapeshellarg( $url ) |
| 137 | + )); |
| 138 | + exec( "php $params &>/dev/null &" ); |
| 139 | + } |
| 140 | + # Set MemCached key |
| 141 | + if ( $wgUseMemCached ) { |
| 142 | + $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry ); |
| 143 | + } |
| 144 | + } |
| 145 | +} |
| 146 | + |
94 | 147 | ?> |
Index: trunk/phase3/includes/User.php |
— | — | @@ -273,12 +273,12 @@ |
274 | 274 | $fname = 'User::loadDefaults' . $n; |
275 | 275 | wfProfileIn( $fname ); |
276 | 276 | |
277 | | - global $wgContLang, $wgIP, $wgDBname; |
| 277 | + global $wgContLang, $wgDBname; |
278 | 278 | global $wgNamespacesToBeSearchedDefault; |
279 | 279 | |
280 | 280 | $this->mId = 0; |
281 | 281 | $this->mNewtalk = -1; |
282 | | - $this->mName = $wgIP; |
| 282 | + $this->mName = false; |
283 | 283 | $this->mRealName = $this->mEmail = ''; |
284 | 284 | $this->mEmailAuthenticated = null; |
285 | 285 | $this->mPassword = $this->mNewpassword = ''; |
— | — | @@ -360,7 +360,7 @@ |
361 | 361 | * And it's cheaper to check slave first, then master if needed, than master always. |
362 | 362 | */ |
363 | 363 | function getBlockedStatus( $bFromSlave = true ) { |
364 | | - global $wgIP, $wgBlockCache, $wgProxyList, $wgEnableSorbs, $wgProxyWhitelist; |
| 364 | + global $wgBlockCache, $wgProxyList, $wgEnableSorbs, $wgProxyWhitelist; |
365 | 365 | |
366 | 366 | if ( -1 != $this->mBlockedby ) { |
367 | 367 | wfDebug( "User::getBlockedStatus: already loaded.\n" ); |
— | — | @@ -372,11 +372,12 @@ |
373 | 373 | wfDebug( "$fname: checking...\n" ); |
374 | 374 | |
375 | 375 | $this->mBlockedby = 0; |
| 376 | + $ip = wfGetIP(); |
376 | 377 | |
377 | 378 | # User/IP blocking |
378 | 379 | $block = new Block(); |
379 | 380 | $block->forUpdate( $bFromSlave ); |
380 | | - if ( $block->load( $wgIP , $this->mId ) ) { |
| 381 | + if ( $block->load( $ip , $this->mId ) ) { |
381 | 382 | wfDebug( "$fname: Found block.\n" ); |
382 | 383 | $this->mBlockedby = $block->mBy; |
383 | 384 | $this->mBlockreason = $block->mReason; |
— | — | @@ -391,12 +392,12 @@ |
392 | 393 | if ( !$this->mBlockedby ) { |
393 | 394 | # Check first against slave, and optionally from master. |
394 | 395 | wfDebug( "$fname: Checking range blocks\n" ); |
395 | | - $block = $wgBlockCache->get( $wgIP, true ); |
| 396 | + $block = $wgBlockCache->get( $ip, true ); |
396 | 397 | if ( !$block && !$bFromSlave ) |
397 | 398 | { |
398 | 399 | # Not blocked: check against master, to make sure. |
399 | 400 | $wgBlockCache->clearLocal( ); |
400 | | - $block = $wgBlockCache->get( $wgIP, false ); |
| 401 | + $block = $wgBlockCache->get( $ip, false ); |
401 | 402 | } |
402 | 403 | if ( $block !== false ) { |
403 | 404 | $this->mBlockedby = $block->mBy; |
— | — | @@ -405,17 +406,17 @@ |
406 | 407 | } |
407 | 408 | |
408 | 409 | # Proxy blocking |
409 | | - if ( !$this->isSysop() && !in_array( $wgIP, $wgProxyWhitelist ) ) { |
| 410 | + if ( !$this->isSysop() && !in_array( $ip, $wgProxyWhitelist ) ) { |
410 | 411 | |
411 | 412 | # Local list |
412 | | - if ( array_key_exists( $wgIP, $wgProxyList ) ) { |
| 413 | + if ( array_key_exists( $ip, $wgProxyList ) ) { |
413 | 414 | $this->mBlockedby = wfMsg( 'proxyblocker' ); |
414 | 415 | $this->mBlockreason = wfMsg( 'proxyblockreason' ); |
415 | 416 | } |
416 | 417 | |
417 | 418 | # DNSBL |
418 | 419 | if ( !$this->mBlockedby && $wgEnableSorbs && !$this->getID() ) { |
419 | | - if ( $this->inSorbsBlacklist( $wgIP ) ) { |
| 420 | + if ( $this->inSorbsBlacklist( $ip ) ) { |
420 | 421 | $this->mBlockedby = wfMsg( 'sorbs' ); |
421 | 422 | $this->mBlockreason = wfMsg( 'sorbsreason' ); |
422 | 423 | } |
— | — | @@ -485,13 +486,14 @@ |
486 | 487 | return false; |
487 | 488 | } |
488 | 489 | |
489 | | - global $wgMemc, $wgIP, $wgDBname, $wgRateLimitLog; |
| 490 | + global $wgMemc, $wgDBname, $wgRateLimitLog; |
490 | 491 | $fname = 'User::pingLimiter'; |
491 | 492 | wfProfileIn( $fname ); |
492 | 493 | |
493 | 494 | $limits = $wgRateLimits[$action]; |
494 | 495 | $keys = array(); |
495 | 496 | $id = $this->getId(); |
| 497 | + $ip = wfGetIP(); |
496 | 498 | |
497 | 499 | if( isset( $limits['anon'] ) && $id == 0 ) { |
498 | 500 | $keys["$wgDBname:limiter:$action:anon"] = $limits['anon']; |
— | — | @@ -505,9 +507,9 @@ |
506 | 508 | $keys["$wgDBname:limiter:$action:user:$id"] = $limits['newbie']; |
507 | 509 | } |
508 | 510 | if( isset( $limits['ip'] ) ) { |
509 | | - $keys["mediawiki:limiter:$action:ip:$wgIP"] = $limits['ip']; |
| 511 | + $keys["mediawiki:limiter:$action:ip:$ip"] = $limits['ip']; |
510 | 512 | } |
511 | | - if( isset( $limits['subnet'] ) && preg_match( '/^(\d+\.\d+\.\d+)\.\d+$/', $wgIP, $matches ) ) { |
| 513 | + if( isset( $limits['subnet'] ) && preg_match( '/^(\d+\.\d+\.\d+)\.\d+$/', $ip, $matches ) ) { |
512 | 514 | $subnet = $matches[1]; |
513 | 515 | $keys["mediawiki:limiter:$action:subnet:$subnet"] = $limits['subnet']; |
514 | 516 | } |
— | — | @@ -607,7 +609,7 @@ |
608 | 610 | } |
609 | 611 | |
610 | 612 | /** |
611 | | - * Read datas from session |
| 613 | + * Create a new user object using data from session |
612 | 614 | * @static |
613 | 615 | */ |
614 | 616 | function loadFromSession() { |
— | — | @@ -734,6 +736,9 @@ |
735 | 737 | |
736 | 738 | function getName() { |
737 | 739 | $this->loadFromDatabase(); |
| 740 | + if ( $this->mName === false ) { |
| 741 | + $this->mName = wfGetIP(); |
| 742 | + } |
738 | 743 | return $this->mName; |
739 | 744 | } |
740 | 745 | |
— | — | @@ -765,7 +770,7 @@ |
766 | 771 | # entire User object stored in there. |
767 | 772 | if( !$this->mId ) { |
768 | 773 | global $wgDBname, $wgMemc; |
769 | | - $key = "$wgDBname:newtalk:ip:{$this->mName}"; |
| 774 | + $key = "$wgDBname:newtalk:ip:" . $this->getName(); |
770 | 775 | $newtalk = $wgMemc->get( $key ); |
771 | 776 | if( is_integer( $newtalk ) ) { |
772 | 777 | $this->mNewtalk = $newtalk ? 1 : 0; |
— | — | @@ -794,7 +799,7 @@ |
795 | 800 | } |
796 | 801 | $dbr->freeResult( $res ); |
797 | 802 | } else { |
798 | | - $res = $dbr->select( 'user_newtalk', 1, array( 'user_ip' => $this->mName ), $fname ); |
| 803 | + $res = $dbr->select( 'user_newtalk', 1, array( 'user_ip' => $this->getName() ), $fname ); |
799 | 804 | $this->mNewtalk = $dbr->numRows( $res ) > 0 ? 1 : 0; |
800 | 805 | $dbr->freeResult( $res ); |
801 | 806 | } |
— | — | @@ -1250,8 +1255,8 @@ |
1251 | 1256 | $_SESSION['wsUserID'] = $this->mId; |
1252 | 1257 | setcookie( $wgDBname.'UserID', $this->mId, $exp, $wgCookiePath, $wgCookieDomain ); |
1253 | 1258 | |
1254 | | - $_SESSION['wsUserName'] = $this->mName; |
1255 | | - setcookie( $wgDBname.'UserName', $this->mName, $exp, $wgCookiePath, $wgCookieDomain ); |
| 1259 | + $_SESSION['wsUserName'] = $this->getName(); |
| 1260 | + setcookie( $wgDBname.'UserName', $this->getName(), $exp, $wgCookiePath, $wgCookieDomain ); |
1256 | 1261 | |
1257 | 1262 | $_SESSION['wsToken'] = $this->mToken; |
1258 | 1263 | if ( 1 == $this->getOption( 'rememberpassword' ) ) { |
— | — | @@ -1266,7 +1271,7 @@ |
1267 | 1272 | * It will clean the session cookie |
1268 | 1273 | */ |
1269 | 1274 | function logout() { |
1270 | | - global $wgCookiePath, $wgCookieDomain, $wgDBname, $wgIP; |
| 1275 | + global $wgCookiePath, $wgCookieDomain, $wgDBname; |
1271 | 1276 | $this->loadDefaults(); |
1272 | 1277 | $this->setLoaded( true ); |
1273 | 1278 | |
— | — | @@ -1337,7 +1342,7 @@ |
1338 | 1343 | if( !$this->mId ) { |
1339 | 1344 | # Anon users have a separate memcache space for newtalk |
1340 | 1345 | # since they don't store their own info. Trim... |
1341 | | - $wgMemc->delete( "$wgDBname:newtalk:ip:{$this->mName}" ); |
| 1346 | + $wgMemc->delete( "$wgDBname:newtalk:ip:" . $this->getName() ); |
1342 | 1347 | } |
1343 | 1348 | } |
1344 | 1349 | } else { |
— | — | @@ -1347,8 +1352,8 @@ |
1348 | 1353 | $key = false; |
1349 | 1354 | } else { |
1350 | 1355 | $field = 'user_ip'; |
1351 | | - $value = $this->mName; |
1352 | | - $key = "$wgDBname:newtalk:ip:$this->mName"; |
| 1356 | + $value = $this->getName(); |
| 1357 | + $key = "$wgDBname:newtalk:ip:$value"; |
1353 | 1358 | } |
1354 | 1359 | |
1355 | 1360 | $dbr =& wfGetDB( DB_SLAVE ); |
— | — | @@ -1390,7 +1395,7 @@ |
1391 | 1396 | $fname = 'User::idForName'; |
1392 | 1397 | |
1393 | 1398 | $gotid = 0; |
1394 | | - $s = trim( $this->mName ); |
| 1399 | + $s = trim( $this->getName() ); |
1395 | 1400 | if ( 0 == strcmp( '', $s ) ) return 0; |
1396 | 1401 | |
1397 | 1402 | $dbr =& wfGetDB( DB_SLAVE ); |
— | — | @@ -1425,7 +1430,6 @@ |
1426 | 1431 | } |
1427 | 1432 | |
1428 | 1433 | function spreadBlock() { |
1429 | | - global $wgIP; |
1430 | 1434 | # If the (non-anonymous) user is blocked, this function will block any IP address |
1431 | 1435 | # that they successfully log on from. |
1432 | 1436 | $fname = 'User::spreadBlock'; |
— | — | @@ -1441,7 +1445,7 @@ |
1442 | 1446 | } |
1443 | 1447 | |
1444 | 1448 | # Check if this IP address is already blocked |
1445 | | - $ipblock = Block::newFromDB( $wgIP ); |
| 1449 | + $ipblock = Block::newFromDB( wfGetIP() ); |
1446 | 1450 | if ( $ipblock->isValid() ) { |
1447 | 1451 | # Just update the timestamp |
1448 | 1452 | $ipblock->updateTimestamp(); |
— | — | @@ -1449,8 +1453,8 @@ |
1450 | 1454 | } |
1451 | 1455 | |
1452 | 1456 | # Make a new block object with the desired properties |
1453 | | - wfDebug( "Autoblocking {$this->mName}@{$wgIP}\n" ); |
1454 | | - $ipblock->mAddress = $wgIP; |
| 1457 | + wfDebug( "Autoblocking {$this->mName}@" . wfGetIP() . "\n" ); |
| 1458 | + $ipblock->mAddress = wfGetIP(); |
1455 | 1459 | $ipblock->mUser = 0; |
1456 | 1460 | $ipblock->mBy = $userblock->mBy; |
1457 | 1461 | $ipblock->mReason = wfMsg( 'autoblocker', $this->getName(), $userblock->mReason ); |
— | — | @@ -1511,7 +1515,7 @@ |
1512 | 1516 | * @access public |
1513 | 1517 | */ |
1514 | 1518 | function getUserPage() { |
1515 | | - return Title::makeTitle( NS_USER, $this->mName ); |
| 1519 | + return Title::makeTitle( NS_USER, $this->getName() ); |
1516 | 1520 | } |
1517 | 1521 | |
1518 | 1522 | /** |
— | — | @@ -1656,11 +1660,11 @@ |
1657 | 1661 | * @return mixed True on success, a WikiError object on failure. |
1658 | 1662 | */ |
1659 | 1663 | function sendConfirmationMail() { |
1660 | | - global $wgIP, $wgContLang; |
| 1664 | + global $wgContLang; |
1661 | 1665 | $url = $this->confirmationTokenUrl( $expiration ); |
1662 | 1666 | return $this->sendMail( wfMsg( 'confirmemail_subject' ), |
1663 | 1667 | wfMsg( 'confirmemail_body', |
1664 | | - $wgIP, |
| 1668 | + wfGetIP(), |
1665 | 1669 | $this->getName(), |
1666 | 1670 | $url, |
1667 | 1671 | $wgContLang->timeanddate( $expiration, false ) ) ); |
Index: trunk/phase3/includes/RecentChange.php |
— | — | @@ -194,8 +194,10 @@ |
195 | 195 | } |
196 | 196 | |
197 | 197 | if ( !$ip ) { |
198 | | - global $wgIP; |
199 | | - $ip = empty( $wgIP ) ? '' : $wgIP; |
| 198 | + $ip = wfGetIP(); |
| 199 | + if ( !$ip ) { |
| 200 | + $ip = ''; |
| 201 | + } |
200 | 202 | } |
201 | 203 | |
202 | 204 | $rc = new RecentChange; |
— | — | @@ -235,8 +237,10 @@ |
236 | 238 | $ip='', $size = 0, $newId = 0 ) |
237 | 239 | { |
238 | 240 | if ( !$ip ) { |
239 | | - global $wgIP; |
240 | | - $ip = empty( $wgIP ) ? '' : $wgIP; |
| 241 | + $ip = wfGetIP(); |
| 242 | + if ( !$ip ) { |
| 243 | + $ip = ''; |
| 244 | + } |
241 | 245 | } |
242 | 246 | if ( $bot == 'default' ) { |
243 | 247 | $bot = $user->isBot(); |
— | — | @@ -277,9 +281,12 @@ |
278 | 282 | /*static*/ function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false ) |
279 | 283 | { |
280 | 284 | if ( !$ip ) { |
281 | | - global $wgIP; |
282 | | - $ip = empty( $wgIP ) ? '' : $wgIP; |
| 285 | + $ip = wfGetIP(); |
| 286 | + if ( !$ip ) { |
| 287 | + $ip = ''; |
| 288 | + } |
283 | 289 | } |
| 290 | + |
284 | 291 | $rc = new RecentChange; |
285 | 292 | $rc->mAttribs = array( |
286 | 293 | 'rc_timestamp' => $timestamp, |
— | — | @@ -323,9 +330,12 @@ |
324 | 331 | /*static*/ function notifyLog( $timestamp, &$title, &$user, $comment, $ip='' ) |
325 | 332 | { |
326 | 333 | if ( !$ip ) { |
327 | | - global $wgIP; |
328 | | - $ip = empty( $wgIP ) ? '' : $wgIP; |
| 334 | + $ip = wfGetIP(); |
| 335 | + if ( !$ip ) { |
| 336 | + $ip = ''; |
| 337 | + } |
329 | 338 | } |
| 339 | + |
330 | 340 | $rc = new RecentChange; |
331 | 341 | $rc->mAttribs = array( |
332 | 342 | 'rc_timestamp' => $timestamp, |
Index: trunk/phase3/includes/SpecialUserlogin.php |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | function addNewAccountInternal() { |
164 | 164 | global $wgUser, $wgOut; |
165 | 165 | global $wgUseLatin1, $wgEnableSorbs, $wgProxyWhitelist; |
166 | | - global $wgMemc, $wgAccountCreationThrottle, $wgDBname, $wgIP; |
| 166 | + global $wgMemc, $wgAccountCreationThrottle, $wgDBname; |
167 | 167 | global $wgAuth; |
168 | 168 | |
169 | 169 | // If the user passes an invalid domain, something is fishy |
— | — | @@ -189,10 +189,11 @@ |
190 | 190 | return false; |
191 | 191 | } |
192 | 192 | |
193 | | - if ( $wgEnableSorbs && !in_array( $wgIP, $wgProxyWhitelist ) && |
194 | | - $wgUser->inSorbsBlacklist( $wgIP ) ) |
| 193 | + $ip = wfGetIP(); |
| 194 | + if ( $wgEnableSorbs && !in_array( $ip, $wgProxyWhitelist ) && |
| 195 | + $wgUser->inSorbsBlacklist( $ip ) ) |
195 | 196 | { |
196 | | - $this->mainLoginForm( wfMsg( 'sorbs_create_account_reason' ) . ' (' . htmlspecialchars( $wgIP ) . ')' ); |
| 197 | + $this->mainLoginForm( wfMsg( 'sorbs_create_account_reason' ) . ' (' . htmlspecialchars( $ip ) . ')' ); |
197 | 198 | return; |
198 | 199 | } |
199 | 200 | |
— | — | @@ -225,7 +226,7 @@ |
226 | 227 | } |
227 | 228 | |
228 | 229 | if ( $wgAccountCreationThrottle ) { |
229 | | - $key = $wgDBname.':acctcreate:ip:'.$wgIP; |
| 230 | + $key = $wgDBname.':acctcreate:ip:'.$ip; |
230 | 231 | $value = $wgMemc->incr( $key ); |
231 | 232 | if ( !$value ) { |
232 | 233 | $wgMemc->set( $key, 1, 86400 ); |
— | — | @@ -376,7 +377,7 @@ |
377 | 378 | * @access private |
378 | 379 | */ |
379 | 380 | function mailPasswordInternal( $u ) { |
380 | | - global $wgPasswordSender, $wgDBname, $wgIP; |
| 381 | + global $wgPasswordSender, $wgDBname; |
381 | 382 | global $wgCookiePath, $wgCookieDomain; |
382 | 383 | |
383 | 384 | if ( '' == $u->getEmail() ) { |
— | — | @@ -390,7 +391,7 @@ |
391 | 392 | |
392 | 393 | $u->saveSettings(); |
393 | 394 | |
394 | | - $ip = $wgIP; |
| 395 | + $ip = wfGetIP(); |
395 | 396 | if ( '' == $ip ) { $ip = '(Unknown)'; } |
396 | 397 | |
397 | 398 | $m = wfMsg( 'passwordremindertext', $ip, $u->getName(), $np ); |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -80,7 +80,7 @@ |
81 | 81 | wfProfileOut( $fname.'-includes' ); |
82 | 82 | wfProfileIn( $fname.'-misc1' ); |
83 | 83 | |
84 | | -$wgIP = wfGetIP(); |
| 84 | +$wgIP = false; # Load on demand |
85 | 85 | $wgRequest = new WebRequest(); |
86 | 86 | |
87 | 87 | # Useful debug output |
Index: trunk/phase3/includes/SpecialBlockme.php |
— | — | @@ -10,9 +10,11 @@ |
11 | 11 | */ |
12 | 12 | function wfSpecialBlockme() |
13 | 13 | { |
14 | | - global $wgIP, $wgBlockOpenProxies, $wgOut, $wgProxyKey; |
| 14 | + global $wgBlockOpenProxies, $wgOut, $wgProxyKey; |
15 | 15 | |
16 | | - if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $wgIP . $wgProxyKey ) ) { |
| 16 | + $ip = wfGetIP(); |
| 17 | + |
| 18 | + if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $ip . $wgProxyKey ) ) { |
17 | 19 | $wgOut->addWikiText( wfMsg( "disabled" ) ); |
18 | 20 | return; |
19 | 21 | } |
— | — | @@ -31,7 +33,7 @@ |
32 | 34 | $id = $u->getID(); |
33 | 35 | } |
34 | 36 | |
35 | | - $block = new Block( $wgIP, 0, $id, $reason, wfTimestampNow() ); |
| 37 | + $block = new Block( $ip, 0, $id, $reason, wfTimestampNow() ); |
36 | 38 | $block->insert(); |
37 | 39 | |
38 | 40 | $wgOut->addWikiText( $success ); |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -587,7 +587,7 @@ |
588 | 588 | $this->edittime = $this->mArticle->getTimestamp(); |
589 | 589 | $this->textbox1 = $this->mArticle->getContent( true ); |
590 | 590 | $this->summary = ''; |
591 | | - $this->proxyCheck(); |
| 591 | + wfProxyCheck(); |
592 | 592 | } |
593 | 593 | |
594 | 594 | /** |
— | — | @@ -1015,7 +1015,7 @@ |
1016 | 1016 | * @todo document |
1017 | 1017 | */ |
1018 | 1018 | function blockedIPpage() { |
1019 | | - global $wgOut, $wgUser, $wgContLang, $wgIP; |
| 1019 | + global $wgOut, $wgUser, $wgContLang; |
1020 | 1020 | |
1021 | 1021 | $wgOut->setPageTitle( wfMsg( 'blockedtitle' ) ); |
1022 | 1022 | $wgOut->setRobotpolicy( 'noindex,nofollow' ); |
— | — | @@ -1023,7 +1023,7 @@ |
1024 | 1024 | |
1025 | 1025 | $id = $wgUser->blockedBy(); |
1026 | 1026 | $reason = $wgUser->blockedFor(); |
1027 | | - $ip = $wgIP; |
| 1027 | + $ip = wfGetIP(); |
1028 | 1028 | |
1029 | 1029 | if ( is_numeric( $id ) ) { |
1030 | 1030 | $name = User::whoIs( $id ); |
— | — | @@ -1069,50 +1069,6 @@ |
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | /** |
1073 | | - * Forks processes to scan the originating IP for an open proxy server |
1074 | | - * MemCached can be used to skip IPs that have already been scanned |
1075 | | - */ |
1076 | | - function proxyCheck() { |
1077 | | - global $wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath; |
1078 | | - global $wgIP, $wgUseMemCached, $wgMemc, $wgDBname, $wgProxyMemcExpiry; |
1079 | | - |
1080 | | - if ( !$wgBlockOpenProxies ) { |
1081 | | - return; |
1082 | | - } |
1083 | | - |
1084 | | - # Get MemCached key |
1085 | | - $skip = false; |
1086 | | - if ( $wgUseMemCached ) { |
1087 | | - $mcKey = $wgDBname.':proxy:ip:'.$wgIP; |
1088 | | - $mcValue = $wgMemc->get( $mcKey ); |
1089 | | - if ( $mcValue ) { |
1090 | | - $skip = true; |
1091 | | - } |
1092 | | - } |
1093 | | - |
1094 | | - # Fork the processes |
1095 | | - if ( !$skip ) { |
1096 | | - $title = Title::makeTitle( NS_SPECIAL, 'Blockme' ); |
1097 | | - $iphash = md5( $wgIP . $wgProxyKey ); |
1098 | | - $url = $title->getFullURL( 'ip='.$iphash ); |
1099 | | - |
1100 | | - foreach ( $wgProxyPorts as $port ) { |
1101 | | - $params = implode( ' ', array( |
1102 | | - escapeshellarg( $wgProxyScriptPath ), |
1103 | | - escapeshellarg( $wgIP ), |
1104 | | - escapeshellarg( $port ), |
1105 | | - escapeshellarg( $url ) |
1106 | | - )); |
1107 | | - exec( "php $params &>/dev/null &" ); |
1108 | | - } |
1109 | | - # Set MemCached key |
1110 | | - if ( $wgUseMemCached ) { |
1111 | | - $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry ); |
1112 | | - } |
1113 | | - } |
1114 | | - } |
1115 | | - |
1116 | | - /** |
1117 | 1073 | * @access private |
1118 | 1074 | * @todo document |
1119 | 1075 | */ |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -646,7 +646,7 @@ |
647 | 647 | } |
648 | 648 | |
649 | 649 | function nameAndLogin() { |
650 | | - global $wgUser, $wgTitle, $wgLang, $wgContLang, $wgShowIPinHeader, $wgIP; |
| 650 | + global $wgUser, $wgTitle, $wgLang, $wgContLang, $wgShowIPinHeader; |
651 | 651 | |
652 | 652 | $li = $wgContLang->specialPage( 'Userlogin' ); |
653 | 653 | $lo = $wgContLang->specialPage( 'Userlogout' ); |
— | — | @@ -654,7 +654,7 @@ |
655 | 655 | $s = ''; |
656 | 656 | if ( $wgUser->isAnon() ) { |
657 | 657 | if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) { |
658 | | - $n = $wgIP; |
| 658 | + $n = wfGetIP(); |
659 | 659 | |
660 | 660 | $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), |
661 | 661 | $wgLang->getNsText( NS_TALK ) ); |
Index: trunk/phase3/includes/SpecialVersion.php |
— | — | @@ -139,9 +139,8 @@ |
140 | 140 | } |
141 | 141 | |
142 | 142 | function IPInfo() { |
143 | | - global $wgIP; |
144 | 143 | |
145 | | - $ip = str_replace( '--', ' - - ', htmlspecialchars( $wgIP ) ); |
| 144 | + $ip = str_replace( '--', ' - - ', htmlspecialchars( wfGetIP() ) ); |
146 | 145 | return "<!-- visited from $ip -->\n"; |
147 | 146 | } |
148 | 147 | } |
Index: trunk/extensions/LatexDoc/README |
— | — | @@ -47,8 +47,8 @@ |
48 | 48 | COPYING |
49 | 49 | ------- |
50 | 50 | |
51 | | -This extension is copyright Tim Starling (2005). You may choose one of the |
52 | | -following two licenses, at your option: |
| 51 | +LatexDoc.php and this documentation were written by Tim Starling, (c) 2005. You |
| 52 | +may choose one of the following two licenses, at your option: |
53 | 53 | |
54 | 54 | 1) The GNU General Public License |
55 | 55 | |