function drupalchat_get_current_guest_name in DrupalChat 7
2 calls to drupalchat_get_current_guest_name()
- drupalchat_ex_auth in ./
drupalchat.module - drupalchat_init in ./
drupalchat.module - @todo Please document this function.
File
- ./
drupalchat.module, line 1435 - Module code for DrupalChat.
Code
function drupalchat_get_current_guest_name() {
if (isset($_SESSION) && isset($_SESSION['drupalchat_guest_name'])) {
//if(!isset($_COOKIE) || !isset($_COOKIE['drupalchat_guest_name'])) {
setrawcookie('drupalchat_guest_name', rawurlencode($_SESSION['drupalchat_guest_name']), time() + 60 * 60 * 24 * 365);
//}
}
else {
if (isset($_COOKIE) && isset($_COOKIE['drupalchat_guest_name']) && isset($_COOKIE['drupalchat_guest_session']) && $_COOKIE['drupalchat_guest_session'] == drupalchat_compute_guest_session(drupalchat_get_current_guest_id())) {
$_SESSION['drupalchat_guest_name'] = check_plain($_COOKIE['drupalchat_guest_name']);
}
else {
if (variable_get('drupalchat_anon_use_name', 1) == 1) {
$_SESSION['drupalchat_guest_name'] = check_plain(variable_get('drupalchat_anon_prefix', 'Guest') . ' ' . drupalchat_get_random_name());
}
else {
$_SESSION['drupalchat_guest_name'] = check_plain(variable_get('drupalchat_anon_prefix', 'Guest') . time());
}
setrawcookie('drupalchat_guest_name', rawurlencode($_SESSION['drupalchat_guest_name']), time() + 60 * 60 * 24 * 365);
}
}
return $_SESSION['drupalchat_guest_name'];
}