Update some modules to throw exceptions instead of BaseObject

This commit is contained in:
Kijin Sung 2018-08-27 00:03:12 +09:00
parent f6fa7493f6
commit 1863edcbb8
12 changed files with 118 additions and 118 deletions

View file

@ -672,18 +672,18 @@ class boardView extends board
$document_srl = Context::get('document_srl');
if(!$document_srl)
{
return $this->setError("msg_invalid_request");
throw new Rhymix\Framework\Exception("msg_invalid_request");
}
if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read))
{
return $this->setError("msg_not_permitted");
throw new Rhymix\Framework\Exception("msg_not_permitted");
}
$oDocument = getModel('document')->getDocument($document_srl);
if(!$oDocument->isExists())
{
return $this->setError("msg_invalid_request");
throw new Rhymix\Framework\Exception("msg_invalid_request");
}
Context::set('oDocument', $oDocument);
@ -780,20 +780,20 @@ class boardView extends board
{
$format = lang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return $this->setError($massage);
throw new Rhymix\Framework\Exception($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 $this->setError('msg_protect_update_content');
throw new Rhymix\Framework\Exception('msg_protect_update_content');
}
}
}
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
return $this->setError('msg_admin_document_no_modify');
throw new Rhymix\Framework\Exception('msg_admin_document_no_modify');
}
// if the document is not granted, then back to the password input form
@ -913,7 +913,7 @@ class boardView extends board
{
$format = lang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return $this->setError($massage);
throw new Rhymix\Framework\Exception($massage);
}
}
@ -921,7 +921,7 @@ class boardView extends board
{
if($oDocument->get('comment_count')>0 && $this->grant->manager == false)
{
return $this->setError('msg_protect_delete_content');
throw new Rhymix\Framework\Exception('msg_protect_delete_content');
}
}
@ -998,7 +998,7 @@ class boardView extends board
// if the parent comment is not existed
if(!$parent_srl)
{
return $this->setError('msg_invalid_request');
throw new Rhymix\Framework\Exception('msg_invalid_request');
}
// get the comment
@ -1060,7 +1060,7 @@ class boardView extends board
// if the comment is not existed
if(!$comment_srl)
{
return $this->setError('msg_invalid_request');
throw new Rhymix\Framework\Exception('msg_invalid_request');
}
// get comment information
@ -1075,7 +1075,7 @@ class boardView extends board
{
$format = lang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return $this->setError($massage);
throw new Rhymix\Framework\Exception($massage);
}
}
if($this->module_info->protect_update_comment === 'Y' && $this->grant->manager == false)
@ -1083,13 +1083,13 @@ class boardView extends board
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
return $this->setError('msg_board_update_protect_comment');
throw new Rhymix\Framework\Exception('msg_board_update_protect_comment');
}
}
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
return $this->setError('msg_admin_comment_no_modify');
throw new Rhymix\Framework\Exception('msg_admin_comment_no_modify');
}
// if the comment is not exited, alert an error message
@ -1143,7 +1143,7 @@ class boardView extends board
{
$format = lang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return $this->setError($massage);
throw new Rhymix\Framework\Exception($massage);
}
}
@ -1153,7 +1153,7 @@ class boardView extends board
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
return $this->setError('msg_board_delete_protect_comment');
throw new Rhymix\Framework\Exception('msg_board_delete_protect_comment');
}
}
@ -1233,7 +1233,7 @@ class boardView extends board
if($this->grant->update_view !== true)
{
return $this->setError('msg_not_permitted');
throw new Rhymix\Framework\Exception('msg_not_permitted');
}
$updatelog = $oDocumentModel->getDocumentUpdateLog($document_srl);
@ -1253,7 +1253,7 @@ class boardView extends board
if($this->grant->update_view !== true)
{
return $this->setError('msg_not_permitted');
throw new Rhymix\Framework\Exception('msg_not_permitted');
}
$update_log = $oDocumentModel->getUpdateLog($update_id);
@ -1289,7 +1289,7 @@ class boardView extends board
{
iF($this->grant->vote_log_view !== true)
{
return $this->setError('msg_not_permitted');
throw new Rhymix\Framework\Exception('msg_not_permitted');
}
$oMemberModel = getModel('member');
@ -1310,7 +1310,7 @@ class boardView extends board
}
else
{
return $this->setError('msg_not_target');
throw new Rhymix\Framework\Exception('msg_not_target');
}
$output = executeQueryArray($queryId, $args);