function _bakery_validate_cookie in Bakery Single Sign-On System 6.2
Same name and namespace in other branches
- 6 bakery.module \_bakery_validate_cookie()
- 7.4 bakery.module \_bakery_validate_cookie()
- 7.2 bakery.module \_bakery_validate_cookie()
Function to validate cookies
Parameters
$type (string) CHOCOLATECHIP or OATMEAL, default CHOCOLATECHIP:
Return value
validated and decrypted cookie in an array, FALSE if invalid, or NULL
4 calls to _bakery_validate_cookie()
- bakery_uncrumble in ./
bakery.module - Form to let users repair minor problems themselves.
- bakery_uncrumble_submit in ./
bakery.module - bakery_user in ./
bakery.module - Implementation of hook_user().
- _bakery_taste_chocolatechip_cookie in ./
bakery.module - Test identification cookie.
File
- ./
bakery.module, line 964
Code
function _bakery_validate_cookie($type = 'CHOCOLATECHIP') {
$key = variable_get('bakery_key', '');
$type = _bakery_cookie_name($type);
if (!isset($_COOKIE[$type]) || !$key || !variable_get('bakery_domain', '')) {
// No cookie is set or site is misconfigured. Return NULL so existing
// cookie is not deleted by bakery_eat_cookie().
return NULL;
}
if (($data = bakery_validate_data($_COOKIE[$type], $type)) !== FALSE) {
return $data;
}
return FALSE;
}