mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Update document, comment, file modules to throw exceptions
This commit is contained in:
parent
5be05dd875
commit
ad00ac800b
11 changed files with 142 additions and 110 deletions
|
|
@ -96,7 +96,7 @@ class commentAdminController extends comment
|
|||
$comment = $oCommentModel->getComment($comment_srl);
|
||||
if($comment->comment_srl != $comment_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
$document_srl = $comment->document_srl;
|
||||
if(!in_array($document_srl, $updated_documents_arr))
|
||||
|
|
|
|||
|
|
@ -27,15 +27,18 @@ class commentController extends comment
|
|||
*/
|
||||
function procCommentVoteUp()
|
||||
{
|
||||
if(!Context::get('is_logged'))
|
||||
if($this->module_info->non_login_vote !== 'Y')
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
$comment_srl = Context::get('target_srl');
|
||||
if(!$comment_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$oCommentModel = getModel('comment');
|
||||
|
|
@ -43,14 +46,14 @@ class commentController extends comment
|
|||
$module_srl = $oComment->get('module_srl');
|
||||
if(!$module_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
|
||||
if($comment_config->use_vote_up == 'N')
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$point = 1;
|
||||
|
|
@ -61,16 +64,22 @@ class commentController extends comment
|
|||
|
||||
function procCommentVoteUpCancel()
|
||||
{
|
||||
if(!Context::get('logged_info')) return $this->setError('msg_invalid_request');
|
||||
if($this->module_info->non_login_vote !== 'Y')
|
||||
{
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
$comment_srl = Context::get('target_srl');
|
||||
if(!$comment_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$comment_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oCommentModel = getModel('comment');
|
||||
$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
|
||||
if($oComment->get('voted_count') <= 0)
|
||||
{
|
||||
return $this->setError('msg_comment_voted_cancel_not');
|
||||
throw new Rhymix\Framework\Exception('msg_comment_voted_cancel_not');
|
||||
}
|
||||
$point = 1;
|
||||
$output = $this->updateVotedCountCancel($comment_srl, $oComment, $point);
|
||||
|
|
@ -88,15 +97,18 @@ class commentController extends comment
|
|||
*/
|
||||
function procCommentVoteDown()
|
||||
{
|
||||
if(!Context::get('is_logged'))
|
||||
if($this->module_info->non_login_vote !== 'Y')
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
$comment_srl = Context::get('target_srl');
|
||||
if(!$comment_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$oCommentModel = getModel('comment');
|
||||
|
|
@ -104,14 +116,14 @@ class commentController extends comment
|
|||
$module_srl = $oComment->get('module_srl');
|
||||
if(!$module_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
|
||||
if($comment_config->use_vote_down == 'N')
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$point = -1;
|
||||
|
|
@ -122,16 +134,22 @@ class commentController extends comment
|
|||
|
||||
function procCommentVoteDownCancel()
|
||||
{
|
||||
if(!Context::get('logged_info')) return $this->setError('msg_invalid_request');
|
||||
if($this->module_info->non_login_vote !== 'Y')
|
||||
{
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
$comment_srl = Context::get('target_srl');
|
||||
if(!$comment_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$comment_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oCommentModel = getModel('comment');
|
||||
$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
|
||||
if($oComment->get('blamed_count') >= 0)
|
||||
{
|
||||
return $this->setError('msg_comment_blamed_cancel_not');
|
||||
throw new Rhymix\Framework\Exception('msg_comment_blamed_cancel_not');
|
||||
}
|
||||
$point = -1;
|
||||
$output = $this->updateVotedCountCancel($comment_srl, $oComment, $point);
|
||||
|
|
@ -193,13 +211,13 @@ class commentController extends comment
|
|||
{
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$comment_srl = Context::get('target_srl');
|
||||
if(!$comment_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
// if an user select message from options, message would be the option.
|
||||
|
|
@ -1653,13 +1671,13 @@ class commentController extends comment
|
|||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($srl);
|
||||
if (!$module_info->module_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$module_grant = $oModuleModel->getGrant($module_info, $logged_info);
|
||||
if (!$module_grant->manager)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$module_srl[] = $srl;
|
||||
|
|
@ -1727,7 +1745,7 @@ class commentController extends comment
|
|||
{
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$commentSrls = Context::get('comment_srls');
|
||||
|
|
|
|||
|
|
@ -977,7 +977,7 @@ class commentModel extends comment
|
|||
$comment_srl = Context::get('comment_srl');
|
||||
if(!$comment_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$point = Context::get('point');
|
||||
|
|
@ -991,7 +991,7 @@ class commentModel extends comment
|
|||
$module_srl = $oComment->get('module_srl');
|
||||
if(!$module_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
|
|
@ -1003,7 +1003,7 @@ class commentModel extends comment
|
|||
{
|
||||
if($comment_config->use_vote_down != 'S')
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$args->below_point = 0;
|
||||
|
|
@ -1012,7 +1012,7 @@ class commentModel extends comment
|
|||
{
|
||||
if($comment_config->use_vote_up != 'S')
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$args->more_point = 0;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class commentView extends comment
|
|||
// A message appears if the user is not logged-in
|
||||
if(!$oMemberModel->isLogged())
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
throw new Rhymix\Framework\Exceptions\MustLogin;
|
||||
}
|
||||
|
||||
// Create the comment object.
|
||||
|
|
@ -82,12 +82,12 @@ class commentView extends comment
|
|||
$oComment = $oCommentModel->getComment($comment_srl);
|
||||
if(!$oComment->isExists())
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
// Check permissions
|
||||
if(!$oComment->isAccessible())
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
// Browser title settings
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ class documentAdminController extends document
|
|||
$eid = Context::get('eid');
|
||||
$obj = new stdClass();
|
||||
|
||||
if(!$module_srl || !$name || !$eid) return $this->setError('msg_invalid_request');
|
||||
if(!$module_srl || !$name || !$eid) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
// set the max value if idx is not specified
|
||||
if(!$var_idx)
|
||||
{
|
||||
|
|
@ -156,7 +156,7 @@ class documentAdminController extends document
|
|||
$output = executeQuery('document.isExistsExtraKey', $obj);
|
||||
if(!$output->toBool() || $output->data->count)
|
||||
{
|
||||
return $this->setError('msg_extra_name_exists');
|
||||
throw new Rhymix\Framework\Exception('msg_extra_name_exists');
|
||||
}
|
||||
|
||||
// insert or update
|
||||
|
|
@ -178,7 +178,7 @@ class documentAdminController extends document
|
|||
{
|
||||
$module_srl = Context::get('module_srl');
|
||||
$var_idx = Context::get('var_idx');
|
||||
if(!$module_srl || !$var_idx) return $this->setError('msg_invalid_request');
|
||||
if(!$module_srl || !$var_idx) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oDocumentController = getController('document');
|
||||
$output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx);
|
||||
|
|
@ -197,26 +197,26 @@ class documentAdminController extends document
|
|||
$module_srl = Context::get('module_srl');
|
||||
$var_idx = Context::get('var_idx');
|
||||
|
||||
if(!$type || !$module_srl || !$var_idx) return $this->setError('msg_invalid_request');
|
||||
if(!$type || !$module_srl || !$var_idx) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
|
||||
if(!$module_info->module_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$module_info->module_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oDocumentModel = getModel('document');
|
||||
$extra_keys = $oDocumentModel->getExtraKeys($module_srl);
|
||||
if(!$extra_keys[$var_idx]) return $this->setError('msg_invalid_request');
|
||||
if(!$extra_keys[$var_idx]) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
if($type == 'up') $new_idx = $var_idx-1;
|
||||
else $new_idx = $var_idx+1;
|
||||
if($new_idx<1) return $this->setError('msg_invalid_request');
|
||||
if($new_idx<1) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$args = new stdClass();
|
||||
$args->module_srl = $module_srl;
|
||||
$args->var_idx = $new_idx;
|
||||
$output = executeQuery('document.getDocumentExtraKeys', $args);
|
||||
if (!$output->toBool()) return $output;
|
||||
if (!$output->data) return $this->setError('msg_invalid_request');
|
||||
if (!$output->data) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
unset($args);
|
||||
|
||||
// update immediately if there is no idx to change
|
||||
|
|
@ -320,7 +320,7 @@ class documentAdminController extends document
|
|||
$member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl'));
|
||||
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
|
||||
{
|
||||
return $this->setError('msg_admin_document_no_move_to_trash');
|
||||
throw new Rhymix\Framework\Exception('msg_admin_document_no_move_to_trash');
|
||||
}
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
|
|
@ -627,7 +627,7 @@ class documentAdminController extends document
|
|||
|
||||
//DB restore
|
||||
$output = $oDocumentController->insertDocument($originObject, false, true, false);
|
||||
if(!$output->toBool()) return $this->setError($output->getMessage());
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
//FILE restore
|
||||
$oDocument = $oDocumentModel->getDocument($originObject->document_srl);
|
||||
|
|
|
|||
|
|
@ -28,21 +28,21 @@ class documentController extends document
|
|||
{
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
$document_srl = Context::get('target_srl');
|
||||
if(!$document_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$document_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oDocumentModel = getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
|
||||
$module_srl = $oDocument->get('module_srl');
|
||||
if(!$module_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$module_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
|
||||
if($document_config->use_vote_up=='N') return $this->setError('msg_invalid_request');
|
||||
if($document_config->use_vote_up=='N') throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$point = 1;
|
||||
$output = $this->updateVotedCount($document_srl, $point);
|
||||
|
|
@ -60,18 +60,18 @@ class documentController extends document
|
|||
{
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
$document_srl = Context::get('target_srl');
|
||||
if(!$document_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$document_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oDocumentModel = getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
|
||||
if($oDocument->get('voted_count') <= 0)
|
||||
{
|
||||
return $this->setError('msg_document_voted_cancel_not');
|
||||
throw new Rhymix\Framework\Exception('msg_document_voted_cancel_not');
|
||||
}
|
||||
$point = 1;
|
||||
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
|
||||
|
|
@ -114,21 +114,21 @@ class documentController extends document
|
|||
{
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
$document_srl = Context::get('target_srl');
|
||||
if(!$document_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$document_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oDocumentModel = getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
|
||||
$module_srl = $oDocument->get('module_srl');
|
||||
if(!$module_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$module_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
|
||||
if($document_config->use_vote_down=='N') return $this->setError('msg_invalid_request');
|
||||
if($document_config->use_vote_down=='N') throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$point = -1;
|
||||
$output = $this->updateVotedCount($document_srl, $point);
|
||||
|
|
@ -146,18 +146,18 @@ class documentController extends document
|
|||
{
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
$document_srl = Context::get('target_srl');
|
||||
if(!$document_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$document_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oDocumentModel = getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
|
||||
if($oDocument->get('blamed_count') >= 0)
|
||||
{
|
||||
return $this->setError('msg_document_voted_cancel_not');
|
||||
throw new Rhymix\Framework\Exception('msg_document_voted_cancel_not');
|
||||
}
|
||||
$point = -1;
|
||||
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
|
||||
|
|
@ -229,13 +229,13 @@ class documentController extends document
|
|||
{
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->setError('msg_not_logged');
|
||||
throw new Rhymix\Framework\Exceptions\MustLogin;
|
||||
}
|
||||
|
||||
$document_srl = intval(Context::get('target_srl'));
|
||||
if(!$document_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
// if an user select message from options, message would be the option.
|
||||
|
|
@ -2495,7 +2495,10 @@ class documentController extends document
|
|||
*/
|
||||
function procDocumentAddCart()
|
||||
{
|
||||
if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
// Get document_srl
|
||||
$srls = explode(',',Context::get('srls'));
|
||||
|
|
@ -2587,12 +2590,12 @@ class documentController extends document
|
|||
$module_info = getModel('module')->getModuleInfoByModuleSrl($obj->target_module_srl);
|
||||
if (!$module_info->module_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
$module_grant = getModel('module')->getGrant($module_info, $logged_info);
|
||||
if (!$module_grant->manager)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2608,7 +2611,7 @@ class documentController extends document
|
|||
$obj->document_list = getModel('document')->getDocuments($obj->document_srl_list, false, false);
|
||||
if(empty($obj->document_list))
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
// Call a trigger (before)
|
||||
|
|
@ -2623,7 +2626,7 @@ class documentController extends document
|
|||
{
|
||||
if(!$obj->target_module_srl)
|
||||
{
|
||||
return $this->setError('fail_to_move');
|
||||
throw new Rhymix\Framework\Exception('fail_to_move');
|
||||
}
|
||||
|
||||
$output = $oController->moveDocumentModule($obj->document_srl_list, $obj->target_module_srl, $obj->target_category_srl);
|
||||
|
|
@ -2638,7 +2641,7 @@ class documentController extends document
|
|||
{
|
||||
if(!$obj->target_module_srl)
|
||||
{
|
||||
return $this->setError('fail_to_move');
|
||||
throw new Rhymix\Framework\Exception('fail_to_move');
|
||||
}
|
||||
|
||||
$output = $oController->copyDocumentModule($obj->document_srl_list, $obj->target_module_srl, $obj->target_category_srl);
|
||||
|
|
@ -2695,7 +2698,7 @@ class documentController extends document
|
|||
}
|
||||
else
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
// Call a trigger (after)
|
||||
|
|
@ -2764,13 +2767,13 @@ Content;
|
|||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($srl);
|
||||
if (!$module_info->module_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$module_grant = $oModuleModel->getGrant($module_info, $logged_info);
|
||||
if (!$module_grant->manager)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$module_srl[] = $srl;
|
||||
|
|
@ -2811,7 +2814,7 @@ Content;
|
|||
{
|
||||
if(!$this->module_srl)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$obj = Context::getRequestVars();
|
||||
|
|
@ -2834,12 +2837,12 @@ Content;
|
|||
{
|
||||
if(!$oDocument->isGranted())
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
if($oDocument->get('status') != $this->getConfigStatus('temp'))
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$output = $this->updateDocument($oDocument, $obj);
|
||||
|
|
@ -2871,7 +2874,11 @@ Content;
|
|||
*/
|
||||
function procDocumentGetList()
|
||||
{
|
||||
if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$documentSrls = Context::get('document_srls');
|
||||
if($documentSrls) $documentSrlList = explode(',', $documentSrls);
|
||||
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ class documentModel extends document
|
|||
$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
|
||||
$module_srl = $oDocument->get('module_srl');
|
||||
$member_srl = $oDocument->get('member_srl');
|
||||
if(!$module_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$module_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
|
||||
|
|
@ -855,7 +855,7 @@ class documentModel extends document
|
|||
*/
|
||||
function getDocumentCategories()
|
||||
{
|
||||
if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
|
||||
if(!Context::get('is_logged')) throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
$module_srl = Context::get('module_srl');
|
||||
$categories= $this->getCategoryList($module_srl);
|
||||
$lang = Context::get('lang');
|
||||
|
|
@ -950,13 +950,13 @@ class documentModel extends document
|
|||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
|
||||
// Check permissions
|
||||
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
|
||||
if(!$grant->manager) return $this->setError('msg_not_permitted');
|
||||
if(!$grant->manager) throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
|
||||
$category_srl = Context::get('category_srl');
|
||||
$category_info = $this->getCategory($category_srl);
|
||||
if(!$category_info)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$this->add('category_info', $category_info);
|
||||
|
|
@ -1138,7 +1138,7 @@ class documentModel extends document
|
|||
{
|
||||
$args = new stdClass;
|
||||
$document_srl = Context::get('document_srl');
|
||||
if(!$document_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$document_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$point = Context::get('point');
|
||||
if($point != -1) $point = 1;
|
||||
|
|
@ -1147,18 +1147,18 @@ class documentModel extends document
|
|||
$columnList = array('document_srl', 'module_srl');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
|
||||
$module_srl = $oDocument->get('module_srl');
|
||||
if(!$module_srl) return $this->setError('msg_invalid_request');
|
||||
if(!$module_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
|
||||
if($point == -1)
|
||||
{
|
||||
if($document_config->use_vote_down!='S') return $this->setError('msg_invalid_request');
|
||||
if($document_config->use_vote_down!='S') throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
$args->below_point = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($document_config->use_vote_up!='S') return $this->setError('msg_invalid_request');
|
||||
if($document_config->use_vote_up!='S') throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
$args->more_point = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ class documentView extends document
|
|||
$oDocumentModel = getModel('document');
|
||||
// Creates an object for displaying the selected document
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
|
||||
if(!$oDocument->isExists()) return $this->setError('msg_invalid_request');
|
||||
if(!$oDocument->isExists()) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
// Check permissions
|
||||
if(!$oDocument->isAccessible()) return $this->setError('msg_not_permitted');
|
||||
if(!$oDocument->isAccessible()) throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
// Information setting module
|
||||
//Context::set('module_info', $module_info); //module_info not use in UI
|
||||
// Browser title settings
|
||||
|
|
@ -58,7 +58,7 @@ class documentView extends document
|
|||
{
|
||||
if(!checkCSRF())
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$content = Context::get('content');
|
||||
|
|
@ -87,7 +87,7 @@ class documentView extends document
|
|||
*/
|
||||
function dispDocumentManageDocument()
|
||||
{
|
||||
if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
|
||||
if(!Context::get('is_logged')) throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
// Taken from a list of selected sessions
|
||||
$flag_list = $_SESSION['document_management'];
|
||||
if(count($flag_list))
|
||||
|
|
@ -206,7 +206,7 @@ class documentView extends document
|
|||
// A message appears if the user is not logged-in
|
||||
if(!$oMemberModel->isLogged())
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
throw new Rhymix\Framework\Exceptions\MustLogin;
|
||||
}
|
||||
|
||||
// Create the document object. If the document module of basic data structures, write it all works .. -_-;
|
||||
|
|
@ -215,12 +215,12 @@ class documentView extends document
|
|||
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager, FALSE);
|
||||
if(!$oDocument->isExists())
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
// Check permissions
|
||||
if(!$oDocument->isAccessible())
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
// Browser title settings
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class fileAdminController extends file
|
|||
{
|
||||
if ($config->allowed_filesize > 2047 || $config->allowed_attach_size > 2047)
|
||||
{
|
||||
return $this->setError('msg_32bit_max_2047mb');
|
||||
throw new Rhymix\Framework\Exception('msg_32bit_max_2047mb');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ class fileAdminController extends file
|
|||
{
|
||||
if ($file_config->allowed_filesize > 2047 || $file_config->allowed_attach_size > 2047)
|
||||
{
|
||||
return $this->setError('msg_32bit_max_2047mb');
|
||||
throw new Rhymix\Framework\Exception('msg_32bit_max_2047mb');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class fileController extends file
|
|||
// Exit a session if there is neither upload permission nor information
|
||||
if(!$_SESSION['upload_info'][$editor_sequence]->enabled)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
// Get upload_target_srl
|
||||
|
|
@ -63,7 +63,7 @@ class fileController extends file
|
|||
$total_size = intval($matches[3]);
|
||||
if ($chunk_start < 0 || $chunk_size < 0 || $total_size < 0 || $chunk_start + $chunk_size > $total_size || $chunk_size != $file_info['size'])
|
||||
{
|
||||
return $this->setError('msg_upload_invalid_chunk');
|
||||
throw new Rhymix\Framework\Exception('msg_upload_invalid_chunk');
|
||||
}
|
||||
$this->add('chunk_current_size', $chunk_size);
|
||||
$this->add('chunk_uploaded_size', $chunk_start);
|
||||
|
|
@ -76,13 +76,13 @@ class fileController extends file
|
|||
{
|
||||
Rhymix\Framework\Storage::delete($temp_filename);
|
||||
$this->add('chunk_status', 11);
|
||||
return $this->setError('msg_upload_invalid_chunk');
|
||||
throw new Rhymix\Framework\Exception('msg_upload_invalid_chunk');
|
||||
}
|
||||
if ($chunk_start != 0 && (!Rhymix\Framework\Storage::isFile($temp_filename) || Rhymix\Framework\Storage::getSize($temp_filename) != $chunk_start))
|
||||
{
|
||||
Rhymix\Framework\Storage::delete($temp_filename);
|
||||
$this->add('chunk_status', 12);
|
||||
return $this->setError('msg_upload_invalid_chunk');
|
||||
throw new Rhymix\Framework\Exception('msg_upload_invalid_chunk');
|
||||
}
|
||||
|
||||
// Check size limit
|
||||
|
|
@ -95,13 +95,13 @@ class fileController extends file
|
|||
if ($total_size > $allowed_filesize)
|
||||
{
|
||||
$this->add('chunk_status', 21);
|
||||
return $this->setError('msg_exceeds_limit_size');
|
||||
throw new Rhymix\Framework\Exception('msg_exceeds_limit_size');
|
||||
}
|
||||
$output = executeQuery('file.getAttachedFileSize', (object)array('upload_target_srl' => $upload_target_srl));
|
||||
if (intval($output->data->attached_size) + $total_size > $allowed_attach_size)
|
||||
{
|
||||
$this->add('chunk_status', 22);
|
||||
return $this->setError('msg_exceeds_limit_size');
|
||||
throw new Rhymix\Framework\Exception('msg_exceeds_limit_size');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ class fileController extends file
|
|||
{
|
||||
Rhymix\Framework\Storage::delete($temp_filename);
|
||||
$this->add('chunk_status', 40);
|
||||
return $this->setError('msg_upload_invalid_chunk');
|
||||
throw new Rhymix\Framework\Exception('msg_upload_invalid_chunk');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -207,14 +207,14 @@ class fileController extends file
|
|||
|
||||
if(!$file_srl || !$width)
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$oFileModel = getModel('file');
|
||||
$fileInfo = $oFileModel->getFile($file_srl);
|
||||
if(!$fileInfo || $fileInfo->direct_download != 'Y')
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$source_src = $fileInfo->uploaded_filename;
|
||||
|
|
@ -230,7 +230,7 @@ class fileController extends file
|
|||
}
|
||||
else
|
||||
{
|
||||
return $this->setError('msg_invalid_request');
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$this->add('resized_info',$output);
|
||||
|
|
@ -271,7 +271,10 @@ class fileController extends file
|
|||
{
|
||||
$oFileModel = getModel('file');
|
||||
|
||||
if(isset($this->grant->access) && $this->grant->access !== true) return $this->setError('msg_not_permitted');
|
||||
if(isset($this->grant->access) && $this->grant->access !== true)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$file_srl = Context::get('file_srl');
|
||||
$sid = Context::get('sid');
|
||||
|
|
@ -586,11 +589,15 @@ class fileController extends file
|
|||
*/
|
||||
function procFileGetList()
|
||||
{
|
||||
if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin !== 'Y' && !getModel('module')->isSiteAdmin($logged_info))
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$fileSrls = Context::get('file_srls');
|
||||
|
|
@ -842,13 +849,13 @@ class fileController extends file
|
|||
$allowed_filesize = $config->allowed_filesize * 1024 * 1024;
|
||||
$allowed_attach_size = $config->allowed_attach_size * 1024 * 1024;
|
||||
// An error appears if file size exceeds a limit
|
||||
if($allowed_filesize < filesize($file_info['tmp_name'])) return $this->setError('msg_exceeds_limit_size');
|
||||
if($allowed_filesize < filesize($file_info['tmp_name'])) throw new Rhymix\Framework\Exception('msg_exceeds_limit_size');
|
||||
// Get total file size of all attachements (from DB)
|
||||
$size_args = new stdClass;
|
||||
$size_args->upload_target_srl = $upload_target_srl;
|
||||
$output = executeQuery('file.getAttachedFileSize', $size_args);
|
||||
$attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']);
|
||||
if($attached_size > $allowed_attach_size) return $this->setError('msg_exceeds_limit_size');
|
||||
if($attached_size > $allowed_attach_size) throw new Rhymix\Framework\Exception('msg_exceeds_limit_size');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -885,7 +892,7 @@ class fileController extends file
|
|||
// Create a directory
|
||||
if(!Rhymix\Framework\Storage::isDirectory($path) && !Rhymix\Framework\Storage::createDirectory($path))
|
||||
{
|
||||
return $this->setError('msg_not_permitted_create');
|
||||
throw new Rhymix\Framework\Exception('msg_not_permitted_create');
|
||||
}
|
||||
|
||||
// Move the file
|
||||
|
|
@ -897,7 +904,7 @@ class fileController extends file
|
|||
@copy($file_info['tmp_name'], $filename);
|
||||
if(!file_exists($filename))
|
||||
{
|
||||
return $this->setError('msg_file_upload_error');
|
||||
throw new Rhymix\Framework\Exception('msg_file_upload_error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -907,7 +914,7 @@ class fileController extends file
|
|||
{
|
||||
if (!Rhymix\Framework\Storage::move($file_info['tmp_name'], $filename))
|
||||
{
|
||||
return $this->setError('msg_file_upload_error');
|
||||
throw new Rhymix\Framework\Exception('msg_file_upload_error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -917,7 +924,7 @@ class fileController extends file
|
|||
{
|
||||
if(!@move_uploaded_file($file_info['tmp_name'], $filename))
|
||||
{
|
||||
return $this->setError('msg_file_upload_error');
|
||||
throw new Rhymix\Framework\Exception('msg_file_upload_error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1173,16 +1180,16 @@ class fileController extends file
|
|||
$vars = Context::getRequestVars();
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
if(!$vars->editor_sequence) return $this->setError('msg_invalid_request');
|
||||
if(!$vars->editor_sequence) throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
|
||||
$upload_target_srl = $_SESSION['upload_info'][$vars->editor_sequence]->upload_target_srl;
|
||||
|
||||
$oFileModel = getModel('file');
|
||||
$file_info = $oFileModel->getFile($vars->file_srl);
|
||||
|
||||
if(!$file_info) return $this->setError('msg_not_founded');
|
||||
if(!$file_info) throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||
|
||||
if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return $this->setError('msg_not_permitted');
|
||||
if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
|
||||
$args = new stdClass();
|
||||
$args->file_srl = $vars->file_srl;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class fileModel extends file
|
|||
$oComment = $oCommentModel->getComment($upload_target_srl);
|
||||
if($oComment->isExists() && !$oComment->isAccessible())
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
$oDocument = $oDocumentModel->getDocument($oComment->get('document_srl'));
|
||||
|
|
@ -54,7 +54,7 @@ class fileModel extends file
|
|||
// document 권한 확인
|
||||
if($oDocument->isExists() && !$oDocument->isAccessible())
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
// 모듈 권한 확인
|
||||
|
|
@ -63,7 +63,7 @@ class fileModel extends file
|
|||
$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($oDocument->get('module_srl')), $logged_info);
|
||||
if(!$grant->access)
|
||||
{
|
||||
return $this->setError('msg_not_permitted');
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue