mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
선택적 세션 시작 + 서드파티 자료 호환성 (Proof of Concept)
This commit is contained in:
parent
6745497ad7
commit
23a83a7033
5 changed files with 88 additions and 18 deletions
|
|
@ -154,6 +154,12 @@ class Context
|
|||
*/
|
||||
public $isSuccessInit = TRUE;
|
||||
|
||||
/**
|
||||
* Session status
|
||||
* @var bool FALSE if session was not started
|
||||
*/
|
||||
public $isSessionStarted = FALSE;
|
||||
|
||||
/**
|
||||
* returns static context object (Singleton). It's to use Context without declaration of an object
|
||||
*
|
||||
|
|
@ -333,8 +339,27 @@ class Context
|
|||
);
|
||||
}
|
||||
|
||||
if($sess = $_POST[session_name()]) session_id($sess);
|
||||
session_start();
|
||||
// start session if it was previously started
|
||||
$session_name = session_name();
|
||||
$session_id = NULL;
|
||||
if($session_id = $_POST[$session_name])
|
||||
{
|
||||
session_id($session_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$session_id = $_COOKIE[$session_name];
|
||||
}
|
||||
|
||||
if($session_id !== NULL)
|
||||
{
|
||||
$this->isSessionStarted = TRUE;
|
||||
session_start();
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION = array();
|
||||
}
|
||||
|
||||
// set authentication information in Context and session
|
||||
if(self::isInstalled())
|
||||
|
|
@ -420,6 +445,26 @@ class Context
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the session if $_SESSION was touched
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function checkSessionStatus()
|
||||
{
|
||||
if($this->isSessionStarted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(count($_SESSION))
|
||||
{
|
||||
$tempSession = $_SESSION;
|
||||
session_start();
|
||||
$_SESSION = $tempSession;
|
||||
$this->isSessionStarted = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalize using resources, such as DB connection
|
||||
*
|
||||
|
|
@ -942,7 +987,10 @@ class Context
|
|||
$self->lang_type = $lang_type;
|
||||
$self->set('lang_type', $lang_type);
|
||||
|
||||
$_SESSION['lang_type'] = $lang_type;
|
||||
if($this->isSessionStarted)
|
||||
{
|
||||
$_SESSION['lang_type'] = $lang_type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ class DisplayHandler extends Handler
|
|||
$handler->prepareToPrint($output);
|
||||
}
|
||||
|
||||
// Start the session if $_SESSION was touched
|
||||
Context::getInstance()->checkSessionStatus();
|
||||
|
||||
// header output
|
||||
|
||||
$httpStatusCode = $oModule->getHttpStatusCode();
|
||||
|
|
|
|||
|
|
@ -722,15 +722,24 @@ class ModuleHandler extends Handler
|
|||
|
||||
}
|
||||
|
||||
$_SESSION['XE_VALIDATOR_ERROR'] = $error;
|
||||
$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
|
||||
if($message != 'success')
|
||||
$isSessionStarted = Context::getInstance()->isSessionStarted;
|
||||
if($isSessionStarted || $error != 0)
|
||||
{
|
||||
$_SESSION['XE_VALIDATOR_ERROR'] = $error;
|
||||
}
|
||||
if($isSessionStarted || $validator_id = Context::get('xe_validator_id'))
|
||||
{
|
||||
$_SESSION['XE_VALIDATOR_ID'] = $validator_id;
|
||||
}
|
||||
if($isSessionStarted || $message != 'success')
|
||||
{
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
|
||||
}
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
|
||||
|
||||
if(Context::get('xeVirtualRequestMethod') != 'xml')
|
||||
if($isSessionStarted || $messageType != 'info')
|
||||
{
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
|
||||
}
|
||||
if(Context::get('xeVirtualRequestMethod') != 'xml' && ($isSessionStarted || $redirectUrl))
|
||||
{
|
||||
$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
|
||||
}
|
||||
|
|
@ -780,12 +789,12 @@ class ModuleHandler extends Handler
|
|||
* */
|
||||
function _clearErrorSession()
|
||||
{
|
||||
$_SESSION['XE_VALIDATOR_ERROR'] = '';
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE'] = '';
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = '';
|
||||
$_SESSION['XE_VALIDATOR_RETURN_URL'] = '';
|
||||
$_SESSION['XE_VALIDATOR_ID'] = '';
|
||||
$_SESSION['INPUT_ERROR'] = '';
|
||||
if($_SESSION['XE_VALIDATOR_ERROR']) $_SESSION['XE_VALIDATOR_ERROR'] = '';
|
||||
if($_SESSION['XE_VALIDATOR_MESSAGE']) $_SESSION['XE_VALIDATOR_MESSAGE'] = '';
|
||||
if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE']) $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = '';
|
||||
if($_SESSION['XE_VALIDATOR_RETURN_URL']) $_SESSION['XE_VALIDATOR_RETURN_URL'] = '';
|
||||
if($_SESSION['XE_VALIDATOR_ID']) $_SESSION['XE_VALIDATOR_ID'] = '';
|
||||
if($_SESSION['INPUT_ERROR']) $_SESSION['INPUT_ERROR'] = '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -839,6 +848,7 @@ class ModuleHandler extends Handler
|
|||
$display_handler = new DisplayHandler();
|
||||
$display_handler->_debugOutput();
|
||||
|
||||
Context::getInstance()->checkSessionStatus();
|
||||
header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -391,7 +391,10 @@ class documentItem extends Object
|
|||
if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
|
||||
|
||||
$result = $this->_checkAccessibleFromStatus();
|
||||
if($result) $_SESSION['accessible'][$this->document_srl] = true;
|
||||
if($result && Context::getInstance()->isSessionStarted)
|
||||
{
|
||||
$_SESSION['accessible'][$this->document_srl] = true;
|
||||
}
|
||||
|
||||
$content = $this->get('content');
|
||||
$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
|
||||
|
|
@ -452,7 +455,10 @@ class documentItem extends Object
|
|||
if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
|
||||
|
||||
$result = $this->_checkAccessibleFromStatus();
|
||||
if($result) $_SESSION['accessible'][$this->document_srl] = true;
|
||||
if($result && Context::getInstance()->isSessionStarted)
|
||||
{
|
||||
$_SESSION['accessible'][$this->document_srl] = true;
|
||||
}
|
||||
|
||||
$content = $this->get('content');
|
||||
if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
|
||||
|
|
|
|||
|
|
@ -205,7 +205,10 @@ class memberModel extends member
|
|||
}
|
||||
}
|
||||
|
||||
$_SESSION['is_logged'] = false;
|
||||
if(Context::getInstance()->isSessionStarted)
|
||||
{
|
||||
$_SESSION['is_logged'] = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue