You are here

function _bakery_cookie_name in Bakery Single Sign-On System 6.2

Same name and namespace in other branches
  1. 7.4 bakery.module \_bakery_cookie_name()
  2. 7.2 bakery.module \_bakery_cookie_name()
  3. 7.3 bakery.module \_bakery_cookie_name()

Name for cookie including session.cookie_secure and variable extension.

Parameters

string $type: CHOCOLATECHIP or OATMEAL, default CHOCOLATECHIP

Return value

string The cookie name for this environment.

5 calls to _bakery_cookie_name()
bakery_bake_oatmeal_cookie in ./bakery.module
Create a cookie for passing information between sites for registration and login.
bakery_taste_oatmeal_cookie in ./bakery.module
_bakery_bake_chocolatechip_cookie in ./bakery.module
Create a new cookie for identification
_bakery_eat_cookie in ./bakery.module
Destroy unwanted cookies
_bakery_validate_cookie in ./bakery.module
Function to validate cookies

File

./bakery.module, line 937

Code

function _bakery_cookie_name($type = 'CHOCOLATECHIP') {

  // Use different names for HTTPS and HTTP to prevent a cookie collision.
  if (ini_get('session.cookie_secure')) {
    if (variable_get('bakery_loose_ssl', FALSE)) {

      // Prefer SSL cookie if loose.
      if (isset($_COOKIE[$type . 'SSL'])) {
        $type .= 'SSL';
      }
    }
    else {

      // Always use SSL cookie if strict.
      $type .= 'SSL';
    }
  }

  // Allow installation to modify the cookie name.
  $extension = variable_get('bakery_cookie_extension', '');
  $type .= $extension;
  return $type;
}