Wikia code/includes/ProxyTools.php
< Wikia code | includes
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. The information shown below refers to the now unmaintained 1.16 MediaWiki release. The current stable release number is 1.43.0. |
--- D:\Programming\SVN\mediawiki\branches\REL1_16\phase3\includes\ProxyTools.php 2011-07-18 22:31:27.967773500 +0100
+++ D:\Programming\SVN\wikia\trunk\includes\ProxyTools.php 2011-08-17 15:28:46.330078100 +0100
@@ -11,6 +11,14 @@
* @return string
*/
function wfGetForwardedFor() {
+ // Wikia - start - @author: wladek
+ // FB#4215 User:Wikia edits being attributed to user's IP and useragent (again)
+ global $wgIP;
+ if ( $wgIP === '127.0.0.1' ) { // Used by User:Wikia
+ return null;
+ }
+ // Wikia - end
+
if( function_exists( 'apache_request_headers' ) ) {
// More reliable than $_SERVER due to case and -/_ folding
$set = array ();
@@ -111,6 +119,16 @@
}
}
+ if( preg_match( "/^10\.(?!10\.)(?!4\.)/", $ip ) && $ip != "10.8.2.159" &&
+ preg_match( "/Mozilla/", $_SERVER['HTTP_USER_AGENT'] ) ) {
+ if( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
+ $xff = "XFF=$_SERVER[HTTP_X_FORWARDED_FOR]";
+ } else {
+ $xff = "no XFF";
+ }
+ Wikia::log( __METHOD__, false, "Private IP $ip from $_SERVER[REMOTE_ADDR] with $xff ($_SERVER[HTTP_USER_AGENT])", true, true );
+ }
+
if( !$ip ) {
throw new MWException( "Unable to determine IP" );
}