From 4a8a90ffa6b698feed7ecf4ec235ffb1ad853d4b Mon Sep 17 00:00:00 2001 From: jim-p Date: Thu, 23 Feb 2012 10:53:14 -0500 Subject: Allow users to enter a port number when adding a remote syslog server. --- etc/inc/util.inc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'etc/inc/util.inc') diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 726446b..420ca0e 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -485,6 +485,18 @@ function is_ipaddrv4($ipaddr) { return false; } +function is_ipaddrwithport($ipport) { + $parts = explode(":", $ipport); + $port = array_pop($parts); + if (count($parts) == 1) { + return is_ipaddrv4($parts[0]) && is_port($port); + } elseif (count($parts) > 1) { + return is_ipaddrv6(implode(":", $parts)) && is_port($port); + } else { + return false; + } +} + /* returns true if $ipaddr is a valid dotted IPv4 address or an alias thereof */ function is_ipaddroralias($ipaddr) { global $config; -- cgit v1.1