From b2bc7b8db84b7b93b51d57f659d8b5ef27ab93d5 Mon Sep 17 00:00:00 2001 From: timdufrane Date: Fri, 28 Mar 2014 13:04:44 -0400 Subject: [PATCH 1/2] Shorthost should return full IP addresses Using filter_var to simply return the hostname if it is an IP address. --- includes/common.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/common.php b/includes/common.php index 2a7129db37..ad719a5e67 100644 --- a/includes/common.php +++ b/includes/common.php @@ -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; From c5c9da955d62a7ad9909a218070e5785c0acc100 Mon Sep 17 00:00:00 2001 From: timdufrane Date: Fri, 28 Mar 2014 13:05:39 -0400 Subject: [PATCH 2/2] Corrected comment character --- includes/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/common.php b/includes/common.php index ad719a5e67..387cb09ad8 100644 --- a/includes/common.php +++ b/includes/common.php @@ -32,7 +32,7 @@ function external_exec($command) function shorthost($hostname, $len=12) { - # IP addresses should not be shortened + // IP addresses should not be shortened if (filter_var($hostname, FILTER_VALIDATE_IP)) return $hostname;