Merge branch 'develop' into pr/extra-timezones

This commit is contained in:
Kijin Sung 2016-02-12 08:31:43 +09:00
commit 96dfdfc840
5 changed files with 146 additions and 20 deletions

View file

@ -611,7 +611,7 @@ function zdate($str, $format = 'Y-m-d H:i:s', $conversion = false)
*/
function getTimeGap($date, $format = 'Y.m.d')
{
$gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date);
$gap = RX_TIME - ztime($date);
$lang_time_gap = Context::getLang('time_gap');
if($gap < 60)

View file

@ -114,9 +114,22 @@ class boardController extends board
return new Object(-1,'msg_not_permitted');
}
if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
if($this->module_info->protect_content == 'Y' || $this->module_info->protect_update_content == 'Y')
{
return new Object(-1,'msg_protect_content');
if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
{
return new Object(-1, 'msg_protect_update_content');
}
}
if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
{
if($oDocument->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
if(!$this->grant->manager)
@ -202,11 +215,23 @@ class boardController extends board
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
// check protect content
if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
if($this->module_info->protect_content == 'Y' || $this->module_info->protect_delete_content == 'Y')
{
return new Object(-1, 'msg_protect_content');
if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
{
return new Object(-1, 'msg_protect_delete_content');
}
}
if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
{
if($oDocument->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
// generate document module controller object
$oDocumentController = getController('document');
@ -306,12 +331,12 @@ class boardController extends board
else
{
$comment = $oCommentModel->getComment($obj->comment_srl, $this->grant->manager);
if($this->module_info->protect_comment === 'Y' && $this->grant->manager == false)
if($this->module_info->protect_update_comment === 'Y' && $this->grant->manager == false)
{
$childs = $oCommentModel->getChildComments($obj->comment_srl);
if (count($childs) > 0)
if(count($childs) > 0)
{
return new Object(-1, 'msg_board_protect_comment');
return new Object(-1, 'msg_board_update_protect_comment');
}
}
}
@ -349,6 +374,15 @@ class boardController extends board
}
else
{
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
{
if($comment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
// check the grant
if(!$comment->isGranted())
{
@ -384,15 +418,24 @@ class boardController extends board
$oCommentModel = getModel('comment');
if($this->module_info->protect_comment === 'Y' && $this->grant->manager==false)
if($this->module_info->protect_delete_comment === 'Y' && $this->grant->manager == false)
{
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
return new Object(-1, 'msg_board_protect_comment');
return new Object(-1, 'msg_board_delete_protect_comment');
}
}
$comment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
{
if($comment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
// generate comment controller object
$oCommentController = getController('comment');

View file

@ -692,9 +692,24 @@ class boardView extends board
if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE;
$oDocument->add('module_srl', $this->module_srl);
if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
if($oDocument->isExists())
{
return new Object(-1, 'msg_protect_content');
if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
{
if($oDocument->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
if($this->module_info->protect_content == "Y" || $this->module_info->protect_update_content == 'Y')
{
if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
{
return new Object(-1, 'msg_protect_update_content');
}
}
}
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
@ -806,9 +821,22 @@ class boardView extends board
return $this->setTemplateFile('input_password_form');
}
if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
{
return $this->dispBoardMessage('msg_protect_content');
if($oDocument->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
if($this->module_info->protect_content == "Y" || $this->module_info->protect_delete_content == 'Y')
{
if($oDocument->get('comment_count')>0 && $this->grant->manager == false)
{
return new Object(-1,'msg_protect_delete_content');
}
}
Context::set('oDocument',$oDocument);
@ -955,6 +983,23 @@ class boardView extends board
$oMemberModel = getModel('member');
$member_info = $oMemberModel->getMemberInfoByMemberSrl($oComment->member_srl);
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
{
if($oComment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
if($this->module_info->protect_update_comment === 'Y' && $this->grant->manager == false)
{
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
return new Object(-1, 'msg_board_update_protect_comment');
}
}
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
@ -1006,6 +1051,26 @@ class boardView extends board
$oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
}
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
{
if($oComment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
if($this->module_info->protect_delete_comment === 'Y' && $this->grant->manager == false)
{
$oCommentModel = getModel('comment');
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
return new Object(-1, 'msg_board_delete_protect_comment');
}
}
// if the comment is not existed, then back to the board content page
if(!$oComment->isExists() )
{

View file

@ -42,8 +42,14 @@ $lang->hide_category = '분류 숨기기';
$lang->about_hide_category = '임시로 분류를 사용하지 않으려면 체크하세요.';
$lang->protect_content = '글 보호 기능';
$lang->protect_comment = '댓글 보호 기능';
$lang->about_protect_content = '작성된 글에 댓글이 작성된 경우 글 작성자는 해당 글을 수정하거나 삭제 할 수 없습니다. ';
$lang->msg_protect_content = '댓글이 작성된 게시물의 글을 수정 또는 삭제 할 수 없습니다.';
$lang->protect_regdate = '기간 제한 기능';
$lang->about_protect_regdate = '작성된 글이나 댓글의 작성기간이 설정한 기간보다 이전일일 경우 글을 수정 또는 삭제할 수 없도록 합니다. (단위 : day)';
$lang->about_protect_content = '작성된 글에 댓글이 작성된 경우 글 작성자는 해당 글을 수정 또는 삭제를 할 수 없습니다.';
$lang->msg_protect_delete_content = '작성된 글에 댓글이 작성된 경우 글 작성자는 해당 글을 삭제할 수 없습니다. ';
$lang->msg_protect_update_content = '작성된 글에 댓글이 작성된 경우 글 작성자는 해당 글을 수정할 수 없습니다. ';
$lang->msg_admin_document_no_modify = '최고관리자의 게시물을 수정할 권한이 없습니다.';
$lang->msg_admin_comment_no_modify = '최고관리자의 댓글을 수정할 권한이 없습니다.';
$lang->msg_board_protect_comment = '댓글이 작성된 댓글의 글을 수정 또는 삭제할 수 없습니다.';
$lang->msg_board_delete_protect_comment = '댓글이 작성된 댓글의 글을 삭제할 수 없습니다.';
$lang->msg_board_update_protect_comment = '댓글이 작성된 댓글의 글을 수정할 수 없습니다.';
$lang->msg_protect_regdate_document = '%s일 이전의 게시글은 수정 또는 삭제 할 수 없습니다.';
$lang->msg_protect_regdate_comment = '%s일 이전의 댓글은 수정 또는 삭제 할 수 없습니다.';

View file

@ -202,13 +202,25 @@
<div class="x_control-group">
<label class="x_control-label">{$lang->protect_content}</label>
<div class="x_controls">
<label class="x_inline" for="protect_content"><input type="checkbox" name="protect_content" id="protect_content" value="Y" checked="checked"|cond="$module_info->protect_content == 'Y'" /> {$lang->about_protect_content}</label>
<label class="x_inline" for="protect_delete_content"><input type="checkbox" name="protect_delete_content" id="protect_delete_content" value="Y" checked="checked"|cond="$module_info->protect_delete_content == 'Y'" /> {$lang->cmd_delete}</label>
<label class="x_inline" for="protect_update_content"><input type="checkbox" name="protect_update_content" id="protect_update_content" value="Y" checked="checked"|cond="$module_info->protect_update_content == 'Y'" /> {$lang->cmd_modify}</label>
<p>{$lang->about_protect_content}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->protect_comment}</label>
<div class="x_controls">
<label class="x_inline" for="protect_comment"><input type="checkbox" name="protect_comment" id="protect_comment" value="Y" checked="checked"|cond="$module_info->protect_comment == 'Y'" /> {$lang->about_protect_comment}</label>
<label class="x_inline" for="protect_delete_comment"><input type="checkbox" name="protect_delete_comment" id="protect_delete_comment" value="Y" checked="checked"|cond="$module_info->protect_delete_comment == 'Y'" />{$lang->cmd_delete} </label>
<label class="x_inline" for="protect_update_comment"><input type="checkbox" name="protect_update_comment" id="protect_update_comment" value="Y" checked="checked"|cond="$module_info->protect_update_comment == 'Y'" />{$lang->cmd_modify} </label>
<p>{$lang->about_protect_comment}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->protect_regdate}</label>
<div class="x_controls">
{$lang->document} : <input type="number" name="protect_document_regdate" id="protect_document_regdate" value="{$module_info->protect_document_regdate}" />
{$lang->comment} : <input type="number" name="protect_comment_regdate" id="protect_comment_regdate" value="{$module_info->protect_comment_regdate}" />
<p>{$lang->about_protect_regdate}</p>
</div>
</div>
<div class="x_control-group">