You are here

function geocoder_service_check_request in Geocoder 7

Geocoder Service Check Request.

Check to make sure the request to the service is valid. This checks to make sure the handler and the format exists, and also checks permission.

2 calls to geocoder_service_check_request()
geocoder_services_geocode in ./geocoder.services.inc
Callback for geocoding service.
geocoder_service_callback in ./geocoder.module
Page callback for AJAX / Geocoder service.

File

./geocoder.module, line 321

Code

function geocoder_service_check_request($handler, $format, $check_ac = TRUE) {
  if (!geocoder_get_handler($handler)) {
    drupal_set_message(t('Could not find handler @handler', array(
      '@handler' => $handler,
    )), 'error');
    drupal_not_found();
    exit;
  }
  if ($format && $format !== 'default' && !in_array($format, array_keys(geoPHP::getAdapterMap()), TRUE)) {
    throw new Exception(t('Could not find output-format @format', array(
      '@format' => $format,
    )), 'error');
    exit;
  }
  if (!geocoder_service_check_perms($handler)) {
    drupal_access_denied();
    exit;
  }
}