diff --git a/gulliver/system/class.controller.php b/gulliver/system/class.controller.php index 2fc779ea9..f61e25eaf 100755 --- a/gulliver/system/class.controller.php +++ b/gulliver/system/class.controller.php @@ -15,6 +15,7 @@ class Controller * @var boolean debug switch for general purpose */ public $debug = null; + /** * * @var array - private array to store proxy data @@ -45,6 +46,18 @@ class Controller */ private $layout = ''; + /** + * + * @var string contains the pluin name, in case the controller is on a plugin + */ + private $pluginName = ''; + + /** + * + * @var string contains the plugin path + */ + private $pluginHomeDir = ''; + /** * Magic setter method * @@ -292,5 +305,25 @@ class Controller { G::header( "Location: $url" ); } + + public function setPluginName($name) + { + $this->pluginName = $name; + } + + public function getPluginName() + { + return $this->pluginName; + } + + public function setPluginHomeDir($dir) + { + $this->pluginHomeDir = $dir; + } + + public function getPluginHomeDir() + { + return $this->pluginHomeDir; + } } diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index 2836b0696..b8e5219ff 100755 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -828,17 +828,17 @@ if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') { if (is_file($pluginControllerPath. $controllerClass . '.php')) { require_once $pluginControllerPath. $controllerClass . '.php'; - $isControllerCall = true; } elseif (is_file($pluginControllerPath. ucfirst($controllerClass) . '.php')) { $controllerClass = ucfirst($controllerClass); require_once $pluginControllerPath. $controllerClass . '.php'; - $isControllerCall = true; } elseif (is_file($pluginControllerPath. ucfirst($controllerClass) . 'Controller.php')) { $controllerClass = ucfirst($controllerClass) . 'Controller'; require_once $pluginControllerPath. $controllerClass . '.php'; + } + + //if the method exists + if (is_callable(array($controllerClass, $controllerAction))) { $isControllerCall = true; - } else { - $isControllerCall = false; } } @@ -986,6 +986,12 @@ if (! defined( 'EXECUTE_BY_CRON' )) { $controller = new $controllerClass(); $controller->setHttpRequestData($_REQUEST);//NewRelic Snippet - By JHL transactionLog($controllerAction); + + if ($isPluginController) { + $controller->setPluginName($pluginName); + $controller->setPluginHomeDir(PATH_PLUGINS . $pluginName . PATH_SEP); + } + $controller->call($controllerAction); } elseif ($isRestRequest) { //NewRelic Snippet - By JHL