Changeset 1085 in ExiteCMS for trunk/includes/geoip_include.php
- Timestamp:
- 11/08/07 00:06:27 (5 years ago)
- File:
-
- 1 edited
-
trunk/includes/geoip_include.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/geoip_include.php
r863 r1085 71 71 } 72 72 $_GeoIP_result['ip_addr'] = $ip_addr; 73 return $_GeoIP_result['ip_name'];73 return GeoIP_Code2Name($_GeoIP_result['ip_code']); 74 74 } 75 75 } 76 76 77 77 function GeoIP_Code2Name($ip_code) { 78 global $db_prefix ;78 global $db_prefix, $settings; 79 79 80 $result = dbquery("SELECT * FROM ".$db_prefix."GeoIP WHERE ip_code ='".$ip_code."' LIMIT 1"); 80 $result = dbquery("SELECT locales_value FROM ".$db_prefix."locales WHERE locales_locale = '".$settings['locale']."' AND locales_name = 'countrycode' AND locales_key = '".$ip_code."' LIMIT 1"); 81 if (!dbrows($result)) { 82 // no translated country names found, load the english set instead 83 $result = dbquery("SELECT locales_value FROM ".$db_prefix."locales WHERE locales_locale = 'English' AND locales_name = 'countrycode' AND locales_key = '".$ip_code."' LIMIT 1"); 84 } 81 85 if (dbrows($result) == 0) { 82 86 return ""; 83 87 } 84 88 $data = dbarray($result); 85 return $data[' ip_name'];89 return $data['locales_value']; 86 90 } 87 91 … … 113 117 $data = dbarray($result); 114 118 $geoip_flag = strtolower($data['ip_code']); 115 $geoip_name = $data['ip_name'];119 $geoip_name = GeoIP_Code2Name($data['ip_code']); 116 120 if (!is_file(PATH_IMAGES."flags/".$geoip_flag.".gif")) { 117 121 if ($tag) {
Note: See TracChangeset
for help on using the changeset viewer.
