mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-05 20:18:42 +00:00
Formatting
This commit is contained in:
parent
27c4001ee8
commit
956aebb640
|
|
@ -151,7 +151,7 @@ class ModuleManager
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$c = count($uriHash);
|
$c = count($uriHash);
|
||||||
for($k = 0; $k < $c; $k++) {
|
for ($k = 0; $k < $c; $k++) {
|
||||||
$uriPdo .= ':pid' . $i . ',';
|
$uriPdo .= ':pid' . $i . ',';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
@ -249,7 +249,7 @@ class ModuleManager
|
||||||
$path = realpath($oldPath = self::MODULE_PATH . '/' . $files[$i] . '/info.json');
|
$path = realpath($oldPath = self::MODULE_PATH . '/' . $files[$i] . '/info.json');
|
||||||
|
|
||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
if(strpos($path, self::MODULE_PATH) === false) {
|
if (strpos($path, self::MODULE_PATH) === false) {
|
||||||
throw new FilePathException($oldPath);
|
throw new FilePathException($oldPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -299,13 +299,13 @@ class ModuleManager
|
||||||
$path = realpath($oldPath = self::MODULE_PATH . '/' . $module . '/' . 'info.json');
|
$path = realpath($oldPath = self::MODULE_PATH . '/' . $module . '/' . 'info.json');
|
||||||
|
|
||||||
if ($path !== false) {
|
if ($path !== false) {
|
||||||
if(strpos($path, self::MODULE_PATH) === false) {
|
if (strpos($path, self::MODULE_PATH) === false) {
|
||||||
throw new FilePathException($oldPath);
|
throw new FilePathException($oldPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
$info = json_decode(file_get_contents($path), true);
|
$info = json_decode(file_get_contents($path), true);
|
||||||
|
|
||||||
if(!isset($info)) {
|
if (!isset($info)) {
|
||||||
throw new InvalidJsonException($path);
|
throw new InvalidJsonException($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -431,11 +431,11 @@ class ModuleManager
|
||||||
foreach ($module as $m) {
|
foreach ($module as $m) {
|
||||||
$this->initModule($m);
|
$this->initModule($m);
|
||||||
}
|
}
|
||||||
} elseif (is_string($module)) {
|
} elseif (is_string($module) && realpath(self::MODULE_PATH . '/' . $module . '/Controller.php') !== false) {
|
||||||
$this->running[$module] = ModuleFactory::getInstance($module, $this->app);
|
$this->running[$module] = ModuleFactory::getInstance($module, $this->app);
|
||||||
$this->app->dispatcher->set($this->running[$module], '\Modules\\' . $module . '\\Controller');
|
$this->app->dispatcher->set($this->running[$module], '\Modules\\' . $module . '\\Controller');
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException('Unknown parameter');
|
throw new \InvalidArgumentException('Invalid Module');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -451,7 +451,11 @@ class ModuleManager
|
||||||
*/
|
*/
|
||||||
public function get(\string $module)
|
public function get(\string $module)
|
||||||
{
|
{
|
||||||
return isset($this->running[$module]) ? $this->running[$module] : null;
|
if (!isset($this->running[$module])) {
|
||||||
|
$this->initModule($module);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->running[$module];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user