API - XOOPS 2.5.11 Beta 2
By monxoops.fr
ProxyCheck Class Reference

Public Member Functions

 __construct ()
 
 get ()
 

Data Fields

const PROXY_ENVIRONMENT_VARIABLE = 'proxy_env'
 
const FORWARDED = 'HTTP_FORWARDED'
 

Protected Member Functions

 splitOnComma ($header)
 
 getProxyEnvConfig ()
 
 getProxyHeader ()
 
 getFor ($header)
 
 getXForwardedFor ($ip)
 
 validateRoutableIP ($ip)
 

Protected Attributes

 $proxyHeaderName = false
 
 $proxyHeader = false
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

ProxyCheck constructor.

Member Function Documentation

◆ get()

get ( )

Get IP address from proxy header specified in $xoopsConfig['proxy_env']

Returns proxy revealed valid client address, or false if such address was not found.

Returns
string|false

◆ getFor()

getFor (   $header)
protected

Extract 'for' IP address in FORWARDED header as in RFC 7239

Parameters
string$header
Returns
string|false IP address, or false if invalid

◆ getProxyEnvConfig()

getProxyEnvConfig ( )
protected

get configured proxy environment variable

Returns
string|bool

◆ getProxyHeader()

getProxyHeader ( )
protected

get the configured proxy header

Returns
string|false

◆ getXForwardedFor()

getXForwardedFor (   $ip)
protected

Process an X-Forwarded-For or Client-IP style header

Parameters
string$ipexpected to be an IP address
Returns
string|false IP address, or false if invalid

◆ splitOnComma()

splitOnComma (   $header)
protected

Split comma delimited string

Parameters
string$header
Returns
string[]

◆ validateRoutableIP()

validateRoutableIP (   $ip)
protected

Validate that an IP address is routable

Parameters
string$ipan IP address to validate
Returns
string|false IP address or false if invalid

Field Documentation

◆ $proxyHeader

$proxyHeader = false
protected

◆ $proxyHeaderName

$proxyHeaderName = false
protected

◆ FORWARDED

const FORWARDED = 'HTTP_FORWARDED'

◆ PROXY_ENVIRONMENT_VARIABLE

const PROXY_ENVIRONMENT_VARIABLE = 'proxy_env'

The documentation for this class was generated from the following file: