Lines Matching full:if
33 * @return bool Returns true if $needle is within the range specified
34 * by $haystack, false if it is outside the range.
36 * @throws Exception Thrown if $needle is not a valid IP address.
37 * @throws Exception Thrown if $haystack is not a valid IP range.
46 if ($networkIp['version'] === 4) {
50 if ($maskLength > 128) {
84 * @throws Exception Thrown if the IP is not valid.
90 if ($binary === false) {
94 if (strlen($binary) === 4) {
110 * Determine if an IP address is equal to another IP or within an IP range.
116 * @return bool Returns true if the IP matches, false if not.
121 // If it's not a range, compare the addresses directly.
124 if (strpos($ipOrRange, '/') === false) {
143 * @return bool Returns true if the IP is trusted as a proxy.
149 // If the configuration is empty then no proxies are trusted.
150 if (empty($conf['trustedproxies'])) {
155 if (Ip::ipMatches($ip, $trusted)) {
171 * If the header is not present or contains an untrusted proxy then
186 if (empty($conf['trustedproxies']) || !$forwardedFor) {
207 if (!Ip::proxyIsTrusted($proxy)) {
221 * - The X-Real-IP header if $conf[realip] is true.
222 * - The X-Forwarded-For header if all the proxies are trusted by $conf[trustedproxy].
224 * - 0.0.0.0 if all else fails.
226 * The 'realip' config value should only be set to true if the X-Real-IP header
244 * - The X-Real-IP header if $conf[realip] is true.
245 * - The X-Forwarded-For header if all the proxies are trusted by $conf[trustedproxies].
247 * - 0.0.0.0 if all else fails.
259 // Use the X-Real-IP header if it is enabled by the configuration.
260 if (!empty($conf['realip']) && $INPUT->server->str('HTTP_X_REAL_IP')) {
264 // Add the X-Forwarded-For addresses if all proxies are trusted.
276 // Add a fallback if for some reason there were no valid IPs.
277 if (!$ips) {
289 * - The X-Forwarded-Host header if it exists and the proxies are trusted.
302 if ($INPUT->server->str('HTTP_X_FORWARDED_HOST') && self::proxyIsTrusted($remoteAddr)) {
316 * Will use the X-Forwarded-Proto header if it exists and the proxies are trusted, otherwise
327 if ($INPUT->server->has('HTTP_X_FORWARDED_PROTO') && self::proxyIsTrusted($remoteAddr)) {