mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +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
|
// call a trigger before display
|
||||||
ModuleHandler::triggerCall('display', 'before', $output);
|
ModuleHandler::triggerCall('display', 'before', $output);
|
||||||
|
$original_output = $output;
|
||||||
|
|
||||||
// execute add-on
|
// execute add-on
|
||||||
$called_position = 'before_display_content';
|
$called_position = 'before_display_content';
|
||||||
$oAddonController = getController('addon');
|
$oAddonController = getController('addon');
|
||||||
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
|
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
|
||||||
if(file_exists($addon_file)) include($addon_file);
|
if(file_exists($addon_file)) include($addon_file);
|
||||||
|
if($output === false || $output === null || $output instanceof Object)
|
||||||
|
{
|
||||||
|
$output = $original_output;
|
||||||
|
}
|
||||||
|
|
||||||
if(method_exists($handler, "prepareToPrint"))
|
if(method_exists($handler, "prepareToPrint"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -447,6 +447,18 @@ class ModuleObject extends Object
|
||||||
return FALSE;
|
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
|
// trigger call
|
||||||
$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this);
|
$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this);
|
||||||
if(!$triggerOutput->toBool())
|
if(!$triggerOutput->toBool())
|
||||||
|
|
@ -462,16 +474,17 @@ class ModuleObject extends Object
|
||||||
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
|
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
|
||||||
if(FileHandler::exists($addon_file)) include($addon_file);
|
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->setError($output->getError());
|
||||||
$this->setMessage($output->getMessage());
|
$this->setMessage($output->getMessage());
|
||||||
|
return FALSE;
|
||||||
if(!$output->toBool())
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute api methods of the module if view action is and result is XMLRPC or JSON
|
// 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')
|
if($this->module_info->module_type == 'view' || $this->module_info->module_type == 'mobile')
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue