diff --git a/framework/base/control.class.php b/framework/base/control.class.php index beacf736e7..50af4bd741 100644 --- a/framework/base/control.class.php +++ b/framework/base/control.class.php @@ -783,8 +783,8 @@ class baseControl $moduleControlFile = $modulePath . 'control.php'; $actionExtPath = $this->app->getModuleExtPath($appName, $moduleName, 'control'); $file2Included = $moduleControlFile; + $classNameToFetch = $moduleName; - $realClassName = $moduleName; if(!empty($actionExtPath)) { /** @@ -804,9 +804,8 @@ class baseControl $file2Included = file_exists($siteActionExtFile) ? $siteActionExtFile : $file2Included; } - /* Get real class name to include extended file. */ - if(strpos($file2Included, DS . 'ext' . DS) !== false) $realClassName = stripos(file_get_contents($file2Included), "class my{$moduleName} extends $moduleName") === false ? $moduleName : "my{$moduleName}"; - + /* If class name is my{$moduleName} then set classNameToFetch for include this file. */ + if(strpos($file2Included, DS . 'ext' . DS) !== false and stripos(file_get_contents($file2Included), "class my{$moduleName} extends $moduleName") !== false) $classNameToFetch = "my{$moduleName}"; } /** @@ -814,7 +813,7 @@ class baseControl * Load the control file. */ if(!is_file($file2Included)) $this->app->triggerError("The control file $file2Included not found", __FILE__, __LINE__, $exit = true); - if(!class_exists($realClassName)) + if(!class_exists($classNameToFetch)) { chdir(dirname($file2Included)); helper::import($file2Included);