XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
session.controller.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
9 {
13  function init()
14  {
15  }
16 
17  function open()
18  {
19  return true;
20  }
21 
22  function close()
23  {
24  return true;
25  }
26 
27  function write($session_key, $val)
28  {
29  if(!$session_key || !$this->session_started) return;
30 
31  $args = new stdClass;
32  $args->session_key = $session_key;
33 
34  $output = executeQuery('session.getSession', $args);
35  $session_info = $output->data;
36 
37  //if ip has changed delete the session from db
38  if($session_info->session_key == $session_key && $session_info->ipaddress != $_SERVER['REMOTE_ADDR'])
39  {
40  executeQuery('session.deleteSession', $args);
41 
42  return true;
43  }
44 
45  $args->expired = date("YmdHis", $_SERVER['REQUEST_TIME'] + $this->lifetime);
46  $args->val = $val;
47  $args->cur_mid = Context::get('mid');
48 
49  if(!$args->cur_mid)
50  {
51  $module_info = Context::get('current_module_info');
52  $args->cur_mid = $module_info->mid;
53  }
54 
55  if(Context::get('is_logged'))
56  {
57  $logged_info = Context::get('logged_info');
58  $args->member_srl = $logged_info->member_srl;
59  }
60  else
61  {
62  $args->member_srl = 0;
63  }
64  $args->ipaddress = $_SERVER['REMOTE_ADDR'];
65  $args->last_update = date("YmdHis", $_SERVER['REQUEST_TIME']);
66 
67  //put session into db
68  if($session_info->session_key)
69  {
70  $output = executeQuery('session.updateSession', $args);
71  }
72  else
73  {
74  $output = executeQuery('session.insertSession', $args);
75  }
76 
77  return true;
78  }
79 
80  function destroy($session_key)
81  {
82  if(!$session_key || !$this->session_started) return;
83 
84  //remove session from db
85  $args = new stdClass();
86  $args->session_key = $session_key;
87  executeQuery('session.deleteSession', $args);
88 
89  return true;
90  }
91 
92  function gc($maxlifetime)
93  {
94  if(!$this->session_started) return;
95 
96  executeQuery('session.gcSession');
97  return true;
98  }
99 }
100 /* End of file session.controller.php */
101 /* Location: ./modules/session/session.controller.php */
session module&#39;s high class
$output
Definition: ko.install.php:193
init()
Initialization.
$args
Definition: ko.install.php:185
$module_info
an object containing the module information
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203
The controller class of the session module.
write($session_key, $val)