function bakery_bake_oatmeal_cookie in Bakery Single Sign-On System 7.2
Same name and namespace in other branches
- 6.2 bakery.module \bakery_bake_oatmeal_cookie()
- 6 bakery.module \bakery_bake_oatmeal_cookie()
Create a cookie for passing information between sites.
4 calls to bakery_bake_oatmeal_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_login_submit in ./
bakery.module - Handle login by redirecting to master.
- _bakery_register_submit in ./
bakery.module - Handle registration by redirecting to master.
File
- ./
bakery.module, line 1342 - Module file for the Bakery.
Code
function bakery_bake_oatmeal_cookie($name, $data) {
$key = variable_get('bakery_key', '');
if (!empty($key)) {
global $base_url;
$cookie = array(
'data' => $data,
'name' => $name,
'calories' => 320,
'timestamp' => $_SERVER['REQUEST_TIME'],
);
if (variable_get('bakery_is_master', FALSE)) {
$cookie['master'] = 1;
}
else {
$cookie['master'] = 0;
// Match the way slaves are set in Bakery settings, with ending slash.
$cookie['slave'] = $base_url . '/';
}
$cookie_secure = !variable_get('bakery_loose_ssl', FALSE) && ini_get('session.cookie_secure');
$type = _bakery_cookie_name('OATMEAL');
$cookie['type'] = $type;
$data = bakery_bake_data($cookie);
// OATMEAL cookies should expire relatively soon.
$expire = $_SERVER['REQUEST_TIME'] + 60;
setcookie($type, $data, $expire, '/', variable_get('bakery_domain', ''), empty($cookie_secure) ? FALSE : TRUE, TRUE);
}
}