Revision 27e02aed
Added by Assos Assos over 4 years ago
drupal7/includes/session.inc | ||
---|---|---|
371 | 371 |
|
372 | 372 |
if (drupal_session_started()) { |
373 | 373 |
$old_session_id = session_id(); |
374 |
_drupal_session_regenerate_existing(); |
|
375 |
} |
|
376 |
else { |
|
377 |
session_id(drupal_random_key()); |
|
374 | 378 |
} |
375 |
session_id(drupal_random_key()); |
|
376 | 379 |
|
377 | 380 |
if (isset($old_session_id)) { |
378 | 381 |
$params = session_get_cookie_params(); |
... | ... | |
412 | 415 |
date_default_timezone_set(drupal_get_user_timezone()); |
413 | 416 |
} |
414 | 417 |
|
418 |
/** |
|
419 |
* Regenerates an existing session. |
|
420 |
*/ |
|
421 |
function _drupal_session_regenerate_existing() { |
|
422 |
global $user; |
|
423 |
// Preserve existing settings for the saving of sessions. |
|
424 |
$original_save_session_status = drupal_save_session(); |
|
425 |
// Turn off saving of sessions. |
|
426 |
drupal_save_session(FALSE); |
|
427 |
session_write_close(); |
|
428 |
drupal_session_started(FALSE); |
|
429 |
// Preserve the user object, as starting a new session will reset it. |
|
430 |
$original_user = $user; |
|
431 |
session_id(drupal_random_key()); |
|
432 |
drupal_session_start(); |
|
433 |
$user = $original_user; |
|
434 |
// Restore the original settings for the saving of sessions. |
|
435 |
drupal_save_session($original_save_session_status); |
|
436 |
} |
|
437 |
|
|
415 | 438 |
/** |
416 | 439 |
* Session handler assigned by session_set_save_handler(). |
417 | 440 |
* |
Also available in: Unified diff
-a