Merge #1615 선택적 세션 시작 (Proof of Concept) by kijin

* pr/1615:
  Force start session if SSO is used
  Improve and simplify session status detection
  Improve handling of session variables related to validator
  Start session automatically if an addon uses the session and exits
  If cache-friendly behavior is enabled, don't skip updateReadedCount()
  If cache-friendly behavior is enabled, don't update session when reading document or comment
  Add option to enable/disable cache-friendly behavior
  Improve the setCacheControl() method
  Context::setCacheControl() method added etc.
  do not always set mobile/user-agent cookies
  선택적 세션 시작 + 서드파티 자료 호환성 (Proof of Concept)
This commit is contained in:
Kijin Sung 2015-10-08 15:03:17 +09:00
commit 9364563f4a
13 changed files with 160 additions and 38 deletions

View file

@ -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::getSessionStatus())
{
$_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::getSessionStatus())
{
$_SESSION['accessible'][$this->document_srl] = true;
}
$content = $this->get('content');
if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
@ -749,6 +755,7 @@ class documentItem extends Object
// If admin priviledge is granted on parent posts, you can read its child posts.
$accessible = array();
$comment_list = array();
$setAccessibleComments = Context::getSessionStatus();
foreach($output->data as $key => $val)
{
$oCommentItem = new commentItem();
@ -758,7 +765,10 @@ class documentItem extends Object
// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
{
$oCommentItem->setAccessible();
if($setAccessibleComments)
{
$oCommentItem->setAccessible();
}
}
$comment_list[$val->comment_srl] = $oCommentItem;
}