Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
session.php
1 <?php
17 // include init.in, which will call $GLOBALS['SQ_SYSTEM']->init() and start a session
18 require_once '../../include/init.inc';
19 
20 $site_network_id = array_get_index($_GET, 'site_network', '0');
21 $site_network = null;
22 $primary_url = '';
23 $session_handler = $GLOBALS['SQ_SYSTEM']->getSessionHandlerClassName();
24 
25 if ($site_network_id) {
26  $site_network = &$GLOBALS['SQ_SYSTEM']->am->getAsset($site_network_id);
27  if (!is_null($site_network)) {
28  $primary_url = $site_network->getPrimaryURL();
29  }
30 }
31 if ($primary_url == sq_web_path('root_url')) {
32  // if the actual script execution is happening in the primary
33  // url, we want to update the time to persuade the overriding
34  // of the secondary session files
35  if (isset($_GET['in_primary']) && $_GET['in_primary']) {
36  $_SESSION['SQ_SESSION_TIMESTAMP'] = time();
37  exit();
38  }
39 
40  // see design.inc and pre_session.php
41  // on how we call this function when we move from one site to another
42  echo 'var SESSIONID = "'.session_id().'";';
43  ?>
44  function start_session_handler(url) {
45  JsHttpConnector.submitRequest(url + '&sessionid=' + SESSIONID);
46  }
47  <?php
48 
49 } else {
50 
51  if (!isset($_GET['sessionid']) || !preg_match('/^[a-z0-9]+$/i', $_GET['sessionid'])) {
52  // something is definately wrong
53  trigger_localised_error('SYS0013', E_USER_ERROR);
54  }
55  if (is_null($site_network)) {
56  trigger_localised_error('SYS0014', E_USER_ERROR);
57  }
58 
59  $session_handler_instance = new $session_handler();
60  $session_handler_instance->syncSession($_GET['sessionid']);
61 
62 }//end if
63 ?>