mirror of
https://github.com/fruithost/Panel.git
synced 2026-11-09 05:26:28 +09:00
Adding Ajax API, fix some module handlings, add new load method for modules
This commit is contained in:
1 parent
ecc278de48
commit
6723246bf2
7 files changed
+109
-30
No files matched your search
@@ -7,6 +7,11 @@
|
||||
|
||||
public function __construct($core) {
|
||||
$this->core = $core;
|
||||
$enabled = [];
|
||||
|
||||
foreach(Database::fetch('SELECT `name` FROM `fh_modules` WHERE `state`=\'ENABLED\'') AS $entry) {
|
||||
$enabled[] = $entry->name;
|
||||
}
|
||||
|
||||
foreach(new \DirectoryIterator($this->getPath()) AS $info) {
|
||||
if($info->isDot()) {
|
||||
@@ -14,8 +19,10 @@
|
||||
}
|
||||
|
||||
$path = sprintf('%s%s%s', $this->getPath(), DS, $info->getFilename());
|
||||
$module = new Module($path);
|
||||
$module->setEnabled(in_array(basename($path), $enabled));
|
||||
|
||||
$this->addModule(basename($path), new Module($path));
|
||||
$this->addModule(basename($path), $module);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +31,10 @@
|
||||
}
|
||||
|
||||
public function addModule($name, $module) {
|
||||
if(!$module->isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->modules[$name] = $module->init($this->core);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user