Newer
Older
Digital_Repository / Repositories / statistics / includes / inc.fns.show_detail_country.es.php
<?php
/* NJS 2005-12-15
	Usage by country, totals.
*/

	include("../scripts/geoip.inc");
	
	$gi = new GeoIP;

	// Get detail given country
	$show_country = $_REQUEST["code"];
	$show_country_code = strtoupper($show_country);
	$show_country_name = '';
	
	/* 
		Check whether the country code is one of our local network
		"country codes".
	*/
	foreach ($GLOBALS["config_vars"]["local_networks"] as $ccode => $cname)
	{
		if ($show_country_code == $ccode) $show_country_name = $cname;
	}
	
	/* NJS 2007-01-31
		Check whether the country code is one of the known search engines.
	*/
	foreach ($GLOBALS["config_vars"]["search_engines"] as $ccode => $cname)
	{
		if ($show_country_code == $ccode) $show_country_name = $cname;
	}
	
	if ($show_country_name == '')
	{
		if (isset($gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$show_country_code]))
		{
			$show_country_num = $gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$show_country_code];
			$show_country_name = $gi->GEOIP_COUNTRY_NAMES[$show_country_num];
		}
		else
		{	
			$show_country_name = 'Unknown';
		}
	}

	// NJS 2006-06-14: Added archive name as argument.
	$GLOBALS["db_values"] = $sql->getArchiveCountCountry($GLOBALS["config_vars"]["archivename"],$_REQUEST["code"]);
?>