You are here

function _bakery_bake_chocolatechip_cookie in Bakery Single Sign-On System 6.2

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

Create a new cookie for identification

5 calls to _bakery_bake_chocolatechip_cookie()
bakery_login in ./bakery.module
Special Bakery login callback authenticates the user and returns to slave.
bakery_register in ./bakery.module
Special Bakery register callback registers the user and returns to slave.
bakery_user in ./bakery.module
Implementation of hook_user().
_bakery_reset_submit in ./bakery.module
Submit handler for the password reset form.
_bakery_taste_chocolatechip_cookie in ./bakery.module
Test identification cookie.

File

./bakery.module, line 1150

Code

function _bakery_bake_chocolatechip_cookie($name, $mail, $init) {
  $key = variable_get('bakery_key', '');
  if (!empty($key)) {
    $cookie = array();
    $cookie['name'] = $name;
    $cookie['mail'] = $mail;
    $cookie['init'] = $init;
    $cookie['master'] = variable_get('bakery_is_master', 0);
    $cookie['calories'] = 480;
    $cookie['timestamp'] = $_SERVER['REQUEST_TIME'];
    $cookie_secure = !variable_get('bakery_loose_ssl', FALSE) && ini_get('session.cookie_secure');
    $type = _bakery_cookie_name('CHOCOLATECHIP');
    $cookie['type'] = $type;
    $data = bakery_bake_data($cookie);

    // Allow cookies to expire when the browser closes.
    $expire = variable_get('bakery_freshness', '3600') > 0 ? $_SERVER['REQUEST_TIME'] + variable_get('bakery_freshness', '3600') : '0';
    setcookie($type, $data, $expire, '/', variable_get('bakery_domain', ''), $cookie_secure, TRUE);
  }
}