Lines Matching full:the
19 * The needle and haystack may be either IPv4 or IPv6.
28 * @param string $needle The IP to test, either IPv4 in dotted decimal
30 * @param string $haystack The CIDR range as an IP followed by a forward
31 * slash and the number of significant bits.
33 * @return bool Returns true if $needle is within the range specified
34 * by $haystack, false if it is outside the range.
45 // For an IPv4 address the top 96 bits must be zero.
69 * This splits 128 bit IP addresses into the upper and lower 64 bits, and
70 * also returns whether the IP given was IPv4 or IPv6.
72 * The returned array contains:
75 * - upper: The upper 64 bits of the IP.
76 * - lower: The lower 64 bits of the IP.
80 * @param string $ip The IPv4 or IPv6 address.
84 * @throws Exception Thrown if the IP is not valid.
113 * @param string $ip The address to test.
116 * @return bool Returns true if the IP matches, false if not.
121 // If it's not a range, compare the addresses directly.
122 // Addresses are converted to numbers because the same address may be
130 // The IP address was invalid.
136 * Given the IP address of a proxy server, determine whether it is
139 * This test is performed using the config value `trustedproxies`.
141 * @param string $ip The IP address of the proxy.
143 * @return bool Returns true if the IP is trusted as a proxy.
149 // If the configuration is empty then no proxies are trusted.
156 return true; // The given IP matches one of the trusted proxies.
160 return false; // none of the proxies matched
164 * Get the originating IP address and the address of every proxy that the
165 * request has passed through, according to the X-Forwarded-For header.
167 * To prevent spoofing of the client IP, every proxy listed in the
168 * X-Forwarded-For header must be trusted, as well as the TCP/IP endpoint
169 * from which the connection was received (i.e. the final proxy).
171 * If the header is not present or contains an untrusted proxy then
174 * The client IP is the first entry in the returned list, followed by the
190 // This is the address from which the header was received.
193 // Get the client address from the X-Forwarded-For header.
197 // The client address is the first item, remove it from the list.
200 // The remaining items are the proxies through which the X-Forwarded-For
201 // header has passed. The final proxy is the connection's remote address.
212 // Add the client address before the list of proxies.
217 * Return the IP of the client.
219 * The IP is sourced from, in order of preference:
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].
223 * - The TCP/IP connection remote address.
226 * The 'realip' config value should only be set to true if the X-Real-IP header
227 * is being added by the web server, otherwise it may be spoofed by the client.
229 * The 'trustedproxy' setting must not allow any IP, otherwise the X-Forwarded-For
230 * may be spoofed by the client.
240 * Return the IP of the client and the proxies through which the connection has passed.
242 * The IPs are sourced from, in order of preference:
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].
246 * - The TCP/IP connection remote address.
259 // Use the X-Real-IP header if it is enabled by the configuration.
264 // Add the X-Forwarded-For addresses if all proxies are trusted.
267 // Add the TCP/IP connection endpoint.
285 * Get the host name of the server.
287 * The host name is sourced from, in order of preference:
289 * - The X-Forwarded-Host header if it exists and the proxies are trusted.
290 * - The HTTP_HOST header.
291 * - The SERVER_NAME header.
292 * - The system's host name.
294 * @return string Returns the host name of the server.
314 * Is the connection using the HTTPS protocol?
316 * Will use the X-Forwarded-Proto header if it exists and the proxies are trusted, otherwise
317 * the HTTPS environment is used.