aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2010-07-23 10:35:55 +0200
committerAndreas Fischer <bantu@phpbb.com>2011-01-03 00:09:51 +0100
commitae43221399d8d73b38d1f76da5b9ea6b7a6fbb5e (patch)
treec3fa760e008815b853a9ebf038b66142e863a85f /phpBB/includes
parentfdb5c2c9902557f0a3a006c7f62f2465c98513a7 (diff)
downloadforums-ae43221399d8d73b38d1f76da5b9ea6b7a6fbb5e.tar
forums-ae43221399d8d73b38d1f76da5b9ea6b7a6fbb5e.tar.gz
forums-ae43221399d8d73b38d1f76da5b9ea6b7a6fbb5e.tar.bz2
forums-ae43221399d8d73b38d1f76da5b9ea6b7a6fbb5e.tar.xz
forums-ae43221399d8d73b38d1f76da5b9ea6b7a6fbb5e.zip
[ticket/9746] Adding wrapper functions for inet_ntop() and inet_pton().
PHPBB3-9746
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions.php33
1 files changed, 32 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index fad352f988..0b747058f7 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3312,7 +3312,7 @@ function phpbb_ip_normalise($address)
}
else if (preg_match(get_preg_expression('ipv6'), $address))
{
- $address = inet_ntop(inet_pton($address));
+ $address = phpbb_inet_ntop(phpbb_inet_pton($address));
if (strpos($address, '::ffff:') === 0)
{
@@ -3334,6 +3334,37 @@ function phpbb_ip_normalise($address)
}
/**
+* Wrapper for inet_ntop()
+*
+* Converts a packed internet address to a human readable representation
+* inet_ntop() is supported by PHP since 5.1.0, since 5.3.0 also on Windows.
+*
+* @param string $in_addr A 32bit IPv4, or 128bit IPv6 address.
+*
+* @return mixed false on failure,
+* string otherwise
+*/
+function phpbb_inet_ntop($in_addr)
+{
+ return inet_ntop($in_addr);
+}
+
+/**
+* Wrapper for inet_pton()
+*
+* Converts a human readable IP address to its packed in_addr representation
+* inet_pton() is supported by PHP since 5.1.0, since 5.3.0 also on Windows.
+*
+* @param string $address A human readable IPv4 or IPv6 address.
+*
+* @return string in_addr representation of the given address
+*/
+function phpbb_inet_pton($address)
+{
+ return inet_pton($address);
+}
+
+/**
* Wrapper for php's checkdnsrr function.
*
* @param string $host Fully-Qualified Domain Name