XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
session.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
11 class session extends ModuleObject
12 {
13  var $lifetime = 18000;
14  var $session_started = false;
15 
16  function __construct()
17  {
18  if(Context::isInstalled()) $this->session_started= true;
19  }
20 
24  function moduleInstall()
25  {
26  $oDB = &DB::getInstance();
27  $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid"));
28 
29  return new BaseObject();
30  }
31 
35  function checkUpdate()
36  {
37  $oDB = &DB::getInstance();
38  $oModuleModel = getModel('module');
40  $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
41  if($oModuleModel->needUpdate($version_update_id))
42  {
43  if(!$oDB->isTableExists('session')) return true;
44  if(!$oDB->isColumnExists("session","cur_mid")) return true;
45  if(!$oDB->isIndexExists("session","idx_session_update_mid")) return true;
46 
47  $oModuleController->insertUpdatedLog($version_update_id);
48  }
49 
50  return false;
51  }
52 
56  function moduleUpdate()
57  {
58  $oDB = &DB::getInstance();
59  $oModuleModel = getModel('module');
61  $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
62  if($oModuleModel->needUpdate($version_update_id))
63  {
64  if(!$oDB->isTableExists('session'))
65  {
66  $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml');
67  }
68  if(!$oDB->isColumnExists("session","cur_mid"))
69  {
70  $oDB->addColumn('session',"cur_mid","varchar",128);
71  }
72  if(!$oDB->isIndexExists("session","idx_session_update_mid"))
73  {
74  $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid"));
75  }
76 
77  $oModuleController->insertUpdatedLog($version_update_id);
78  }
79 
80  return new BaseObject(0, 'success_updated');
81  }
82 
86  function unSerializeSession($val)
87  {
88  $vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val,-1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
89  for($i=0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]);
90  return $result;
91  }
92 
96  function serializeSession($data)
97  {
98  if(!count($data)) return;
99 
100  $str = '';
101  foreach($data as $key => $val) $str .= $key.'|'.serialize($val);
102  return substr($str, 0, strlen($str)-1).'}';
103  }
104 
108  function recompileCache()
109  {
110  }
111 }
112 /* End of file session.class.php */
113 /* Location: ./modules/session/session.class.php */
$oModuleModel
Definition: ko.install.php:236
session module&#39;s high class
getController($module_name)
Definition: func.inc.php:90
const __XE_VERSION__
Definition: config.inc.php:32
unSerializeSession($val)
session string decode
moduleInstall()
Additional tasks required to accomplish during the installation.
moduleUpdate()
Execute update.
serializeSession($data)
session string encode
getInstance($db_type=NULL)
Definition: DB.class.php:142
getModel($module_name)
Definition: func.inc.php:145
checkUpdate()
A method to check if the installation has been successful.
$oModuleController
Definition: ko.install.php:287
recompileCache()
Re-generate the cache file.