From 771727ca48c0018eab62bf39b2b282cdbc4d9233 Mon Sep 17 00:00:00 2001 From: Abel Hoogeveen Date: Sat, 14 Mar 2015 17:03:15 +0100 Subject: [PATCH 1/2] Bugfixes for module loading --- Core/System/class.core.php | 10 ++++++---- Core/System/class.events.php | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Core/System/class.core.php b/Core/System/class.core.php index 48e230a..171452c 100644 --- a/Core/System/class.core.php +++ b/Core/System/class.core.php @@ -65,10 +65,10 @@ class Core { ## MODLOADING public function loadMod($name, $version = null) { - if (!isset($this->mods->$name)) { - $CLASS = $this->loadModule($name); - $this->mods->{strtolower($CLASS[1])} = &$CLASS[0]; - } + $CLASS = $this->loadModule($name); + if (!isset($this->mods->{strtolower($CLASS[1])})) { + return $this->mods->{strtolower($CLASS[1])} = &$CLASS[0]; + } } public function getMod($name, $version = null) { @@ -98,6 +98,8 @@ class Core { // Check if the module is enabled, otherwise abort if (isset($cfg->enabled)) { if (!$cfg->enabled) { + // Module is disabled + throw new Exception("Module '".$name."' is not enabled!", 1); return false; } } diff --git a/Core/System/class.events.php b/Core/System/class.events.php index 441e224..8551276 100644 --- a/Core/System/class.events.php +++ b/Core/System/class.events.php @@ -158,9 +158,10 @@ class Events extends Bus{ $dir = FUZEPATH . "/Core/Mods/"; $mods = $this->config->modregister->register; foreach ($mods as $key => $value) { - $this->core->loadMod($key); + try { + $this->core->loadMod($key); + } catch (Exception $e) {} } - $event = $this->fireEvent('eventRegisterBuildEvent', ''); $this->config->set('eventregister', 'register', $event->register); From 883b45fac7798fa26f8b8fca38a22ea7eacb005e Mon Sep 17 00:00:00 2001 From: Abel Hoogeveen Date: Sun, 15 Mar 2015 11:23:56 +0100 Subject: [PATCH 2/2] Bugfix the sections module not being able to load module sections --- Core/Mods/sections/class.sections.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/Mods/sections/class.sections.php b/Core/Mods/sections/class.sections.php index a1b62f5..9ef404a 100644 --- a/Core/Mods/sections/class.sections.php +++ b/Core/Mods/sections/class.sections.php @@ -94,8 +94,8 @@ class Sections extends Module { // Logic here, first for module sections if ($section['module_section']) { - $this->core->loadMod($section['module_name']); - $event->directory = $this->mods->{$section['module_name']}->getModulePath() . "/Controller/"; + $mod = $this->core->loadMod($section['module_name']); + $event->directory = $mod->getModulePath() . "/Controller/"; } else { // Now for regular sections $event->directory = $section['controller_path'];