public static function drupalchatController::_drupalchat_get_sid in DrupalChat 8
6 calls to drupalchatController::_drupalchat_get_sid()
- drupalchatController::drupalchat_get_messages in src/
Controller/ drupalchatController.php - drupal_get_messages()
- drupalchatController::drupalchat_get_messages_specific in src/
Controller/ drupalchatController.php - drupalchatController::drupalchat_get_thread_history in src/
Controller/ drupalchatController.php - drupalchatController::drupalchat_poll in src/
Controller/ drupalchatController.php - Process and get messages
- drupalchatController::drupalchat_verify_access in src/
Controller/ drupalchatController.php
File
- src/
Controller/ drupalchatController.php, line 81 - Contains Drupal\drupalchat\Controller\drupalchatController
Class
Namespace
Drupal\drupalchat\ControllerCode
public static function _drupalchat_get_sid($create = TRUE) {
$user = \Drupal::currentUser();
$sid = -1;
if (\Drupal::config('drupalchat.settings')
->get('drupalchat_polling_method') == DRUPALCHAT_NODEJS && isset($_SESSION['nodejs_config']['authToken'])) {
if (!isset($_SESSION['drupalchat']) && ($user
->id() != 0 || $create) || $_SESSION['drupalchat']) {
$sid = $_SESSION['nodejs_config']['authToken'];
$_SESSION['drupalchat'] = TRUE;
}
}
else {
if (\Drupal::config('drupalchat.settings')
->get('drupalchat_polling_method') == DRUPALCHAT_COMMERCIAL) {
if ($user
->id() > 0) {
return $user
->id();
}
else {
return false;
//return drupalchat_get_current_guest_id();
}
}
else {
if ($user
->id() == 0 && function_exists('session_api_get_sid')) {
$_COOKIE['drupalchat_c_session'] = time();
$sid = session_api_get_sid($create);
}
elseif ($user
->id() > 0) {
if (property_exists($user, 'sid')) {
$sid = $user->sid;
}
else {
$sid = '';
$session_manager = \Drupal::service('session_manager');
$session_id = $session_manager
->getId();
$sid = $session_id;
}
}
}
}
return $sid;
}