XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
session.model.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
8 class sessionModel extends session
9 {
13  function init()
14  {
15  }
16 
17  function getLifeTime()
18  {
19  return $this->lifetime;
20  }
21 
22  function read($session_key)
23  {
24  if(!$session_key || !$this->session_started) return;
25 
26  $args = new stdClass();
27  $args->session_key = $session_key;
28  $columnList = array('session_key', 'cur_mid', 'val');
29  $output = executeQuery('session.getSession', $args, $columnList);
30 
31  if(!$output->data)
32  {
33  return '';
34  }
35 
36  return $output->data->val;
37  }
38 
48  {
49  if(!$args->site_srl)
50  {
51  $site_module_info = Context::get('site_module_info');
52  $args->site_srl = (int)$site_module_info->site_srl;
53  }
54  if(!$args->list_count) $args->list_count = 20;
55  if(!$args->page) $args->page = 1;
56  if(!$args->period_time) $args->period_time = 3;
57  $args->last_update = date("YmdHis", $_SERVER['REQUEST_TIME'] - $args->period_time*60);
58 
59  $output = executeQueryArray('session.getLoggedMembers', $args);
60  if(!$output->toBool()) return $output;
61 
62  $member_srls = array();
63  $member_keys = array();
64  if(count($output->data))
65  {
66  foreach($output->data as $key => $val)
67  {
68  $member_srls[$key] = $val->member_srl;
69  $member_keys[$val->member_srl] = $key;
70  }
71  }
72 
73  if(Context::get('is_logged'))
74  {
75  $logged_info = Context::get('logged_info');
76  if(!in_array($logged_info->member_srl, $member_srls))
77  {
78  $member_srls[0] = $logged_info->member_srl;
79  $member_keys[$logged_info->member_srl] = 0;
80  }
81  }
82 
83  if(!count($member_srls)) return $output;
84 
85  $member_args->member_srl = implode(',',$member_srls);
86  $member_output = executeQueryArray('member.getMembers', $member_args);
87  if($member_output->data)
88  {
89  foreach($member_output->data as $key => $val)
90  {
91  $output->data[$member_keys[$val->member_srl]] = $val;
92  }
93  }
94 
95  return $output;
96  }
97 }
98 /* End of file session.model.php */
99 /* Location: ./modules/session/session.model.php */
session module&#39;s high class
$output
Definition: ko.install.php:193
getLoggedMembers($args)
Get a list of currently connected users Requires &quot;object&quot; argument because multiple arguments are exp...
$args
Definition: ko.install.php:185
read($session_key)
init()
Initialization.
The Model class of the session module.
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:219
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203