diff --git a/application/modules/admin/controllers/admin/Layouts.php b/application/modules/admin/controllers/admin/Layouts.php index e6f557a3a..106efbb4f 100644 --- a/application/modules/admin/controllers/admin/Layouts.php +++ b/application/modules/admin/controllers/admin/Layouts.php @@ -318,11 +318,19 @@ public function advSettingsAction() public function advSettingsShowAction() { $layoutKey = $this->getRequest()->getParam('layoutKey'); + + if (!$layoutKey || !file_exists(APPLICATION_PATH . '/layouts/' . $layoutKey . '/config/config.php')) { + $this->redirect() + ->withMessage('layoutNotFoundOrInvalid', 'danger') + ->to(['action' => 'advSettings']); + } + $this->getLayout()->getAdminHmenu() ->add($this->getTranslator()->trans('menuLayouts'), ['action' => 'index']) ->add($this->getTranslator()->trans('menuSettings'), ['action' => 'settings']) ->add($this->getTranslator()->trans('menuAdvSettings'), ['action' => 'advSettings']) ->add($this->getTranslator()->trans('menuAdvSettingsShow'), ['action' => 'advSettings', 'layoutKey' => $layoutKey]); + $settings = []; $layoutPath = APPLICATION_PATH . '/layouts/' . $layoutKey; if (is_dir($layoutPath)) { diff --git a/application/modules/admin/controllers/admin/Modules.php b/application/modules/admin/controllers/admin/Modules.php index 0dcf9ee3e..513ce314e 100644 --- a/application/modules/admin/controllers/admin/Modules.php +++ b/application/modules/admin/controllers/admin/Modules.php @@ -234,7 +234,6 @@ public function updatesAction() foreach (glob(ROOT_PATH . '/application/modules/*') as $modulesPath) { $key = basename($modulesPath); - $modulesDir[] = $key; $configClass = '\\Modules\\' . ucfirst($key) . '\\Config\\Config'; if (class_exists($configClass)) { @@ -422,12 +421,21 @@ public function uninstallAction() $key = $this->getRequest()->getParam('key'); if ($this->getRequest()->isSecure()) { - $configClass = '\\Modules\\' . ucfirst($key) . '\\Config\\Config'; - $config = new $configClass($this->getTranslator()); - $config->uninstall(); - $moduleMapper->delete($key); + if ($key && file_exists(APPLICATION_PATH . '/modules/' . $key . '/config/config.php')) { + $configClass = '\\Modules\\' . ucfirst($key) . '\\Config\\Config'; + $config = new $configClass($this->getTranslator()); - $this->addMessage('deleteSuccess'); + if (!isset($config->config['system_module'])) { + $config->uninstall(); + $moduleMapper->delete($key); + + $this->addMessage('uninstallSuccess'); + } else { + $this->addMessage('uninstallDeniedSystemModule', 'danger'); + } + } else { + $this->addMessage('moduleNotFoundOrInvalid', 'danger'); + } } $this->redirect(['action' => 'index']); diff --git a/application/modules/admin/translations/de.php b/application/modules/admin/translations/de.php index 369a70f33..7e2ec9fe2 100644 --- a/application/modules/admin/translations/de.php +++ b/application/modules/admin/translations/de.php @@ -385,6 +385,8 @@ 'moduleUpdateFailed' => 'Modul konnte nicht aktualisiert werden.', 'downloadOrInstallDenied' => 'Aufgrund einer ungültigen Internetadresse wurde das Herunterladen oder Installieren des Updates nicht durchgeführt.', 'processingPleaseWait' => 'Verarbeite. Bitte warten.', + 'uninstallDeniedSystemModule' => 'Ein Systemmodul kann nicht deinstalliert werden.', + 'moduleNotFoundOrInvalid' => 'Modul nicht gefunden oder ungültig.', 'enableSelectedEntries' => 'Sollen die markierten Einträge wirklich freigeschaltet werden?', 'deleteSelectedEntries' => 'Sollen die markierten Einträge wirklich gelöscht werden?', @@ -434,6 +436,7 @@ 'menuAdvSettings' => 'Erweiterte Einstellungen', 'menuAdvSettingsShow' => 'Anzeige', 'noLayouts' => 'Keine Layouts mit erweiterten Einstellungen gefunden.', + 'layoutNotFoundOrInvalid' => 'Layout nicht gefunden oder ungültig.', 'orphanedSettings' => 'Es wurden Einstellungen für nicht vorhandene Layouts gefunden. Diese können unten gelöscht werden.', 'deleteOrphanedSettings' => 'Lösche verwaiste Einstellungen', ]; diff --git a/application/modules/admin/translations/en.php b/application/modules/admin/translations/en.php index 8246e23b5..349ee3106 100644 --- a/application/modules/admin/translations/en.php +++ b/application/modules/admin/translations/en.php @@ -385,6 +385,8 @@ 'moduleUpdateFailed' => 'The update of the module failed.', 'downloadOrInstallDenied' => 'Due to an invalid web address the update was not downloaded or installed.', 'processingPleaseWait' => 'Processing. Please wait.', + 'uninstallDeniedSystemModule' => 'An system module cannot be uninstalled.', + 'moduleNotFoundOrInvalid' => 'Module not found or invalid.', 'enableSelectedEntries' => 'Enable the selected entries?', 'deleteSelectedEntries' => 'Delete the selected entries?', @@ -434,6 +436,7 @@ 'menuAdvSettings' => 'Advanced Settings', 'menuAdvSettingsShow' => 'Show', 'noLayouts' => 'No layouts with advanced settings found.', + 'layoutNotFoundOrInvalid' => 'Layout not found or invalid.', 'orphanedSettings' => 'Settings have been found for not existing layouts. These can be deleted below.', 'deleteOrphanedSettings' => 'Delete orphaned settings', ];