You are here

function ip_geoloc_same_path in IP Geolocation Views & Maps 8

Same name and namespace in other branches
  1. 7 ip_geoloc.module \ip_geoloc_same_path()

Returns true if the previous page was reloaded.

File

./ip_geoloc.module, line 820
IPGV&M is a mapping engine for Views that contain locations of entities and/or visitors. Google Maps, Leaflet and OpenLayers2 maps are all supported and available through this module. Using a number of optional sources IPGV&M also retrieves…

Code

function ip_geoloc_same_path() {
  if (empty($_SERVER['HTTP_REFERER'])) {
    return FALSE;
  }
  $referer = $_SERVER['HTTP_REFERER'];
  global $base_url;
  if (strpos($referer, $base_url) === 0) {
    $prev_path = drupal_substr($referer, drupal_strlen($base_url) + 1);
    if (empty($prev_path) && drupal_is_front_page()) {
      return TRUE;
    }
    return $prev_path == current_path() || $prev_path == drupal_get_path_alias();
  }
  return FALSE;
}