function bakery_bake_oatmeal_cookie in Bakery Single Sign-On System 6.2
Same name and namespace in other branches
- 6 bakery.module \bakery_bake_oatmeal_cookie()
- 7.2 bakery.module \bakery_bake_oatmeal_cookie()
Create a cookie for passing information between sites for registration and login.
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 1186
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;
$cookie['slave'] = $base_url . '/';
// Match the way slaves are set in Bakery settings, with ending slash.
}
$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);
// 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', ''), empty($cookie_secure) ? FALSE : TRUE, TRUE);
}
}