You are here

function getdirections_smart_ip in Get Directions 7.3

Same name and namespace in other branches
  1. 7.2 getdirections.module \getdirections_smart_ip()

Return value

Returns location array

1 string reference to 'getdirections_smart_ip'
getdirections_menu in ./getdirections.module
Implement hook_menu().

File

./getdirections.module, line 1990
Fetches google map directions.

Code

function getdirections_smart_ip() {
  if (module_exists('smart_ip')) {
    global $user;
    $location = FALSE;
    if ($user->uid > 0 && isset($user->data['geoip_location'])) {
      $location = $user->data['geoip_location'];
    }
    elseif (isset($_SESSION['smart_ip']['location'])) {
      $location = $_SESSION['smart_ip']['location'];
    }
    drupal_json_output($location);
  }
  exit;
}