Lines Matching full:if
34 * @return bool Returns true if $needle is within the range specified
35 * by $haystack, false if it is outside the range.
37 * @throws Exception Thrown if $needle is not a valid IP address.
38 * @throws Exception Thrown if $haystack is not a valid IP range.
47 if ($networkIp['version'] === 4) {
51 if ($maskLength > 128) {
61 if (PHP_INT_SIZE == 4) {
97 * @throws Exception Thrown if the IP is not valid.
103 if ($binary === false) {
107 if (strlen($binary) === 4) {
110 if (PHP_INT_SIZE == 4) {
121 if (PHP_INT_SIZE == 4) { // 32-bit
132 * Determine if an IP address is equal to another IP or within an IP range.
138 * @return bool Returns true if the IP matches, false if not.
143 // If it's not a range, compare the addresses directly.
146 if (!str_contains($ipOrRange, '/')) {
165 * @return bool Returns true if the IP is trusted as a proxy.
171 // If the configuration is empty then no proxies are trusted.
172 if (empty($conf['trustedproxies'])) {
177 if (Ip::ipMatches($ip, $trusted)) {
193 * If the header is not present or contains an untrusted proxy then
208 if (empty($conf['trustedproxies']) || !$forwardedFor) {
229 if (!Ip::proxyIsTrusted($proxy)) {
243 * - The custom IP header if $conf[client_ip_header] is set.
244 * - The X-Forwarded-For header if all the proxies are trusted by $conf[trustedproxy].
246 * - 0.0.0.0 if all else fails.
248 * The 'client_ip_header' config value should only be set if the header
266 * - The custom IP header if $conf[client_ip_header] is set.
267 * - The X-Forwarded-For header if all the proxies are trusted by $conf[trustedproxies].
269 * - 0.0.0.0 if all else fails.
281 // Use a custom IP header (e.g. CDN) if it is set by the configuration.
282 …if (!empty($conf['client_ip_header']) && $INPUT->server->str('HTTP_' . $conf['client_ip_header']))…
286 // Add the X-Forwarded-For addresses if all proxies are trusted.
298 // Add a fallback if for some reason there were no valid IPs.
299 if (!$ips) {
311 * - The X-Forwarded-Host header if it exists and the proxies are trusted.
324 if ($INPUT->server->str('HTTP_X_FORWARDED_HOST') && self::proxyIsTrusted($remoteAddr)) {
338 * Will use the X-Forwarded-Proto header if it exists and the proxies are trusted, otherwise
349 if ($INPUT->server->has('HTTP_X_FORWARDED_PROTO') && self::proxyIsTrusted($remoteAddr)) {