From 72dd9a7e4d25041ed5ab1e29163dae58e14a8c0e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 24 Apr 2007 19:00:45 +0000 Subject: [PATCH] *Remove wfGetLastIPfromXFF() from r19889 --- includes/ProxyTools.php | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index eff02682e8..f72b640f5a 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -31,35 +31,6 @@ function wfGetForwardedFor() { } } -/** - * @todo FUCKING DOCUMENT THIS FUCKING FUNCTION - */ -function wfGetLastIPfromXFF( $xff ) { - if ( $xff ) { - // Avoid annoyingly long xff hacks - $xff = substr( $xff, 0, 255 ); - // Look for the last IP, assuming they are separated by commas or spaces - $n = ( strrpos($xff, ',') ) ? strrpos($xff, ',') : strrpos($xff, ' '); - if ( $n !== false ) { - $last = trim( substr( $xff, $n + 1 ) ); - // Make sure it is an IP - $m = preg_match('#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $last); - $n = preg_match('#^:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7}$#', $last); - if ( $m > 0 ) - $xff_ip = $last; - else if ( $n > 0 ) - $xff_ip = $last; - else - $xff_ip = null; - } else { - $xff_ip = null; - } - } else { - $xff_ip = null; - } - return $xff_ip; -} - /** * Returns the browser/OS data from the request header * Note: headers are spoofable -- 2.20.1