You are here

function shib_auth_getenv in Shibboleth Authentication 7.4

Retrieves a variable from the environment ($_SERVER).

Retrieve a variable from the environment ($_SERVER) even if mod_rewrite mangled it. Shibboleth and mod_rewrite is responsible for filtering out evil environment variables.

Parameters

string|bool $var: Environment variable name.

Return value

string|null The value of the environment variable.

5 calls to shib_auth_getenv()
shib_auth_custom_data in ./shib_auth_forms.inc
Form constructor for the shib_auth custom form.
shib_auth_get_idp in ./shib_auth.module
Get IdP name.
shib_auth_init in ./shib_auth.module
Creates a new user, if necessary, based on information from the handler.
shib_auth_process_rule in ./shib_auth.module
This function processes role assignment rules.
_shib_auth_update_fields in shib_auth_profile/shib_auth_profile.module
Helper function, actually update the fields on user_login or user_insert.

File

./shib_auth.module, line 1513
Drupal Shibboleth authentication module.

Code

function shib_auth_getenv($var = FALSE) {
  if (!$var) {
    return NULL;
  }

  // foo-bar.
  if (isset($_SERVER[$var]) || array_key_exists($var, $_SERVER)) {
    return $_SERVER[$var];
  }

  // REDIRECT_foo_bar.
  $var = "REDIRECT_" . str_replace('-', '_', $var);
  if (isset($_SERVER[$var]) || array_key_exists($var, $_SERVER)) {
    return $_SERVER[$var];
  }

  // HTTP_FOO_BAR.
  $var = strtoupper($var);
  $var = preg_replace('/^REDIRECT/', 'HTTP', $var);
  if (isset($_SERVER[$var]) || array_key_exists($var, $_SERVER)) {
    return $_SERVER[$var];
  }
  return NULL;
}