mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Prevent addons from overwriting important variables with nonsense
This commit is contained in:
parent
8f9011a235
commit
82da535ec6
2 changed files with 25 additions and 7 deletions
|
|
@ -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