You are here

function smart_ip_get_geoip2_bin_source_filename in Smart IP 7.2

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

Helper function for grabbing MaxMind GeoIP2's binary archive filename.

3 calls to smart_ip_get_geoip2_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 1473
Determines country, geo location (longitude/latitude), region, city and postal code of the user, based on IP address

Code

function smart_ip_get_geoip2_bin_source_filename($version = SMART_IP_MAXMIND_BIN_LITE_VERSION, $edition = SMART_IP_MAXMIND_GEOIP2_BIN_EDITION_CITY) {
  if ($version == SMART_IP_MAXMIND_BIN_LICENSED_VERSION && $edition == SMART_IP_MAXMIND_GEOIP2_BIN_EDITION_COUNTRY) {
    $file = SMART_IP_MAXMIND_GEOIP2_FILENAME_LINCENSED_COUNTRY;
  }
  elseif ($version == SMART_IP_MAXMIND_BIN_LICENSED_VERSION && $edition == SMART_IP_MAXMIND_GEOIP2_BIN_EDITION_CITY) {
    $file = SMART_IP_MAXMIND_GEOIP2_FILENAME_LINCENSED_CITY;
  }
  elseif ($version == SMART_IP_MAXMIND_BIN_LITE_VERSION && $edition == SMART_IP_MAXMIND_GEOIP2_BIN_EDITION_COUNTRY) {
    $file = SMART_IP_MAXMIND_GEOIP2_FILENAME_LITE_COUNTRY;
  }
  else {
    $file = SMART_IP_MAXMIND_GEOIP2_FILENAME_LITE_CITY;
  }
  return $file;
}