Index: trunk/phase3/includes/ProxyTools.php |
— | — | @@ -32,35 +32,6 @@ |
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | | - * @todo FUCKING DOCUMENT THIS FUCKING FUNCTION |
37 | | - */ |
38 | | -function wfGetLastIPfromXFF( $xff ) { |
39 | | - if ( $xff ) { |
40 | | - // Avoid annoyingly long xff hacks |
41 | | - $xff = substr( $xff, 0, 255 ); |
42 | | - // Look for the last IP, assuming they are separated by commas or spaces |
43 | | - $n = ( strrpos($xff, ',') ) ? strrpos($xff, ',') : strrpos($xff, ' '); |
44 | | - if ( $n !== false ) { |
45 | | - $last = trim( substr( $xff, $n + 1 ) ); |
46 | | - // Make sure it is an IP |
47 | | - $m = preg_match('#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $last); |
48 | | - $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); |
49 | | - if ( $m > 0 ) |
50 | | - $xff_ip = $last; |
51 | | - else if ( $n > 0 ) |
52 | | - $xff_ip = $last; |
53 | | - else |
54 | | - $xff_ip = null; |
55 | | - } else { |
56 | | - $xff_ip = null; |
57 | | - } |
58 | | - } else { |
59 | | - $xff_ip = null; |
60 | | - } |
61 | | - return $xff_ip; |
62 | | -} |
63 | | - |
64 | | -/** |
65 | 36 | * Returns the browser/OS data from the request header |
66 | 37 | * Note: headers are spoofable |
67 | 38 | * @return string |