You are here

function smart_ip_get_bin_source_filename in Smart IP 7.2

Same name and namespace in other branches
  1. 6.2 smart_ip.module \smart_ip_get_bin_source_filename()

Helper function for grabbing MaxMind GeoIP Legacy's binary archive filename.

3 calls to smart_ip_get_bin_source_filename()
smart_ip_admin_settings_validate in includes/smart_ip.admin.inc
smart_ip_get_location in ./smart_ip.module
Get the geo location from the IP address
smart_ip_maxmind_bin_db_update in includes/smart_ip.utility.inc
Download a Maxmind binary database and activate it for use

File

./smart_ip.module, line 1450
Determines country, geo location (longitude/latitude), region, city and postal code of the user, based on IP address

Code

function smart_ip_get_bin_source_filename($version, $edition) {
  if ($version == SMART_IP_MAXMIND_BIN_LITE_VERSION) {
    $file = SMART_IP_MAXMIND_BIN_LITE_DB_NAME;
    if ($edition == SMART_IP_MAXMIND_BIN_EDITION_COUNTRY) {
      $file = SMART_IP_MAXMIND_BIN_DB_NAME;
    }
  }
  else {

    // Filename of licensed country edition can be verified at:
    // http://updates.maxmind.com/app/update_getfilename?product_id=106
    $file = SMART_IP_MAXMIND_BIN_DB_NAME;
  }
  if ($edition == SMART_IP_MAXMIND_BIN_EDITION_CITY) {

    // Filename of licensed city edition can be verified at:
    // http://updates.maxmind.com/app/update_getfilename?product_id=132
    $file .= 'City';
  }
  return $file;
}