Merge pull request #5 from jhamb/master

local dns cache for statistics plugin
This commit is contained in:
Garvin Hicking 2012-03-03 03:51:49 -08:00
commit e79176a622

View File

@ -840,6 +840,7 @@ class serendipity_event_statistics extends serendipity_event
<dd>
<table width="100%" cellpadding="0" cellspacing="0">
<?php
$resolvedHosts = array();
$i=1;
$color = "col2";
if (is_array($visitors_latest)) {
@ -857,7 +858,14 @@ class serendipity_event_statistics extends serendipity_event
echo "<td class = \"".$color."\">".wordwrap($row['browser'], 25, "<br />", 1)."</td>\n";
echo "<td class = \"".$color."\">";
if ($row['ip']){
echo wordwrap(gethostbyaddr($row['ip']), 25, "\n", 1);
$curIP = $row['ip'];
if (array_key_exists($curIP, $resolvedHosts)) {
$resolvedHost = $resolvedHosts[$curIP];
} else {
$resolvedHost = gethostbyaddr($curIP);
$resolvedHosts[$curIP] = $resolvedHost;
}
echo wordwrap($resolvedHost, 25, "\n", 1);
} else {
echo "--";
}