diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 17a5af501..20bcd4065 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -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 = $original_output; + } if(method_exists($handler, "prepareToPrint")) { diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php index 18838295b..6c2771c88 100644 --- a/classes/module/ModuleObject.class.php +++ b/classes/module/ModuleObject.class.php @@ -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') {