geoIPFolders(); $foundcountry = $foundlitecity = $foundcity = false; $messages = array(); foreach ($files as $file) { $proposed_file = JPATH_SITE.DS.$file.'GeoIP.dat'; $country = is_file($proposed_file) && is_readable($proposed_file); $proposed_file = JPATH_SITE.DS.$file.'GeoLiteCity.dat'; $litecity = is_file($proposed_file) && is_readable($proposed_file); $proposed_file = JPATH_SITE.DS.$file.'GeoIPCity.dat'; $city = is_file($proposed_file) && is_readable($proposed_file); if ($country && !$foundcountry) { $age = intval((time() - filemtime(JPATH_SITE.DS.$file.'GeoIP.dat'))/(24*60*60)); if ($age > 30) $age = "" . JText::sprintf("File is %d days old. Please update your database from %s.", $age, "MaxMind") . ""; else $age = ""; $messages[] = $file . JText::_("GeoIP.dat found. GeoIP Country features enabled.") . " $age"; $foundcountry = true; } if ($litecity && !$foundlitecity) { $age = intval((time() - filemtime(JPATH_SITE.DS.$file.'GeoLiteCity.dat'))/(24*60*60)); if ($age > 30) $age = "" . JText::sprintf("File is %d days old. Please update your database from %s.", $age, "MaxMind") . ""; else $age = ""; $messages[] = $file . JText::_("GeoLiteCity.dat found. GeoIP City/region features enabled.") . " $age"; $foundlitecity = true; } if ($city && !$foundcity) { $age = intval((time() - filemtime(JPATH_SITE.DS.$file.'GeoIPCity.dat'))/(24*60*60)); if ($age > 30) $age = "" . JText::sprintf("File is %d days old. Please update your database from %s.", $age, "MaxMind") . ""; else $age = ""; $messages[] = $file . JText::_("GeoIPCity.dat found. GeoIP City/region features enabled.") . " $age"; $foundcity = true; } } if ($foundcountry || $foundlitecity || $foundcity) { return "".implode("
",$messages).'

' . JText::sprintf("Keep your GeoIP databases up to date from %s", 'MaxMind'); } return JText::_('GEOIP_DOWNLOAD_HELPTEXT'); } function geoIPFolders() { return array( "geoip".DS, "administrator".DS."components".DS."com_metatemplate".DS."geoip".DS, "GeoIP".DS, "geoIP".DS, "GEOIP".DS, "GEO IP".DS, "", "geo_ip".DS, "geo_IP".DS, "Geo_IP".DS ); } }