18 $current_val = ini_get(
'display_errors');
19 ini_set(
'display_errors', 0);
21 if (!isset($_SESSION[
'PRIMARY_SESSIONID'])) {
22 error_log(
'No primary session');
23 reload_browser(TRUE, $SQ_SITE_NETWORK);
27 $session_handler = $GLOBALS[
'SQ_SYSTEM']->getSessionHandlerClassName();
28 $session_handler_instance =
new $session_handler();
29 $session_exists = $session_handler_instance->sessionExists($_SESSION[
'PRIMARY_SESSIONID']);
31 if (!$session_exists) {
32 unset($_SESSION[
'PRIMARY_SESSIONID']);
33 reload_browser(FALSE, $SQ_SITE_NETWORK);
36 $pri_session = $session_handler_instance->unserialiseSession($_SESSION[
'PRIMARY_SESSIONID']);
37 $pri_timestamp = (isset($pri_session[
'SQ_SESSION_TIMESTAMP'])) ? $pri_session[
'SQ_SESSION_TIMESTAMP'] : -1;
38 $sec_timestamp = (isset($_SESSION[
'SQ_SESSION_TIMESTAMP'])) ? $_SESSION[
'SQ_SESSION_TIMESTAMP'] : -1;
40 if ($pri_timestamp > $sec_timestamp) {
41 $session_handler_instance->syncSession($_SESSION[
'PRIMARY_SESSIONID']);
42 reload_browser(FALSE, $SQ_SITE_NETWORK);
47 ini_set(
'display_errors', $current_val);
49 function reload_browser($do_js_request=FALSE, $site_network)
51 $primary_url = $site_network->getPrimaryURL();
55 <script type=
"text/javascript" src=
"<?php echo sq_web_path('lib'); ?>/js/JsHttpConnector.js"></script>
56 <script type=
"text/javascript" src=
"<?php echo $primary_url; ?>/__lib/session/session.php?in_primary=<?php echo (sq_web_path('root_url') == $primary_url) ? 1 : 0; ?>&site_network=<?php echo $site_network->id; ?>"></script>
57 <script type=
"text/javascript">
60 echo
'start_session_handler("'.sq_web_path(
'lib').
'/session/session.php?site_network='.$site_network->id.
'");'.
"\n";
63 setTimeout(
"document.location.href = document.location.href.replace('SQ_ACTION=logout','')", 100);