Shorthost should return full IP addresses

Using filter_var to simply return the hostname if it is an IP address.
This commit is contained in:
timdufrane
2014-03-28 13:04:44 -04:00
parent d81d5328ea
commit b2bc7b8db8

View File

@ -32,6 +32,10 @@ function external_exec($command)
function shorthost($hostname, $len=12)
{
# IP addresses should not be shortened
if (filter_var($hostname, FILTER_VALIDATE_IP))
return $hostname;
$parts = explode(".", $hostname);
$shorthost = $parts[0];
$i = 1;