MediaWiki  REL1_22
ProxyTools.php File Reference

Functions for dealing with proxies. More...

Go to the source code of this file.

Functions

 wfGetAgent ()
 Returns the browser/OS data from the request header Note: headers are spoofable.
 wfGetForwardedFor ()
 Extracts the XFF string from the request header Note: headers are spoofable.
 wfGetIP ()
 Work out the IP address based on various globals For trusted proxies, use the XFF client IP (first of the chain)
 wfIsConfiguredProxy ($ip)
 Checks if an IP matches a proxy we've configured.
 wfIsTrustedProxy ($ip)
 Checks if an IP is a trusted proxy provider.

Detailed Description

Functions for dealing with proxies.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Definition in file ProxyTools.php.


Function Documentation

Returns the browser/OS data from the request header Note: headers are spoofable.

Deprecated:
in 1.18; use $wgRequest->getHeader( 'User-Agent' ) instead.
Returns:
string

Definition at line 43 of file ProxyTools.php.

References global, and wfDeprecated().

Extracts the XFF string from the request header Note: headers are spoofable.

Deprecated:
in 1.19; use $wgRequest->getHeader( 'X-Forwarded-For' ) instead.
Returns:
string

Definition at line 30 of file ProxyTools.php.

References global, and wfDeprecated().

wfGetIP ( )

Work out the IP address based on various globals For trusted proxies, use the XFF client IP (first of the chain)

Deprecated:
in 1.19; call $wgRequest->getIP() directly.
Returns:
string

Definition at line 56 of file ProxyTools.php.

References global, and wfDeprecated().

Checks if an IP matches a proxy we've configured.

Parameters:
$ipString
Returns:
bool

Definition at line 81 of file ProxyTools.php.

References global.

Referenced by wfIsTrustedProxy().

wfIsTrustedProxy ( ip)

Checks if an IP is a trusted proxy provider.

Useful to tell if X-Forwarded-For data is possibly bogus. Squid cache servers for the site are whitelisted.

Parameters:
$ipString
Returns:
bool

Definition at line 70 of file ProxyTools.php.

References array(), wfIsConfiguredProxy(), and wfRunHooks().

Referenced by Block\getBlocksForIPList().