Changeset 1085 in ExiteCMS for trunk/includes/geoip_include.php


Ignore:
Timestamp:
11/08/07 00:06:27 (5 years ago)
Author:
hverton
Message:

added the site location country selection (also the explicit country for user_id 1)
added some missing country codes to rev01079.php
birthday in the profile is displayed using the date format and months names of the locale set
forced maintenance mode if uninstalled updates are detected
updated the dbsetup_include.php file to reflect the latest database changes
removed the country name from the GeoIP table, now uses the country name from the locales table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/geoip_include.php

    r863 r1085  
    7171        } 
    7272        $_GeoIP_result['ip_addr'] = $ip_addr; 
    73         return $_GeoIP_result['ip_name']; 
     73        return GeoIP_Code2Name($_GeoIP_result['ip_code']); 
    7474    } 
    7575} 
    7676 
    7777function GeoIP_Code2Name($ip_code) { 
    78     global $db_prefix; 
     78    global $db_prefix, $settings; 
    7979 
    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    } 
    8185    if (dbrows($result) == 0) { 
    8286        return ""; 
    8387    } 
    8488    $data = dbarray($result); 
    85     return $data['ip_name']; 
     89    return $data['locales_value']; 
    8690} 
    8791 
     
    113117    $data = dbarray($result); 
    114118    $geoip_flag = strtolower($data['ip_code']); 
    115     $geoip_name = $data['ip_name']; 
     119    $geoip_name = GeoIP_Code2Name($data['ip_code']); 
    116120    if (!is_file(PATH_IMAGES."flags/".$geoip_flag.".gif")) { 
    117121        if ($tag) { 
Note: See TracChangeset for help on using the changeset viewer.