mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-21 11:22:34 +09:00
Merge pull request #254 from kijin/pr/addon-output-override
애드온이 중요한 변수를 함부로 덮어쓰지 못하도록 조치
This commit is contained in:
commit
0d66714eb5
2 changed files with 25 additions and 7 deletions
|
|
@ -60,12 +60,17 @@ class DisplayHandler extends Handler
|
|||
|
||||
// call a trigger before display
|
||||
ModuleHandler::triggerCall('display', 'before', $output);
|
||||
|
||||
$original_output = $output;
|
||||
|
||||
// execute add-on
|
||||
$called_position = 'before_display_content';
|
||||
$oAddonController = getController('addon');
|
||||
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
|
||||
if(file_exists($addon_file)) include($addon_file);
|
||||
if($output === false || $output === null || $output instanceof Object)
|
||||
{
|
||||
$output = $original_output;
|
||||
}
|
||||
|
||||
if(method_exists($handler, "prepareToPrint"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -447,6 +447,18 @@ class ModuleObject extends Object
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// check return value of action
|
||||
if($output instanceof Object)
|
||||
{
|
||||
$this->setError($output->getError());
|
||||
$this->setMessage($output->getMessage());
|
||||
$original_output = clone $output;
|
||||
}
|
||||
else
|
||||
{
|
||||
$original_output = null;
|
||||
}
|
||||
|
||||
// trigger call
|
||||
$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this);
|
||||
if(!$triggerOutput->toBool())
|
||||
|
|
@ -462,16 +474,17 @@ class ModuleObject extends Object
|
|||
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
|
||||
if(FileHandler::exists($addon_file)) include($addon_file);
|
||||
|
||||
if(is_a($output, 'Object') || is_subclass_of($output, 'Object'))
|
||||
if($original_output instanceof Object && !$original_output->toBool())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
elseif($output instanceof Object && $output->getError())
|
||||
{
|
||||
$this->setError($output->getError());
|
||||
$this->setMessage($output->getMessage());
|
||||
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// execute api methods of the module if view action is and result is XMLRPC or JSON
|
||||
if($this->module_info->module_type == 'view' || $this->module_info->module_type == 'mobile')
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue