Lines Matching full:the

20      * The needle and haystack may be either IPv4 or IPv6.
29 * @param string $needle The IP to test, either IPv4 in dotted decimal
31 * @param string $haystack The CIDR range as an IP followed by a forward
32 * slash and the number of significant bits.
34 * @return bool Returns true if $needle is within the range specified
35 * by $haystack, false if it is outside the range.
46 // For an IPv4 address the top 96 bits must be zero.
82 * This splits 128 bit IP addresses into the upper and lower 64 bits, and
83 * also returns whether the IP given was IPv4 or IPv6.
85 * The returned array contains:
88 * - upper: The upper 64 bits of the IP.
89 * - lower: The lower 64 bits of the IP.
93 * @param string $ip The IPv4 or IPv6 address.
97 * @throws Exception Thrown if the IP is not valid.
135 * @param string $ip The address to test.
138 * @return bool Returns true if the IP matches, false if not.
143 // If it's not a range, compare the addresses directly.
144 // Addresses are converted to numbers because the same address may be
152 // The IP address was invalid.
158 * Given the IP address of a proxy server, determine whether it is
161 * This test is performed using the config value `trustedproxies`.
163 * @param string $ip The IP address of the proxy.
165 * @return bool Returns true if the IP is trusted as a proxy.
171 // If the configuration is empty then no proxies are trusted.
178 return true; // The given IP matches one of the trusted proxies.
182 return false; // none of the proxies matched
186 * Get the originating IP address and the address of every proxy that the
187 * request has passed through, according to the X-Forwarded-For header.
189 * To prevent spoofing of the client IP, every proxy listed in the
190 * X-Forwarded-For header must be trusted, as well as the TCP/IP endpoint
191 * from which the connection was received (i.e. the final proxy).
193 * If the header is not present or contains an untrusted proxy then
196 * The client IP is the first entry in the returned list, followed by the
212 // This is the address from which the header was received.
215 // Get the client address from the X-Forwarded-For header.
219 // The client address is the first item, remove it from the list.
222 // The remaining items are the proxies through which the X-Forwarded-For
223 // header has passed. The final proxy is the connection's remote address.
234 // Add the client address before the list of proxies.
239 * Return the IP of the client.
241 * The IP is sourced from, in order of preference:
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].
245 * - The TCP/IP connection remote address.
248 * The 'client_ip_header' config value should only be set if the header
249 * is being added by the web server, otherwise it may be spoofed by the client.
251 * The 'trustedproxy' setting must not allow any IP, otherwise the X-Forwarded-For
252 * may be spoofed by the client.
262 * Return the IP of the client and the proxies through which the connection has passed.
264 * The IPs are sourced from, in order of preference:
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].
268 * - The TCP/IP connection remote address.
281 // Use a custom IP header (e.g. CDN) if it is set by the configuration.
286 // Add the X-Forwarded-For addresses if all proxies are trusted.
289 // Add the TCP/IP connection endpoint.
307 * Get the host name of the server.
309 * The host name is sourced from, in order of preference:
311 * - The X-Forwarded-Host header if it exists and the proxies are trusted.
312 * - The HTTP_HOST header.
313 * - The SERVER_NAME header.
314 * - The system's host name.
316 * @return string Returns the host name of the server.
336 * Is the connection using the HTTPS protocol?
338 * Will use the X-Forwarded-Proto header if it exists and the proxies are trusted, otherwise
339 * the HTTPS environment is used.