From 582024daf46551b491295ab91e745be14d991ffc Mon Sep 17 00:00:00 2001 From: conory Date: Fri, 5 Aug 2022 23:31:02 +0900 Subject: [PATCH] Fix 99d16d84c324f2f6f1b0aa09aa24d82852b4b01f --- modules/comment/comment.controller.php | 24 +++++++--------------- modules/comment/comment.item.php | 7 ++++++- modules/document/document.controller.php | 26 ++++++++---------------- modules/document/document.item.php | 7 ++++++- 4 files changed, 27 insertions(+), 37 deletions(-) diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index d291112ab..60ae7e1bb 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -42,18 +42,13 @@ class commentController extends comment $oComment = CommentModel::getComment($comment_srl, false, false); if(!$oComment->isExists()) { - throw new Rhymix\Framework\Exceptions\InvalidRequest; + throw new Rhymix\Framework\Exceptions\TargetNotFound; } if(!$oComment->isAccessible(true)) { throw new Rhymix\Framework\Exceptions\NotPermitted; } - $module_srl = $oComment->get('module_srl'); - if(!$module_srl) - { - throw new Rhymix\Framework\Exceptions\InvalidRequest; - } - $comment_config = ModuleModel::getModulePartConfig('comment', $module_srl); + $comment_config = ModuleModel::getModulePartConfig('comment', $oComment->get('module_srl')); if($comment_config->use_vote_up === 'N') { throw new Rhymix\Framework\Exceptions\FeatureDisabled; @@ -83,7 +78,7 @@ class commentController extends comment $oComment = CommentModel::getComment($comment_srl, false, false); if(!$oComment->isExists()) { - throw new Rhymix\Framework\Exceptions\InvalidRequest; + throw new Rhymix\Framework\Exceptions\TargetNotFound; } if(!$oComment->isAccessible(true)) { @@ -126,18 +121,13 @@ class commentController extends comment $oComment = CommentModel::getComment($comment_srl, false, false); if(!$oComment->isExists()) { - throw new Rhymix\Framework\Exceptions\InvalidRequest; + throw new Rhymix\Framework\Exceptions\TargetNotFound; } if(!$oComment->isAccessible(true)) { throw new Rhymix\Framework\Exceptions\NotPermitted; } - $module_srl = $oComment->get('module_srl'); - if(!$module_srl) - { - throw new Rhymix\Framework\Exceptions\InvalidRequest; - } - $comment_config = ModuleModel::getModulePartConfig('comment', $module_srl); + $comment_config = ModuleModel::getModulePartConfig('comment', $oComment->get('module_srl')); if($comment_config->use_vote_down === 'N') { throw new Rhymix\Framework\Exceptions\FeatureDisabled; @@ -167,7 +157,7 @@ class commentController extends comment $oComment = CommentModel::getComment($comment_srl, false, false); if(!$oComment->isExists()) { - throw new Rhymix\Framework\Exceptions\InvalidRequest; + throw new Rhymix\Framework\Exceptions\TargetNotFound; } if(!$oComment->isAccessible(true)) { @@ -280,7 +270,7 @@ class commentController extends comment $oComment = CommentModel::getComment($comment_srl, false, false); if(!$oComment->isExists()) { - throw new Rhymix\Framework\Exceptions\InvalidRequest; + throw new Rhymix\Framework\Exceptions\TargetNotFound; } if(!$oComment->isAccessible(true)) { diff --git a/modules/comment/comment.item.php b/modules/comment/comment.item.php index 101f04be8..1ef079dde 100644 --- a/modules/comment/comment.item.php +++ b/modules/comment/comment.item.php @@ -197,7 +197,12 @@ class commentItem extends BaseObject if ($strict) { - $grant = ModuleModel::getGrant(ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl')), Context::get('logged_info')); + $module_info = ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl')); + if (!$module_info) + { + return false; + } + $grant = ModuleModel::getGrant($module_info, Context::get('logged_info')); if (isset($grant->list) && isset($grant->view) && ($grant->list !== true || $grant->view !== true)) { return false; diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index fdeb62392..0b6f9a18e 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -46,18 +46,13 @@ class documentController extends document $oDocument = DocumentModel::getDocument($document_srl, false, false); if(!$oDocument->isExists()) { - throw new Rhymix\Framework\Exceptions\InvalidRequest; + throw new Rhymix\Framework\Exceptions\TargetNotFound; } if(!$oDocument->isAccessible(true)) { throw new Rhymix\Framework\Exceptions\NotPermitted; } - $module_srl = $oDocument->get('module_srl'); - if(!$module_srl) - { - throw new Rhymix\Framework\Exceptions\InvalidRequest; - } - $document_config = ModuleModel::getModulePartConfig('document', $module_srl); + $document_config = ModuleModel::getModulePartConfig('document', $oDocument->get('module_srl')); if($document_config->use_vote_up === 'N') { throw new Rhymix\Framework\Exceptions\FeatureDisabled; @@ -101,7 +96,7 @@ class documentController extends document $oDocument = DocumentModel::getDocument($document_srl, false, false); if(!$oDocument->isExists()) { - throw new Rhymix\Framework\Exceptions\InvalidRequest; + throw new Rhymix\Framework\Exceptions\TargetNotFound; } if(!$oDocument->isAccessible(true)) { @@ -165,18 +160,13 @@ class documentController extends document $oDocument = DocumentModel::getDocument($document_srl, false, false); if(!$oDocument->isExists()) { - throw new Rhymix\Framework\Exceptions\InvalidRequest; + throw new Rhymix\Framework\Exceptions\TargetNotFound; } if(!$oDocument->isAccessible(true)) { throw new Rhymix\Framework\Exceptions\NotPermitted; } - $module_srl = $oDocument->get('module_srl'); - if(!$module_srl) - { - throw new Rhymix\Framework\Exceptions\InvalidRequest; - } - $document_config = ModuleModel::getModulePartConfig('document', $module_srl); + $document_config = ModuleModel::getModulePartConfig('document', $oDocument->get('module_srl')); if($document_config->use_vote_down === 'N') { throw new Rhymix\Framework\Exceptions\FeatureDisabled; @@ -214,7 +204,7 @@ class documentController extends document $oDocument = DocumentModel::getDocument($document_srl, false, false); if(!$oDocument->isExists()) { - throw new Rhymix\Framework\Exceptions\InvalidRequest; + throw new Rhymix\Framework\Exceptions\TargetNotFound; } if(!$oDocument->isAccessible(true)) { @@ -341,7 +331,7 @@ class documentController extends document $oDocument = DocumentModel::getDocument($document_srl, false, false); if(!$oDocument->isExists()) { - throw new Rhymix\Framework\Exceptions\InvalidRequest; + throw new Rhymix\Framework\Exceptions\TargetNotFound; } if(!$oDocument->isAccessible(true)) { @@ -383,7 +373,7 @@ class documentController extends document $oDocument = DocumentModel::getDocument($document_srl, false, false); if(!$oDocument->isExists()) { - throw new Rhymix\Framework\Exceptions\InvalidRequest; + throw new Rhymix\Framework\Exceptions\TargetNotFound; } if(!$oDocument->isAccessible(true)) { diff --git a/modules/document/document.item.php b/modules/document/document.item.php index 33a94f5cf..a1ce96627 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -246,7 +246,12 @@ class documentItem extends BaseObject if ($strict) { - $grant = ModuleModel::getGrant(ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl')), Context::get('logged_info')); + $module_info = ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl')); + if (!$module_info) + { + return false; + } + $grant = ModuleModel::getGrant($module_info, Context::get('logged_info')); if (isset($grant->list) && isset($grant->view) && ($grant->list !== true || $grant->view !== true)) { return false;