diff options
author | Robert Nelson <robertn@the-nelsons.org> | 2013-11-07 00:34:39 -0800 |
---|---|---|
committer | Robert Nelson <robertn@the-nelsons.org> | 2013-11-07 00:34:39 -0800 |
commit | 79f5aebe25a2a0c5c198898643580842a6251b79 (patch) | |
tree | 474a29fe928cf8a50c8b320d57a2cc7f4fb2da69 /usr/local/www/diag_dns.php | |
parent | 6ff71328e7d63731d8e08e433af4611427cd64eb (diff) | |
download | pfsense-79f5aebe25a2a0c5c198898643580842a6251b79.zip pfsense-79f5aebe25a2a0c5c198898643580842a6251b79.tar.gz |
Simplify the code.
No need to worry about the second column, we only need to pad the first one.
Diffstat (limited to 'usr/local/www/diag_dns.php')
-rw-r--r-- | usr/local/www/diag_dns.php | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/usr/local/www/diag_dns.php b/usr/local/www/diag_dns.php index 497b566..900f562 100644 --- a/usr/local/www/diag_dns.php +++ b/usr/local/www/diag_dns.php @@ -150,8 +150,7 @@ if( ($_POST['host']) && ($_POST['dialog_output']) ) { } function display_host_results ($address,$hostname,$dns_speeds) { - $map_lengths = function($element) { return array(strlen($element[0]), strlen($element[1])); }; - $map_column0 = function($element) { return $element[0]; }; + $map_lengths = function($element) { return strlen($element[0]); }; echo gettext("IP Address") . ": {$address} \n"; echo gettext("Host Name") . ": {$hostname} \n"; @@ -163,10 +162,9 @@ function display_host_results ($address,$hostname,$dns_speeds) { $text_table[] = array(trim($qt['dns_server']), trim($qt['query_time'])); } } - $length_table = array_map($map_lengths, $text_table); - $col0_padlength = max(array_map($map_column0, $length_table)); + $col0_padlength = max(array_map($map_lengths, $text_table)) + 4; foreach ($text_table as $text_row) { - echo str_pad($text_row[0], $col0_padlength + 4) . $text_row[1] . "\n"; + echo str_pad($text_row[0], $col0_padlength) . $text_row[1] . "\n"; } } |