diff --git a/admin.php b/admin.php index 83959f0..d5e50d1 100644 --- a/admin.php +++ b/admin.php @@ -25,51 +25,51 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($action === 'save-notification-email') { if (!diagnostic_admin_is_authenticated()) { diagnostic_flash_set('warning', 'Zaloguj się jako administrator, aby zmienić adres powiadomień.'); - header('Location: /admin.php'); + header('Location: /admin.php?tab=settings'); exit; } $notificationEmail = trim((string)($_POST['notification_email'] ?? '')); if (!filter_var($notificationEmail, FILTER_VALIDATE_EMAIL)) { diagnostic_flash_set('danger', 'Podaj poprawny adres e-mail administratora do powiadomień o nowych prośbach o kontakt.'); - header('Location: /admin.php'); + header('Location: /admin.php?tab=settings'); exit; } diagnostic_admin_setting_set('admin_notification_email', $notificationEmail); diagnostic_flash_set('success', 'Adres e-mail administratora do powiadomień został zapisany.'); - header('Location: /admin.php'); + header('Location: /admin.php?tab=settings'); exit; } if ($action === 'save-openai-api-key') { if (!diagnostic_admin_is_authenticated()) { diagnostic_flash_set('warning', 'Zaloguj się jako administrator, aby zapisać klucz OpenAI.'); - header('Location: /admin.php'); + header('Location: /admin.php?tab=settings'); exit; } $openAiApiKey = preg_replace('/\s+/', '', (string)($_POST['openai_api_key'] ?? '')) ?? ''; if (!diagnostic_openai_api_key_is_valid($openAiApiKey)) { diagnostic_flash_set('danger', 'Podaj poprawny klucz API OpenAI. Klucz powinien być kompletny i bez spacji.'); - header('Location: /admin.php'); + header('Location: /admin.php?tab=settings'); exit; } diagnostic_admin_setting_set('openai_api_key', $openAiApiKey); diagnostic_flash_set('success', 'Własny klucz API OpenAI został zapisany. Nowe zapytania AI będą używały tego klucza.'); - header('Location: /admin.php'); + header('Location: /admin.php?tab=settings'); exit; } if ($action === 'remove-openai-api-key') { if (!diagnostic_admin_is_authenticated()) { diagnostic_flash_set('warning', 'Zaloguj się jako administrator, aby usunąć klucz OpenAI.'); - header('Location: /admin.php'); + header('Location: /admin.php?tab=settings'); exit; } diagnostic_admin_setting_set('openai_api_key', null); diagnostic_flash_set('info', 'Zapisany klucz API OpenAI został usunięty. System wrócił do domyślnej konfiguracji proxy.'); - header('Location: /admin.php'); + header('Location: /admin.php?tab=settings'); exit; } if ($action === 'resend-report') { @@ -123,6 +123,11 @@ $questionMap = diagnostic_question_map(); $credentials = diagnostic_admin_credentials(); $notificationConfig = diagnostic_admin_is_authenticated() ? diagnostic_admin_notification_config() : ['configured_email' => '', 'fallback_email' => '', 'effective_email' => '', 'source' => 'none']; $openAiConfig = diagnostic_admin_is_authenticated() ? diagnostic_admin_openai_key_config() : ['configured' => false, 'masked_key' => '']; +$currentTab = 'overview'; +if (diagnostic_admin_is_authenticated()) { + $requestedTab = (string)($_GET['tab'] ?? 'overview'); + $currentTab = in_array($requestedTab, ['overview', 'settings'], true) ? $requestedTab : 'overview'; +} ?> @@ -215,6 +220,21 @@ $openAiConfig = diagnostic_admin_is_authenticated() ? diagnostic_admin_openai_ke
%Średni wynik
+
+
+
+
Nawigacja panelu
+

Wybierz obszar pracy

+

Ustawienia wrażliwe zostały przeniesione do osobnej zakładki, aby nie były widoczne od razu po wejściu do panelu.

+
+ +
+
+ +
@@ -294,7 +314,7 @@ $openAiConfig = diagnostic_admin_is_authenticated() ? diagnostic_admin_openai_ke
- +
@@ -447,6 +467,7 @@ $openAiConfig = diagnostic_admin_is_authenticated() ? diagnostic_admin_openai_ke
+