mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-15 17:29:55 +09:00
merge from 1.7.3.5(r13153:r13167)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@13168 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
cc47d2b247
commit
2d3f149b5a
2042 changed files with 129266 additions and 126243 deletions
|
|
@ -1,100 +1,114 @@
|
|||
<?php
|
||||
/**
|
||||
* @class sessionModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The Model class of the session module
|
||||
**/
|
||||
/**
|
||||
* @class sessionModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The Model class of the session module
|
||||
*/
|
||||
class sessionModel extends session
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class sessionModel extends session {
|
||||
function getLifeTime()
|
||||
{
|
||||
return $this->lifetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
function read($session_key)
|
||||
{
|
||||
if(!$session_key || !$this->session_started) return;
|
||||
|
||||
function getLifeTime() {
|
||||
return $this->lifetime;
|
||||
}
|
||||
|
||||
function read($session_key) {
|
||||
if(!$session_key || !$this->session_started) return;
|
||||
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()){
|
||||
$cache_key = 'object:'.$session_key;
|
||||
$output->data = $oCacheHandler->get($cache_key);
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object:'.$session_key;
|
||||
$output->data = $oCacheHandler->get($cache_key);
|
||||
}
|
||||
if(!$output->data)
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->session_key = $session_key;
|
||||
$columnList = array('session_key', 'cur_mid', 'val');
|
||||
$output = executeQuery('session.getSession', $args, $columnList);
|
||||
// Confirm there is a table created if read error occurs
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isTableExists('session')) $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml');
|
||||
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
||||
$output = executeQuery('session.getSession', $args);
|
||||
}
|
||||
if(!$output->data) {
|
||||
|
||||
$args->session_key = $session_key;
|
||||
$columnList = array('session_key', 'cur_mid', 'val');
|
||||
$output = executeQuery('session.getSession', $args, $columnList);
|
||||
// Confirm there is a table created if read error occurs
|
||||
if(!$output->toBool()) {
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isTableExists('session')) $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml');
|
||||
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
||||
$output = executeQuery('session.getSession', $args);
|
||||
}
|
||||
// Check if there is a table created in case there is no "cur_mid" value in the sessions information
|
||||
if(!isset($output->data->cur_mid)) {
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
||||
}
|
||||
|
||||
// Check if there is a table created in case there is no "cur_mid" value in the sessions information
|
||||
if(!isset($output->data->cur_mid))
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
||||
}
|
||||
return $output->data->val;
|
||||
}
|
||||
}
|
||||
return $output->data->val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a list of currently connected users
|
||||
* Requires "object" argument because multiple arguments are expected
|
||||
* limit_count : the number of objects
|
||||
* page : the page number
|
||||
* period_time: "n" specifies the time range in minutes since the last update
|
||||
* mid: a user who belong to a specified mid
|
||||
**/
|
||||
function getLoggedMembers($args) {
|
||||
if(!$args->site_srl) {
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$args->site_srl = (int)$site_module_info->site_srl;
|
||||
}
|
||||
if(!$args->list_count) $args->list_count = 20;
|
||||
if(!$args->page) $args->page = 1;
|
||||
if(!$args->period_time) $args->period_time = 3;
|
||||
$args->last_update = date("YmdHis", time() - $args->period_time*60);
|
||||
/**
|
||||
* @brief Get a list of currently connected users
|
||||
* Requires "object" argument because multiple arguments are expected
|
||||
* limit_count : the number of objects
|
||||
* page : the page number
|
||||
* period_time: "n" specifies the time range in minutes since the last update
|
||||
* mid: a user who belong to a specified mid
|
||||
*/
|
||||
function getLoggedMembers($args)
|
||||
{
|
||||
if(!$args->site_srl)
|
||||
{
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$args->site_srl = (int)$site_module_info->site_srl;
|
||||
}
|
||||
if(!$args->list_count) $args->list_count = 20;
|
||||
if(!$args->page) $args->page = 1;
|
||||
if(!$args->period_time) $args->period_time = 3;
|
||||
$args->last_update = date("YmdHis", time() - $args->period_time*60);
|
||||
|
||||
$output = executeQueryArray('session.getLoggedMembers', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
$output = executeQueryArray('session.getLoggedMembers', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
$member_srls = array();
|
||||
if(count($output->data)) {
|
||||
foreach($output->data as $key => $val) {
|
||||
$member_srls[$key] = $val->member_srl;
|
||||
$member_keys[$val->member_srl] = $key;
|
||||
}
|
||||
}
|
||||
$member_srls = array();
|
||||
if(count($output->data))
|
||||
{
|
||||
foreach($output->data as $key => $val)
|
||||
{
|
||||
$member_srls[$key] = $val->member_srl;
|
||||
$member_keys[$val->member_srl] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
if(Context::get('is_logged')) {
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!in_array($logged_info->member_srl, $member_srls)) {
|
||||
$member_srls[0] = $logged_info->member_srl;
|
||||
$member_keys[$logged_info->member_srl] = 0;
|
||||
}
|
||||
}
|
||||
if(Context::get('is_logged'))
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!in_array($logged_info->member_srl, $member_srls))
|
||||
{
|
||||
$member_srls[0] = $logged_info->member_srl;
|
||||
$member_keys[$logged_info->member_srl] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(!count($member_srls)) return $output;
|
||||
if(!count($member_srls)) return $output;
|
||||
|
||||
$member_args->member_srl = implode(',',$member_srls);
|
||||
$member_output = executeQueryArray('member.getMembers', $member_args);
|
||||
if($member_output->data) {
|
||||
foreach($member_output->data as $key => $val) {
|
||||
$output->data[$member_keys[$val->member_srl]] = $val;
|
||||
}
|
||||
}
|
||||
$member_args->member_srl = implode(',',$member_srls);
|
||||
$member_output = executeQueryArray('member.getMembers', $member_args);
|
||||
if($member_output->data)
|
||||
{
|
||||
foreach($member_output->data as $key => $val)
|
||||
{
|
||||
$output->data[$member_keys[$val->member_srl]] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
/* End of file session.model.php */
|
||||
/* Location: ./modules/session/session.model.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue