From bec6fb1e0aecb00c1be6da113ec4407b128b0f22 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Wed, 6 May 2026 00:38:16 +0200 Subject: [PATCH] xyxc --- partials/landingpages/modules/setup.php | 156 +++++++++++++++--------- public/index.php | 7 +- 2 files changed, 102 insertions(+), 61 deletions(-) diff --git a/partials/landingpages/modules/setup.php b/partials/landingpages/modules/setup.php index 9cb1d99..0bdc65a 100644 --- a/partials/landingpages/modules/setup.php +++ b/partials/landingpages/modules/setup.php @@ -5,6 +5,7 @@ $error = null; $notice = null; $testGroup = null; $dbTestMessages = []; +$currentSection = trim((string) ($_GET['section'] ?? 'general')); require_admin(); @@ -14,6 +15,11 @@ if (!$module) { return; } +$allowedSetupSections = ['general', 'access', 'cron', 'custom']; +if (!in_array($currentSection, $allowedSetupSections, true)) { + $currentSection = 'general'; +} + $fields = (array)($module['setup']['fields'] ?? []); $hasGlobalDebugField = false; foreach ($fields as $field) { @@ -438,6 +444,10 @@ $renderField = function (array $field) use (&$current, $getNested, $driverOption if ($_SERVER['REQUEST_METHOD'] === 'POST') { $isSchedulerAutosave = isset($_POST['scheduler_autosave']) && (string) $_POST['scheduler_autosave'] === '1'; $isSchedulerTest = isset($_POST['scheduler_test']) && (string) $_POST['scheduler_test'] === '1'; + $submittedSetupSection = trim((string) ($_POST['setup_section'] ?? $currentSection)); + if (!in_array($submittedSetupSection, $allowedSetupSections, true)) { + $submittedSetupSection = $currentSection; + } $payload = []; if ($isSchedulerAutosave || $isSchedulerTest) { @@ -599,21 +609,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } } else { modules()->saveSettings($moduleName, $current); - $selectedUsers = is_array($_POST['auth_user_values'] ?? null) ? $_POST['auth_user_values'] : []; - $selectedGroups = is_array($_POST['auth_group_values'] ?? null) ? $_POST['auth_group_values'] : []; - $manualUserValues = preg_split('/[,\\n]+/', (string) ($_POST['auth_users'] ?? '')) ?: []; - $manualGroupValues = preg_split('/[,\\n]+/', (string) ($_POST['auth_groups'] ?? '')) ?: []; - modules()->saveAuth($moduleName, [ - 'required' => isset($_POST['auth_required']), - 'users' => array_merge($selectedUsers, $manualUserValues), - 'groups' => array_merge($selectedGroups, $manualGroupValues), - ]); + if ($submittedSetupSection === 'access') { + $selectedUsers = is_array($_POST['auth_user_values'] ?? null) ? $_POST['auth_user_values'] : []; + $selectedGroups = is_array($_POST['auth_group_values'] ?? null) ? $_POST['auth_group_values'] : []; + $manualUserValues = preg_split('/[,\\n]+/', (string) ($_POST['auth_users'] ?? '')) ?: []; + $manualGroupValues = preg_split('/[,\\n]+/', (string) ($_POST['auth_groups'] ?? '')) ?: []; + modules()->saveAuth($moduleName, [ + 'required' => isset($_POST['auth_required']), + 'users' => array_merge($selectedUsers, $manualUserValues), + 'groups' => array_merge($selectedGroups, $manualGroupValues), + ]); + } if ($isFxRatesSetup && modules()->hasFunction($moduleName, 'save_runtime_settings')) { module_fn($moduleName, 'save_runtime_settings', $payload); $current = modules()->settings($moduleName); } $refreshSchedulerState(); - if (empty($payload['debug_enabled'])) { + if ($submittedSetupSection === 'general' && array_key_exists('debug_enabled', $payload) && empty($payload['debug_enabled'])) { module_debug_clear($moduleName); } $notice = 'Setup gespeichert.'; @@ -658,42 +670,62 @@ $knownUserValues = array_column($knownUsers, 'sub'); $manualUsers = array_values(array_filter($allowedUsers, fn (string $value): bool => !in_array($value, $knownUserValues, true))); $manualGroups = array_values(array_filter($allowedGroups, fn (string $value): bool => !in_array($value, $knownGroups, true))); $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRatesSetup; +$sectionUrls = [ + 'general' => '/modules/setup/' . rawurlencode($moduleName) . '/general', + 'access' => '/modules/setup/' . rawurlencode($moduleName) . '/access', + 'cron' => '/modules/setup/' . rawurlencode($moduleName) . '/cron', + 'custom' => '/modules/setup/' . rawurlencode($moduleName) . '/custom', +]; +$sectionTitles = [ + 'general' => 'Allgemein', + 'access' => 'Zugriffsrechte', + 'cron' => 'Cron Einstellungen', + 'custom' => 'Custom Settings', +]; +if ($currentSection === 'custom' && !$hasCustomSection) { + $currentSection = 'general'; +} +$GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection] ?? 'Allgemein'); ?> -
-
Setup
-

– Einrichtung

-

Trage die benötigten Informationen für das Modul ein.

+
+ - + -
+
-
+ -
- - -
-
- - - - - +
+
Setup
+

+

Trage die benötigten Informationen für das Modul ein.

+ + + + + + + +
@@ -764,7 +797,9 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
+ +
@@ -820,7 +855,9 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
+ +
@@ -843,7 +880,9 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
+ +
@@ -904,7 +943,9 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
+ +
@@ -921,8 +962,9 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
+ - +
@@ -947,7 +989,7 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
- +
@@ -1277,7 +1319,7 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa } - +
@@ -1293,6 +1335,7 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
+
@@ -1353,7 +1396,9 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
+ +
@@ -1372,8 +1417,9 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa

Dieses Modul hat keine eigenen Zeitzonenfelder. Intervall-Tasks und Cron-Jobs koennen trotzdem weiter unten verwaltet werden.

+ - +
@@ -1402,7 +1448,7 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
- +
@@ -1481,7 +1527,7 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
- +
>
@@ -1516,7 +1562,7 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
- +
@@ -1541,7 +1587,7 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
- +
>
@@ -1613,7 +1659,7 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
- +
@@ -1633,17 +1679,8 @@ $hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRa
- -
- - -
+ +
diff --git a/public/index.php b/public/index.php index 19804ab..b709e07 100755 --- a/public/index.php +++ b/public/index.php @@ -252,7 +252,12 @@ $page404 = $pagesBase . '/errorpages/404.php'; if (str_starts_with($uriPath, 'modules/install')) { $target = $pagesBase . '/modules/install.php'; } elseif (str_starts_with($uriPath, 'modules/setup/')) { - $_GET['module'] = trim(substr($uriPath, strlen('modules/setup/')), '/'); + $setupPath = trim(substr($uriPath, strlen('modules/setup/')), '/'); + $setupParts = $setupPath === '' ? [] : explode('/', $setupPath, 2); + $_GET['module'] = trim((string) ($setupParts[0] ?? '')); + if (isset($setupParts[1]) && trim((string) $setupParts[1]) !== '') { + $_GET['section'] = trim((string) $setupParts[1]); + } $target = $pagesBase . '/modules/setup.php'; } elseif (str_starts_with($uriPath, 'modules/access/')) { $_GET['module'] = trim(substr($uriPath, strlen('modules/access/')), '/');