mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-18 09:52:17 +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
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue