Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6134954bbe | ||
|
|
f46cba2560 | ||
|
|
6d14698c6c | ||
|
|
861955cd7d | ||
|
|
8264cf4677 | ||
|
|
feac1dab26 | ||
|
|
829053bf46 | ||
|
|
33e26aa4f9 | ||
|
|
6d2aaeabe8 | ||
|
|
12a4fd9735 | ||
|
|
eefa4c490d | ||
|
|
14885dbf3f | ||
|
|
13dac32e3f | ||
|
|
9926836594 | ||
|
|
7692520efb | ||
|
|
76c13be9e9 | ||
|
|
74d53c800e | ||
|
|
7b7cc9c02a | ||
|
|
944cf1608d |
490
admin-vr0heltmao.php
Normal file
490
admin-vr0heltmao.php
Normal file
@ -0,0 +1,490 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
require_once __DIR__ . '/app/bootstrap.php';
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$action = $_POST['action'] ?? '';
|
||||||
|
if ($action === 'login') {
|
||||||
|
$username = trim((string)($_POST['username'] ?? ''));
|
||||||
|
$password = (string)($_POST['password'] ?? '');
|
||||||
|
if (diagnostic_admin_login($username, $password)) {
|
||||||
|
diagnostic_flash_set('success', 'Sesja administratora została rozpoczęta.');
|
||||||
|
header('Location: ' . diagnostic_admin_path());
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
diagnostic_flash_set('danger', 'Nieprawidłowy login lub hasło administratora.');
|
||||||
|
header('Location: ' . diagnostic_admin_path());
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ($action === 'logout') {
|
||||||
|
diagnostic_admin_logout();
|
||||||
|
diagnostic_flash_set('info', 'Sesja administratora została zakończona.');
|
||||||
|
header('Location: ' . diagnostic_admin_path());
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ($action === 'save-notification-email') {
|
||||||
|
if (!diagnostic_admin_is_authenticated()) {
|
||||||
|
diagnostic_flash_set('warning', 'Zaloguj się jako administrator, aby zmienić adres powiadomień.');
|
||||||
|
header('Location: ' . diagnostic_admin_path(['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: ' . diagnostic_admin_path(['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: ' . diagnostic_admin_path(['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: ' . diagnostic_admin_path(['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: ' . diagnostic_admin_path(['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: ' . diagnostic_admin_path(['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: ' . diagnostic_admin_path(['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: ' . diagnostic_admin_path(['tab' => 'settings']));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ($action === 'resend-report') {
|
||||||
|
if (!diagnostic_admin_is_authenticated()) {
|
||||||
|
diagnostic_flash_set('warning', 'Zaloguj się jako administrator, aby ponownie wysłać raport.');
|
||||||
|
header('Location: ' . diagnostic_admin_path());
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$attemptId = (int)($_POST['attempt_id'] ?? 0);
|
||||||
|
if ($attemptId <= 0) {
|
||||||
|
diagnostic_flash_set('danger', 'Nie udało się ustalić, dla której próby należy ponownie wysłać raport.');
|
||||||
|
header('Location: ' . diagnostic_admin_path());
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = diagnostic_admin_resend_report($attemptId);
|
||||||
|
if (!empty($result['success'])) {
|
||||||
|
$attempt = diagnostic_get_attempt($attemptId);
|
||||||
|
$recipient = $attempt['email'] ?? '';
|
||||||
|
diagnostic_flash_set('success', 'Raport został wysłany ponownie do klienta' . ($recipient !== '' ? ' (' . $recipient . ')' : '') . '.');
|
||||||
|
} else {
|
||||||
|
diagnostic_flash_set('danger', 'Nie udało się ponownie wysłać raportu: ' . (string)($result['error'] ?? 'Nieznany błąd.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: ' . diagnostic_admin_path(['attempt' => $attemptId]));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (diagnostic_admin_is_authenticated() && ($_GET['export'] ?? '') === 'csv') {
|
||||||
|
header('Content-Type: text/csv; charset=utf-8');
|
||||||
|
header('Content-Disposition: attachment; filename="wyniki-diagnozy-' . date('Ymd-His') . '.csv"');
|
||||||
|
echo diagnostic_admin_export_csv();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$flash = diagnostic_flash_get();
|
||||||
|
$meta = diagnostic_meta('Panel administratora', 'Zabezpieczony panel do przeglądu prób diagnozy i wyników dojrzałości procesowej.');
|
||||||
|
$definition = diagnostic_quiz_definition();
|
||||||
|
$attempts = diagnostic_admin_is_authenticated() ? diagnostic_admin_attempts() : [];
|
||||||
|
$stats = diagnostic_admin_is_authenticated() ? diagnostic_admin_stats() : [];
|
||||||
|
$selectedAttempt = null;
|
||||||
|
if (diagnostic_admin_is_authenticated() && isset($_GET['attempt'])) {
|
||||||
|
$selectedAttempt = diagnostic_get_attempt((int)$_GET['attempt']);
|
||||||
|
}
|
||||||
|
if (!$selectedAttempt && !empty($attempts)) {
|
||||||
|
$selectedAttempt = diagnostic_get_attempt((int)$attempts[0]['id']);
|
||||||
|
}
|
||||||
|
$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';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="pl">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title><?= htmlspecialchars($meta['title']) ?></title>
|
||||||
|
<meta name="description" content="<?= htmlspecialchars($meta['description']) ?>">
|
||||||
|
<meta property="og:title" content="<?= htmlspecialchars($meta['title']) ?>">
|
||||||
|
<meta property="og:description" content="<?= htmlspecialchars($meta['description']) ?>">
|
||||||
|
<meta property="twitter:title" content="<?= htmlspecialchars($meta['title']) ?>">
|
||||||
|
<meta property="twitter:description" content="<?= htmlspecialchars($meta['description']) ?>">
|
||||||
|
<?php if ($meta['image'] !== ''): ?>
|
||||||
|
<meta property="og:image" content="<?= htmlspecialchars($meta['image']) ?>">
|
||||||
|
<meta property="twitter:image" content="<?= htmlspecialchars($meta['image']) ?>">
|
||||||
|
<?php endif; ?>
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="/assets/css/custom.css?v=<?= urlencode((string)@filemtime(__DIR__ . '/assets/css/custom.css')) ?>">
|
||||||
|
</head>
|
||||||
|
<body class="app-shell">
|
||||||
|
<header class="site-header border-bottom bg-white sticky-top">
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light py-3">
|
||||||
|
<div class="container">
|
||||||
|
<?= diagnostic_brand_logo_anchor('navbar-brand doctor-biznes-logo-link--nav') ?>
|
||||||
|
<div class="d-flex align-items-center gap-2 ms-auto">
|
||||||
|
<a class="btn btn-sm btn-outline-dark" href="/diagnostic.php">Diagnoza</a>
|
||||||
|
<?php if (diagnostic_admin_is_authenticated()): ?>
|
||||||
|
<form method="post" class="m-0">
|
||||||
|
<input type="hidden" name="action" value="logout">
|
||||||
|
<button type="submit" class="btn btn-sm btn-dark">Wyloguj</button>
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="py-4 py-lg-5">
|
||||||
|
<div class="<?= diagnostic_admin_is_authenticated() ? 'container-fluid admin-workspace' : 'container' ?>">
|
||||||
|
<?php if ($flash): ?>
|
||||||
|
<div class="alert alert-<?= htmlspecialchars($flash['type']) ?> mb-4" role="alert">
|
||||||
|
<?= htmlspecialchars($flash['message']) ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (!diagnostic_admin_is_authenticated()): ?>
|
||||||
|
<section class="row justify-content-center">
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<div class="surface-card p-4 p-lg-5">
|
||||||
|
<div class="eyebrow mb-3">Strefa zabezpieczona</div>
|
||||||
|
<h1 class="h3 mb-3">Logowanie administratora</h1>
|
||||||
|
<p class="text-secondary mb-4">Panel służy do przeglądu prób, analizy wyników oraz eksportu danych z diagnozy dojrzałości procesowej.</p>
|
||||||
|
<form method="post" novalidate>
|
||||||
|
<input type="hidden" name="action" value="login">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="username" class="form-label">Login</label>
|
||||||
|
<input type="text" class="form-control" id="username" name="username" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="password" class="form-label">Hasło</label>
|
||||||
|
<input type="password" class="form-control" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-dark w-100">Wejdź do panelu</button>
|
||||||
|
</form>
|
||||||
|
<?php if ($credentials['using_default']): ?>
|
||||||
|
<div class="alert alert-warning mt-4 mb-0" role="alert">
|
||||||
|
Uwaga: aktywne są domyślne dane logowania administratora (<strong>admin / admin123</strong>). Przed użyciem produkcyjnym ustaw własne wartości <code>DIAGNOSTIC_ADMIN_USER</code> i <code>DIAGNOSTIC_ADMIN_PASS</code>.
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<?php else: ?>
|
||||||
|
<section class="surface-card p-4 p-lg-5 mb-4">
|
||||||
|
<div class="d-flex flex-column flex-lg-row justify-content-between gap-3 align-items-lg-center">
|
||||||
|
<div>
|
||||||
|
<div class="eyebrow mb-2">Panel administratora</div>
|
||||||
|
<h1 class="page-title mb-1">Operacje i wyniki diagnozy</h1>
|
||||||
|
<p class="text-secondary mb-0">Przeglądaj próby respondentów, śledź skuteczność ukończenia i analizuj wyniki w poszczególnych obszarach.</p>
|
||||||
|
</div>
|
||||||
|
<a class="btn btn-outline-dark" href="<?= htmlspecialchars(diagnostic_admin_path(['export' => 'csv'])) ?>">Eksportuj CSV</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="row g-3 mb-4">
|
||||||
|
<div class="col-sm-6 col-lg-3"><div class="metric-card"><strong><?= (int)$stats['total_attempts'] ?></strong><span>Wszystkie próby</span></div></div>
|
||||||
|
<div class="col-sm-6 col-lg-3"><div class="metric-card"><strong><?= (int)$stats['completed_attempts'] ?></strong><span>Ukończone</span></div></div>
|
||||||
|
<div class="col-sm-6 col-lg-3"><div class="metric-card"><strong><?= (int)$stats['completion_rate'] ?>%</strong><span>Wskaźnik ukończenia</span></div></div>
|
||||||
|
<div class="col-sm-6 col-lg-3"><div class="metric-card"><strong><?= (int)$stats['average_score'] ?>%</strong><span>Średni wynik</span></div></div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="surface-card p-3 p-lg-4 mb-4">
|
||||||
|
<div class="d-flex flex-column flex-lg-row justify-content-between align-items-lg-center gap-3">
|
||||||
|
<div>
|
||||||
|
<div class="eyebrow mb-2">Nawigacja panelu</div>
|
||||||
|
<h2 class="h5 mb-1">Wybierz obszar pracy</h2>
|
||||||
|
<p class="text-secondary mb-0">Ustawienia wrażliwe zostały przeniesione do osobnej zakładki, aby nie były widoczne od razu po wejściu do panelu.</p>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex flex-wrap gap-2">
|
||||||
|
<a class="btn <?= $currentTab === 'overview' ? 'btn-dark' : 'btn-outline-dark' ?>" href="<?= htmlspecialchars(diagnostic_admin_path()) ?>">Wyniki i zgłoszenia</a>
|
||||||
|
<a class="btn <?= $currentTab === 'settings' ? 'btn-dark' : 'btn-outline-dark' ?>" href="<?= htmlspecialchars(diagnostic_admin_path(['tab' => 'settings'])) ?>">Ustawienia</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<?php if ($currentTab === 'settings'): ?>
|
||||||
|
<section class="row g-4 mb-4">
|
||||||
|
<div class="col-xl-6">
|
||||||
|
<div class="surface-card p-4 h-100">
|
||||||
|
<div class="row g-4 align-items-start">
|
||||||
|
<div class="col-lg-7">
|
||||||
|
<div class="eyebrow mb-2">Powiadomienia o konsultacji</div>
|
||||||
|
<h2 class="h4 mb-2">Adres administratora dla nowych numerów telefonu</h2>
|
||||||
|
<p class="text-secondary mb-3">Gdy użytkownik poda numer telefonu po ukończeniu diagnozy, system wyśle powiadomienie e-mail właśnie na ten adres.</p>
|
||||||
|
<form method="post" class="row g-3" novalidate>
|
||||||
|
<input type="hidden" name="action" value="save-notification-email">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<label for="notificationEmail" class="form-label">Adres e-mail administratora</label>
|
||||||
|
<input type="email" class="form-control" id="notificationEmail" name="notification_email" placeholder="np. kontakt@twojafirma.pl" value="<?= htmlspecialchars((string)$notificationConfig['configured_email']) ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 d-grid align-self-end">
|
||||||
|
<button type="submit" class="btn btn-dark">Zapisz adres</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<div class="compact-card h-100">
|
||||||
|
<strong>Aktywna konfiguracja</strong>
|
||||||
|
<?php if (($notificationConfig['source'] ?? 'none') === 'panel'): ?>
|
||||||
|
<span>Powiadomienia trafiają na: <strong><?= htmlspecialchars((string)$notificationConfig['effective_email']) ?></strong></span>
|
||||||
|
<span class="text-secondary">Źródło: ustawienie zapisane w panelu administracyjnym.</span>
|
||||||
|
<?php elseif (($notificationConfig['source'] ?? 'none') === 'env'): ?>
|
||||||
|
<span>Powiadomienia tymczasowo trafią na: <strong><?= htmlspecialchars((string)$notificationConfig['effective_email']) ?></strong></span>
|
||||||
|
<span class="text-secondary">To fallback testowy z <code>MAIL_TO</code>. Ustaw adres w panelu, aby zarządzać nim bez edycji środowiska.</span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span>Brak ustawionego adresu do powiadomień.</span>
|
||||||
|
<span class="text-secondary">Do czasu zapisania adresu w panelu e-mail o nowej prośbie o kontakt nie zostanie wysłany.</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xl-6">
|
||||||
|
<div class="surface-card p-4 h-100">
|
||||||
|
<div class="row g-4 align-items-start">
|
||||||
|
<div class="col-lg-7">
|
||||||
|
<div class="eyebrow mb-2">Integracja AI</div>
|
||||||
|
<h2 class="h4 mb-2">Własny klucz API OpenAI</h2>
|
||||||
|
<p class="text-secondary mb-3">Zapisany tutaj klucz będzie automatycznie używany przez wszystkie obecne wywołania AI w aplikacji: diagnozę, czat i webhook Telegrama.</p>
|
||||||
|
<form method="post" class="row g-3" novalidate>
|
||||||
|
<input type="hidden" name="action" value="save-openai-api-key">
|
||||||
|
<div class="col-12">
|
||||||
|
<label for="openAiApiKey" class="form-label">Klucz API OpenAI</label>
|
||||||
|
<input type="password" class="form-control" id="openAiApiKey" name="openai_api_key" placeholder="wklej pełny klucz, np. sk-proj-..." value="" autocomplete="new-password" spellcheck="false">
|
||||||
|
<div class="form-text">Pole pozostaje puste po zapisaniu ze względów bezpieczeństwa. Wprowadź nowy klucz tylko wtedy, gdy chcesz go zmienić.</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6 d-grid">
|
||||||
|
<button type="submit" class="btn btn-dark">Zapisz klucz</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<?php if (!empty($openAiConfig['configured'])): ?>
|
||||||
|
<form method="post" class="mt-3" onsubmit="return confirm('Usunąć zapisany klucz API OpenAI?');">
|
||||||
|
<input type="hidden" name="action" value="remove-openai-api-key">
|
||||||
|
<button type="submit" class="btn btn-outline-dark">Usuń zapisany klucz</button>
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<div class="compact-card h-100">
|
||||||
|
<strong>Aktywna konfiguracja</strong>
|
||||||
|
<?php if (!empty($openAiConfig['configured'])): ?>
|
||||||
|
<span>Zapytania AI używają własnego klucza zapisanego w panelu.</span>
|
||||||
|
<span class="text-secondary">Zapisany klucz: <strong><?= htmlspecialchars((string)$openAiConfig['masked_key']) ?></strong></span>
|
||||||
|
<span class="text-secondary">Klucz jest wysyłany centralnie przez <code>LocalAIApi</code>, więc nie trzeba osobno zmieniać endpointów.</span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span>Brak własnego klucza OpenAI w panelu.</span>
|
||||||
|
<span class="text-secondary">Do czasu zapisania klucza aplikacja korzysta z domyślnej konfiguracji proxy.</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<?php else: ?>
|
||||||
|
<section class="row g-4">
|
||||||
|
<div class="col-xl-8 col-xxl-9">
|
||||||
|
<div class="surface-card p-4 h-100">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
|
<div>
|
||||||
|
<div class="eyebrow mb-2">Lista prób</div>
|
||||||
|
<h2 class="h4 mb-0">Ostatnie odpowiedzi</h2>
|
||||||
|
</div>
|
||||||
|
<span class="pill-badge subdued"><?= count($attempts) ?> rekordów</span>
|
||||||
|
</div>
|
||||||
|
<?php if (empty($attempts)): ?>
|
||||||
|
<div class="empty-state text-center py-5 px-4">
|
||||||
|
<h3 class="h5 mb-2">Brak zapisanych prób</h3>
|
||||||
|
<p class="text-secondary mb-0">Po pierwszym wypełnieniu diagnozy przez użytkownika wyniki pojawią się tutaj automatycznie.</p>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="table-responsive admin-table-wrap">
|
||||||
|
<table class="table admin-table align-middle mb-0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">ID</th>
|
||||||
|
<th scope="col">E-mail</th>
|
||||||
|
<th scope="col">Status</th>
|
||||||
|
<th scope="col">Telefon</th>
|
||||||
|
<th scope="col">Wynik</th>
|
||||||
|
<th scope="col">Segment</th>
|
||||||
|
<th scope="col">Raport</th>
|
||||||
|
<th scope="col">Szczegóły</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($attempts as $row): ?>
|
||||||
|
<tr>
|
||||||
|
<td>#<?= (int)$row['id'] ?></td>
|
||||||
|
<td><?= htmlspecialchars((string)$row['email']) ?></td>
|
||||||
|
<td><span class="pill-badge<?= ($row['status'] ?? '') === 'completed' ? '' : ' subdued' ?>"><?= ($row['status'] ?? '') === 'completed' ? 'ukończona' : 'w trakcie' ?></span></td>
|
||||||
|
<td><?= !empty($row['contact_phone']) ? htmlspecialchars((string)$row['contact_phone']) : '—' ?></td>
|
||||||
|
<td><?= isset($row['result']['percentage_score']) ? (int)$row['result']['percentage_score'] . '%' : '—' ?></td>
|
||||||
|
<td><?= htmlspecialchars((string)($row['result']['segment_label'] ?? '—')) ?></td>
|
||||||
|
<td><?= htmlspecialchars((string)$row['email_report_status']) ?></td>
|
||||||
|
<td><a class="btn btn-sm btn-outline-dark" href="<?= htmlspecialchars(diagnostic_admin_path(['attempt' => (int)$row['id']])) ?>">Zobacz</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xl-4 col-xxl-3">
|
||||||
|
<div class="surface-card p-4 h-100">
|
||||||
|
<?php if (!$selectedAttempt): ?>
|
||||||
|
<div class="empty-state text-center py-5 px-4">
|
||||||
|
<h3 class="h5 mb-2">Brak wybranej próby</h3>
|
||||||
|
<p class="text-secondary mb-0">Wybierz odpowiedź z listy, aby zobaczyć szczegóły, rozkład sekcji i pełny zestaw odpowiedzi.</p>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php $result = $selectedAttempt['result'] ?? []; ?>
|
||||||
|
<div class="attempt-header d-flex flex-wrap justify-content-between gap-3 mb-4 align-items-start">
|
||||||
|
<div class="attempt-identity">
|
||||||
|
<div class="eyebrow mb-2">Szczegóły próby #<?= (int)$selectedAttempt['id'] ?></div>
|
||||||
|
<h2 class="h4 mb-1 attempt-email"><?= htmlspecialchars((string)$selectedAttempt['email']) ?></h2>
|
||||||
|
<p class="text-secondary mb-0">Rozpoczęto: <?= htmlspecialchars((string)$selectedAttempt['started_at']) ?></p>
|
||||||
|
</div>
|
||||||
|
<div class="score-chip text-end">
|
||||||
|
<span>Wynik</span>
|
||||||
|
<strong><?= isset($result['percentage_score']) ? (int)$result['percentage_score'] . '%' : '—' ?></strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-4">
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-sm-6"><div class="compact-card"><strong>Status</strong><span><?= ($selectedAttempt['status'] ?? '') === 'completed' ? 'Ukończona' : 'W trakcie' ?></span></div></div>
|
||||||
|
<div class="col-sm-6"><div class="compact-card"><strong>Raport e-mail</strong><span><?= htmlspecialchars((string)$selectedAttempt['email_report_status']) ?></span></div></div>
|
||||||
|
<div class="col-sm-6"><div class="compact-card"><strong>Zgoda marketingowa</strong><span><?= ((int)$selectedAttempt['marketing_consent']) === 1 ? 'Tak' : 'Nie' ?></span></div></div>
|
||||||
|
<div class="col-sm-6"><div class="compact-card"><strong>Telefon kontaktowy</strong><span><?= !empty($selectedAttempt['contact_phone']) ? htmlspecialchars((string)$selectedAttempt['contact_phone']) : '—' ?></span></div></div>
|
||||||
|
<div class="col-sm-6"><div class="compact-card"><strong>Prośba o kontakt</strong><span><?= htmlspecialchars((string)($selectedAttempt['consultation_requested_at'] ?? '—')) ?></span></div></div>
|
||||||
|
<div class="col-sm-6"><div class="compact-card"><strong>Zakończono</strong><span><?= htmlspecialchars((string)($selectedAttempt['completed_at'] ?? '—')) ?></span></div></div>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="compact-card">
|
||||||
|
<strong>Ponowna wysyłka raportu</strong>
|
||||||
|
<?php if (diagnostic_attempt_can_send_report($selectedAttempt)): ?>
|
||||||
|
<span>Wyślij ponownie raport na adres klienta: <?= htmlspecialchars((string)$selectedAttempt['email']) ?></span>
|
||||||
|
<form method="post" class="mt-3">
|
||||||
|
<input type="hidden" name="action" value="resend-report">
|
||||||
|
<input type="hidden" name="attempt_id" value="<?= (int)$selectedAttempt['id'] ?>">
|
||||||
|
<button type="submit" class="btn btn-sm btn-dark">Wyślij ponownie</button>
|
||||||
|
</form>
|
||||||
|
<?php else: ?>
|
||||||
|
<span>Ponowna wysyłka będzie dostępna po ukończeniu diagnozy i wygenerowaniu wyniku.</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!empty($selectedAttempt['email_report_error'])): ?>
|
||||||
|
<span class="text-danger small mt-2">Ostatni błąd wysyłki: <?= htmlspecialchars((string)$selectedAttempt['email_report_error']) ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (!empty($result)): ?>
|
||||||
|
<div class="mb-4">
|
||||||
|
<h3 class="h5 mb-3">Podsumowanie wyniku</h3>
|
||||||
|
<p class="text-secondary mb-3"><strong><?= htmlspecialchars((string)($result['segment_label'] ?? '')) ?></strong> — <?= htmlspecialchars((string)($result['segment_summary'] ?? '')) ?></p>
|
||||||
|
<div class="row g-3">
|
||||||
|
<?php foreach (($result['section_scores'] ?? []) as $section): ?>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="section-score-card">
|
||||||
|
<span class="small text-secondary d-block mb-2"><?= htmlspecialchars($section['section_name']) ?></span>
|
||||||
|
<strong class="d-block mb-2"><?= (int)$section['percentage'] ?>%</strong>
|
||||||
|
<div class="progress" style="height: 8px;">
|
||||||
|
<div class="progress-bar bg-dark" role="progressbar" style="width: <?= (int)$section['percentage'] ?>%;" aria-valuenow="<?= (int)$section['percentage'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3 class="h5 mb-3">Odpowiedzi respondenta</h3>
|
||||||
|
<ul class="answer-review-list mb-0">
|
||||||
|
<?php foreach ($questionMap as $questionId => $question): ?>
|
||||||
|
<?php $rawAnswer = $selectedAttempt['answers'][$questionId] ?? null; ?>
|
||||||
|
<li>
|
||||||
|
<em><?= htmlspecialchars($question['section_name']) ?></em>
|
||||||
|
<strong><?= htmlspecialchars($question['text']) ?></strong>
|
||||||
|
<span class="text-secondary"><?= $rawAnswer === null ? 'Brak odpowiedzi' : htmlspecialchars(diagnostic_answer_label((int)$rawAnswer)) ?></span>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="surface-card p-4 mt-4">
|
||||||
|
<div class="section-intro mb-3">
|
||||||
|
<div class="eyebrow">Zakres diagnozy</div>
|
||||||
|
<h2 class="h4 mb-0">Obszary oceniane w narzędziu</h2>
|
||||||
|
</div>
|
||||||
|
<div class="row g-3">
|
||||||
|
<?php foreach ($definition['sections'] as $section): ?>
|
||||||
|
<div class="col-md-6 col-xl-4">
|
||||||
|
<div class="compact-card h-100">
|
||||||
|
<strong><?= htmlspecialchars($section['name']) ?></strong>
|
||||||
|
<span><?= count($section['questions']) ?> pytań w tej sekcji.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="border-top py-4 bg-white">
|
||||||
|
<div class="container d-flex flex-column flex-md-row justify-content-between gap-2">
|
||||||
|
<span class="text-secondary small">Panel administracyjny diagnozy dojrzałości procesowej.</span>
|
||||||
|
<div class="d-flex gap-3 small">
|
||||||
|
<a class="text-decoration-none text-secondary" href="/">Strona główna</a>
|
||||||
|
<a class="text-decoration-none text-secondary" href="/diagnostic.php">Diagnoza</a>
|
||||||
|
<a class="text-decoration-none text-secondary" href="/healthz.php">Status</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script>window.FL_SHOW_BUDGE=false;</script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" defer></script>
|
||||||
|
<script src="/assets/js/main.js?v=<?= urlencode((string)@filemtime(__DIR__ . '/assets/js/main.js')) ?>" defer></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
43
admin.php
Normal file
43
admin.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
require_once __DIR__ . '/app/bootstrap.php';
|
||||||
|
|
||||||
|
http_response_code(404);
|
||||||
|
$meta = diagnostic_meta('Nie znaleziono strony', 'Ten adres panelu administracyjnego nie jest aktywny.');
|
||||||
|
?>
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="pl">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title><?= htmlspecialchars($meta['title']) ?></title>
|
||||||
|
<meta name="description" content="<?= htmlspecialchars($meta['description']) ?>">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="/assets/css/custom.css?v=<?= urlencode((string)@filemtime(__DIR__ . '/assets/css/custom.css')) ?>">
|
||||||
|
</head>
|
||||||
|
<body class="app-shell">
|
||||||
|
<header class="site-header border-bottom sticky-top">
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light py-3">
|
||||||
|
<div class="container">
|
||||||
|
<?= diagnostic_brand_logo_anchor('navbar-brand doctor-biznes-logo-link--nav') ?>
|
||||||
|
<div class="d-flex align-items-center gap-2 ms-auto">
|
||||||
|
<a class="btn btn-sm btn-dark" href="/">Strona główna</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
<main class="py-5">
|
||||||
|
<div class="container">
|
||||||
|
<section class="empty-state text-center py-5 px-4">
|
||||||
|
<div class="eyebrow mb-3">404</div>
|
||||||
|
<h1 class="page-title mb-3">Nie znaleziono strony</h1>
|
||||||
|
<p class="text-secondary mb-4">Ten adres panelu administracyjnego nie jest aktywny.</p>
|
||||||
|
<a class="btn btn-dark" href="/">Wróć na stronę główną</a>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" defer></script>
|
||||||
|
<script src="/assets/js/main.js?v=<?= urlencode((string)@filemtime(__DIR__ . '/assets/js/main.js')) ?>" defer></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -28,6 +28,11 @@ class LocalAIApi
|
|||||||
/** @var array<string,mixed>|null */
|
/** @var array<string,mixed>|null */
|
||||||
private static ?array $configCache = null;
|
private static ?array $configCache = null;
|
||||||
|
|
||||||
|
/** @var string|null */
|
||||||
|
private static ?string $customApiKeyCache = null;
|
||||||
|
|
||||||
|
private static bool $customApiKeyLoaded = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signature compatible with the OpenAI Responses API.
|
* Signature compatible with the OpenAI Responses API.
|
||||||
*
|
*
|
||||||
@ -150,6 +155,7 @@ class LocalAIApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$headers = self::withCustomAuthorizationHeader($headers);
|
||||||
|
|
||||||
if (!empty($projectUuid) && !array_key_exists('project_uuid', $payload)) {
|
if (!empty($projectUuid) && !array_key_exists('project_uuid', $payload)) {
|
||||||
$payload['project_uuid'] = $projectUuid;
|
$payload['project_uuid'] = $projectUuid;
|
||||||
@ -273,6 +279,7 @@ class LocalAIApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$headers = self::withCustomAuthorizationHeader($headers);
|
||||||
|
|
||||||
return self::sendCurl($url, 'GET', null, $headers, $timeout, $verifyTls);
|
return self::sendCurl($url, 'GET', null, $headers, $timeout, $verifyTls);
|
||||||
}
|
}
|
||||||
@ -365,6 +372,71 @@ class LocalAIApi
|
|||||||
return self::$configCache;
|
return self::$configCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append the admin-provided Authorization header when a custom OpenAI key is configured.
|
||||||
|
*
|
||||||
|
* @param array<int,string> $headers
|
||||||
|
* @return array<int,string>
|
||||||
|
*/
|
||||||
|
private static function withCustomAuthorizationHeader(array $headers): array
|
||||||
|
{
|
||||||
|
$customApiKey = self::customApiKey();
|
||||||
|
if ($customApiKey === null) {
|
||||||
|
return $headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($headers as $index => $header) {
|
||||||
|
if (stripos($header, 'Authorization:') === 0) {
|
||||||
|
unset($headers[$index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$headers[] = 'Authorization: Bearer ' . $customApiKey;
|
||||||
|
return array_values($headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function customApiKey(): ?string
|
||||||
|
{
|
||||||
|
if (self::$customApiKeyLoaded) {
|
||||||
|
return self::$customApiKeyCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$customApiKeyLoaded = true;
|
||||||
|
self::$customApiKeyCache = null;
|
||||||
|
|
||||||
|
$dbConfigPath = __DIR__ . '/../db/config.php';
|
||||||
|
if (!function_exists('db')) {
|
||||||
|
if (!file_exists($dbConfigPath)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
require_once $dbConfigPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('db')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare('SELECT setting_value FROM diagnostic_settings WHERE setting_key = :setting_key LIMIT 1');
|
||||||
|
$stmt->execute([':setting_key' => 'openai_api_key']);
|
||||||
|
$value = $stmt->fetchColumn();
|
||||||
|
if (!is_string($value)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$normalized = preg_replace('/\s+/', '', trim($value)) ?? '';
|
||||||
|
if ($normalized === '' || strlen($normalized) < 20) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$customApiKeyCache = $normalized;
|
||||||
|
return self::$customApiKeyCache;
|
||||||
|
} catch (Throwable $exception) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build an absolute URL from base_url and a path.
|
* Build an absolute URL from base_url and a path.
|
||||||
*/
|
*/
|
||||||
|
|||||||
16
app/bootstrap.php
Normal file
16
app/bootstrap.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
if (session_status() === PHP_SESSION_NONE) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
date_default_timezone_set('UTC');
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../db/config.php';
|
||||||
|
require_once __DIR__ . '/../mail/MailService.php';
|
||||||
|
require_once __DIR__ . '/../ai/LocalAIApi.php';
|
||||||
|
require_once __DIR__ . '/diagnostic_data.php';
|
||||||
|
require_once __DIR__ . '/diagnostic_functions.php';
|
||||||
|
|
||||||
|
ensure_diagnostic_schema();
|
||||||
168
app/diagnostic_data.php
Normal file
168
app/diagnostic_data.php
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
function diagnostic_quiz_definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'quiz' => [
|
||||||
|
'slug' => 'business-process-diagnostic-v1',
|
||||||
|
'title' => 'Diagnoza dojrzałości procesowej',
|
||||||
|
'estimated_time' => '8–10 minut',
|
||||||
|
'subtitle' => 'Oceń, na ile procesy w Twojej firmie są uporządkowane, mierzalne i gotowe do dalszego wzrostu bez nadmiernej zależności od właściciela.',
|
||||||
|
],
|
||||||
|
'answer_scale' => [
|
||||||
|
0 => 'Zdecydowanie nie',
|
||||||
|
1 => 'Raczej nie',
|
||||||
|
2 => 'Raczej tak',
|
||||||
|
3 => 'Zdecydowanie tak',
|
||||||
|
],
|
||||||
|
'sections' => [
|
||||||
|
[
|
||||||
|
'id' => 'task_management',
|
||||||
|
'name' => 'Zarządzanie zadaniami',
|
||||||
|
'questions' => [
|
||||||
|
['id' => 'q1', 'text' => 'Czy w dowolnym momencie możesz sprawdzić, kto aktualnie pracuje nad jakim zadaniem?'],
|
||||||
|
['id' => 'q2', 'text' => 'Czy wszystkie zadania w firmie są zapisywane w jednym miejscu?'],
|
||||||
|
['id' => 'q3', 'text' => 'Czy masz pewność, że żadne zadanie nie zostanie pominięte lub zapomniane?'],
|
||||||
|
['id' => 'q4', 'text' => 'Czy pracownicy wiedzą dokładnie, co mają robić bez konieczności dopytywania?'],
|
||||||
|
['id' => 'q5', 'text' => 'Czy masz możliwość sprawdzenia, ile czasu zajmuje realizacja konkretnych zadań?'],
|
||||||
|
['id' => 'q6', 'text' => 'Czy jesteś w stanie szybko zidentyfikować opóźnienia w pracy?'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'repeatability',
|
||||||
|
'name' => 'Procesy i powtarzalność',
|
||||||
|
'questions' => [
|
||||||
|
['id' => 'q7', 'text' => 'Czy kluczowe działania w firmie mają spisany przebieg krok po kroku?'],
|
||||||
|
['id' => 'q8', 'text' => 'Czy nowy pracownik jest w stanie wykonać zadanie na podstawie instrukcji?'],
|
||||||
|
['id' => 'q9', 'text' => 'Czy sposób realizacji zadań jest powtarzalny między pracownikami?'],
|
||||||
|
['id' => 'q10', 'text' => 'Czy jakość realizacji usług lub produktów jest przewidywalna?'],
|
||||||
|
['id' => 'q11', 'text' => 'Czy w firmie istnieją checklisty lub procedury dla kluczowych działań?'],
|
||||||
|
['id' => 'q12', 'text' => 'Czy procesy są aktualizowane po popełnionych błędach?'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'communication',
|
||||||
|
'name' => 'Komunikacja wewnętrzna',
|
||||||
|
'questions' => [
|
||||||
|
['id' => 'q13', 'text' => 'Czy informacje w firmie są przekazywane w uporządkowany sposób (np. jedno narzędzie)?'],
|
||||||
|
['id' => 'q14', 'text' => 'Czy komunikacja w firmie jest uporządkowana i unika powtarzania tych samych tematów?'],
|
||||||
|
['id' => 'q15', 'text' => 'Czy pracownicy mają dostęp do wszystkich potrzebnych informacji?'],
|
||||||
|
['id' => 'q16', 'text' => 'Czy decyzje są jasno komunikowane i rozumiane przez zespół?'],
|
||||||
|
['id' => 'q17', 'text' => 'Czy różne osoby działają na podstawie tych samych, spójnych i jednoznacznych informacji?'],
|
||||||
|
['id' => 'q18', 'text' => 'Czy ustalenia ze spotkań są zapisywane i przekładane na konkretne działania?'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'control',
|
||||||
|
'name' => 'Kontrola i nadzór',
|
||||||
|
'questions' => [
|
||||||
|
['id' => 'q19', 'text' => 'Czy osoby zarządzające mają bieżący wgląd w status kluczowych działań?'],
|
||||||
|
['id' => 'q20', 'text' => 'Czy w firmie istnieją jasne wskaźniki pokazujące, czy praca przebiega zgodnie z planem?'],
|
||||||
|
['id' => 'q21', 'text' => 'Czy błędy, opóźnienia lub odchylenia są wychwytywane na wczesnym etapie?'],
|
||||||
|
['id' => 'q22', 'text' => 'Czy potrafisz szybko ustalić przyczynę problemu operacyjnego?'],
|
||||||
|
['id' => 'q23', 'text' => 'Czy regularnie analizowane są wyniki zespołów, procesów lub projektów?'],
|
||||||
|
['id' => 'q24', 'text' => 'Czy odpowiedzialność za wyniki i terminy jest jasno przypisana?'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'sales_service',
|
||||||
|
'name' => 'Sprzedaż i obsługa klienta',
|
||||||
|
'questions' => [
|
||||||
|
['id' => 'q25', 'text' => 'Czy proces sprzedaży od pierwszego kontaktu do zamknięcia jest uporządkowany i powtarzalny?'],
|
||||||
|
['id' => 'q26', 'text' => 'Czy wiadomo, na jakim etapie znajduje się każda szansa sprzedażowa?'],
|
||||||
|
['id' => 'q27', 'text' => 'Czy oferty handlowe są przygotowywane według spójnego standardu?'],
|
||||||
|
['id' => 'q28', 'text' => 'Czy po sprzedaży klient otrzymuje obsługę według jasno określonego procesu?'],
|
||||||
|
['id' => 'q29', 'text' => 'Czy reklamacje, uwagi i potrzeby klientów są systematycznie rejestrowane?'],
|
||||||
|
['id' => 'q30', 'text' => 'Czy zespół potrafi szybko reagować na problemy klienta bez angażowania właściciela w każdą sprawę?'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'finance',
|
||||||
|
'name' => 'Finanse i rozliczenia',
|
||||||
|
'questions' => [
|
||||||
|
['id' => 'q31', 'text' => 'Czy masz regularny i aktualny wgląd w przychody, koszty i rentowność?'],
|
||||||
|
['id' => 'q32', 'text' => 'Czy w firmie istnieje uporządkowany proces wystawiania faktur i kontroli płatności?'],
|
||||||
|
['id' => 'q33', 'text' => 'Czy wiesz, które usługi, produkty lub klienci są najbardziej rentowni?'],
|
||||||
|
['id' => 'q34', 'text' => 'Czy opóźnienia w płatnościach są szybko identyfikowane i obsługiwane?'],
|
||||||
|
['id' => 'q35', 'text' => 'Czy decyzje operacyjne są podejmowane z uwzględnieniem danych finansowych?'],
|
||||||
|
['id' => 'q36', 'text' => 'Czy przepływy pieniężne są monitorowane w sposób pozwalający wcześniej reagować na ryzyka?'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'owner_dependency',
|
||||||
|
'name' => 'Decyzyjność i rola właściciela',
|
||||||
|
'questions' => [
|
||||||
|
['id' => 'q37', 'text' => 'Czy firma potrafi działać sprawnie podczas Twojej nieobecności przez kilka dni?'],
|
||||||
|
['id' => 'q38', 'text' => 'Czy decyzje operacyjne są podejmowane na odpowiednim poziomie bez eskalowania wszystkiego do właściciela?'],
|
||||||
|
['id' => 'q39', 'text' => 'Czy role i zakres odpowiedzialności w zespole są jasno określone?'],
|
||||||
|
['id' => 'q40', 'text' => 'Czy właściciel ma czas na rozwój firmy, a nie wyłącznie na bieżące gaszenie problemów?'],
|
||||||
|
['id' => 'q41', 'text' => 'Czy kluczowa wiedza operacyjna jest rozproszona w zespole, a nie skupiona wyłącznie u właściciela?'],
|
||||||
|
['id' => 'q42', 'text' => 'Czy firma podejmuje decyzje na podstawie danych i ustalonych zasad, a nie wyłącznie intuicji właściciela?'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'segments' => [
|
||||||
|
[
|
||||||
|
'key' => 'operational_chaos',
|
||||||
|
'label' => 'Chaos operacyjny',
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 25,
|
||||||
|
'summary' => 'Codzienne funkcjonowanie firmy jest w dużej mierze reaktywne. Wiele działań zależy od pamięci, bieżących interwencji i osobistej kontroli właściciela, co zwiększa ryzyko błędów, opóźnień i utraty marży.',
|
||||||
|
'recommendations' => [
|
||||||
|
'Ustal jeden wspólny sposób rejestrowania zadań, odpowiedzialności i terminów.',
|
||||||
|
'Opisz 3–5 najważniejszych procesów operacyjnych w formie prostych instrukcji lub checklist.',
|
||||||
|
'Wprowadź regularny rytm przeglądu zadań i problemów, aby szybciej wychwytywać odchylenia.',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'key' => 'reactive_company',
|
||||||
|
'label' => 'Reaktywny model działania',
|
||||||
|
'min' => 26,
|
||||||
|
'max' => 45,
|
||||||
|
'summary' => 'W firmie istnieją już pojedyncze elementy porządku, jednak sposób działania nadal opiera się bardziej na reagowaniu niż na przewidywalnym zarządzaniu. Wąskie gardła i zależność od pojedynczych osób są nadal wyraźne.',
|
||||||
|
'recommendations' => [
|
||||||
|
'Uporządkuj przepływ informacji i ogranicz liczbę miejsc, w których prowadzone są ustalenia.',
|
||||||
|
'Zdefiniuj właścicieli procesów i podstawowe wskaźniki dla obszarów o największym wpływie na wynik firmy.',
|
||||||
|
'Ustandaryzuj przekazywanie zadań oraz sposób raportowania statusu prac.',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'key' => 'partially_organized',
|
||||||
|
'label' => 'Częściowe uporządkowanie',
|
||||||
|
'min' => 46,
|
||||||
|
'max' => 65,
|
||||||
|
'summary' => 'Firma ma już działające fundamenty operacyjne, ale wciąż występują luki w spójności procesów, kontroli i delegowaniu decyzji. To etap, na którym dobre uporządkowanie wybranych obszarów może szybko zwiększyć efektywność.',
|
||||||
|
'recommendations' => [
|
||||||
|
'Uzupełnij brakujące procedury dla powtarzalnych działań o wysokim koszcie błędu.',
|
||||||
|
'Rozszerz kontrolę o cykliczne przeglądy wyników, terminów i jakości wykonania.',
|
||||||
|
'Ogranicz zależność od właściciela poprzez jasne role, decyzje delegowane i standardy pracy.',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'key' => 'well_managed',
|
||||||
|
'label' => 'Dobrze zarządzana organizacja',
|
||||||
|
'min' => 66,
|
||||||
|
'max' => 85,
|
||||||
|
'summary' => 'Procesy są w dużej mierze przewidywalne, a menedżerowie mają realny wgląd w sytuację operacyjną. Kolejny poziom rozwoju wymaga dalszego wzmacniania mierzalności, ciągłego doskonalenia i redukcji pojedynczych punktów zależności.',
|
||||||
|
'recommendations' => [
|
||||||
|
'Rozwijaj wskaźniki zarządcze i wykorzystuj je do wcześniejszego reagowania, a nie tylko raportowania po fakcie.',
|
||||||
|
'Regularnie aktualizuj procedury po błędach, reklamacjach i zmianach w sposobie pracy.',
|
||||||
|
'Buduj większą samodzielność zespołu w decyzjach operacyjnych i obsłudze klienta.',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'key' => 'scaling_ready',
|
||||||
|
'label' => 'Gotowość do skalowania',
|
||||||
|
'min' => 86,
|
||||||
|
'max' => 100,
|
||||||
|
'summary' => 'Model operacyjny firmy jest dojrzały, spójny i stosunkowo odporny na chaos dnia codziennego. Organizacja ma dobre podstawy do wzrostu, większej skali oraz pracy właściciela bardziej na poziomie strategicznym niż wykonawczym.',
|
||||||
|
'recommendations' => [
|
||||||
|
'Wykorzystuj dane operacyjne i finansowe do planowania rozwoju, inwestycji i skalowania zespołu.',
|
||||||
|
'Koncentruj się na ciągłym doskonaleniu oraz automatyzacji obszarów o największej powtarzalności.',
|
||||||
|
'Przeglądaj dojrzałość procesową cyklicznie, aby utrzymać jakość działania przy dalszym wzroście firmy.',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
1425
app/diagnostic_functions.php
Normal file
1425
app/diagnostic_functions.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,403 +1,529 @@
|
|||||||
|
|
||||||
|
@media (max-width: 767.98px) {
|
||||||
|
.doctor-biznes-logo-link {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.doctor-biznes-logo {
|
||||||
|
width: min(320px, 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--bg: #f5f6f8;
|
||||||
|
--surface: #ffffff;
|
||||||
|
--surface-muted: #f8fafc;
|
||||||
|
--border: #d9dde3;
|
||||||
|
--border-strong: #c3c9d2;
|
||||||
|
--text: #101828;
|
||||||
|
--muted: #667085;
|
||||||
|
--accent: #1d2939;
|
||||||
|
--accent-soft: #eef2f6;
|
||||||
|
--success: #0f766e;
|
||||||
|
--warning: #b45309;
|
||||||
|
--danger: #b42318;
|
||||||
|
--radius-sm: 8px;
|
||||||
|
--radius-md: 12px;
|
||||||
|
--radius-lg: 16px;
|
||||||
|
--shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
|
||||||
|
--shadow-md: 0 12px 24px rgba(16, 24, 40, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
|
background: var(--bg);
|
||||||
background-size: 400% 400%;
|
color: var(--text);
|
||||||
animation: gradient 15s ease infinite;
|
font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||||
color: #212529;
|
|
||||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
||||||
font-size: 14px;
|
|
||||||
margin: 0;
|
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-wrapper {
|
.app-shell {
|
||||||
|
background: var(--bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-header {
|
||||||
|
background: linear-gradient(135deg, #38a7e8 0%, #1d88d4 46%, #0e5fb5 100%) !important;
|
||||||
|
border-color: rgba(255, 255, 255, 0.14) !important;
|
||||||
|
box-shadow: 0 10px 24px rgba(14, 95, 181, 0.18);
|
||||||
|
backdrop-filter: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-header .btn-dark {
|
||||||
|
background: #ffffff;
|
||||||
|
border-color: #ffffff;
|
||||||
|
color: #0e5fb5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-header .btn-dark:hover,
|
||||||
|
.site-header .btn-dark:focus {
|
||||||
|
background: #eaf4ff;
|
||||||
|
border-color: #eaf4ff;
|
||||||
|
color: #0b57a7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-header .btn-outline-dark {
|
||||||
|
border-color: rgba(255, 255, 255, 0.72);
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-header .btn-outline-dark:hover,
|
||||||
|
.site-header .btn-outline-dark:focus {
|
||||||
|
background: rgba(255, 255, 255, 0.14);
|
||||||
|
border-color: #ffffff;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
background: rgba(255, 255, 255, 0.92);
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand,
|
||||||
|
.section-title,
|
||||||
|
.page-title,
|
||||||
|
.display-title,
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.display-title {
|
||||||
|
font-size: clamp(2.4rem, 4vw, 4.2rem);
|
||||||
|
line-height: 1.02;
|
||||||
|
font-weight: 700;
|
||||||
|
max-width: 11ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-title {
|
||||||
|
font-size: clamp(2rem, 3vw, 3rem);
|
||||||
|
line-height: 1.05;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: clamp(1.7rem, 2vw, 2.3rem);
|
||||||
|
line-height: 1.1;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lead {
|
||||||
|
font-size: 1.05rem;
|
||||||
|
line-height: 1.65;
|
||||||
|
}
|
||||||
|
|
||||||
|
.eyebrow {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.78rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.surface-card,
|
||||||
|
.compact-card,
|
||||||
|
.metric-card,
|
||||||
|
.metric-inline,
|
||||||
|
.section-score-card,
|
||||||
|
.compact-panel,
|
||||||
|
.empty-state,
|
||||||
|
.score-chip {
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
box-shadow: var(--shadow-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.surface-card {
|
||||||
|
box-shadow: var(--shadow-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.compact-card,
|
||||||
|
.metric-card,
|
||||||
|
.metric-inline,
|
||||||
|
.section-score-card,
|
||||||
|
.compact-panel,
|
||||||
|
.empty-state {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section,
|
||||||
|
.border-top,
|
||||||
|
.border-bottom {
|
||||||
|
border-color: var(--border) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-card,
|
||||||
|
.metric-inline {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.3rem;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-card strong,
|
||||||
|
.metric-inline strong {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-card span,
|
||||||
|
.metric-inline span,
|
||||||
|
.compact-card span {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.92rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pill-badge {
|
||||||
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
min-height: 100vh;
|
border: 1px solid var(--border-strong);
|
||||||
width: 100%;
|
border-radius: 999px;
|
||||||
padding: 20px;
|
padding: 0.25rem 0.65rem;
|
||||||
box-sizing: border-box;
|
font-size: 0.78rem;
|
||||||
position: relative;
|
font-weight: 600;
|
||||||
z-index: 1;
|
color: var(--accent);
|
||||||
|
background: var(--accent-soft);
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes gradient {
|
.pill-badge.subdued {
|
||||||
0% {
|
background: var(--surface-muted);
|
||||||
background-position: 0% 50%;
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
background-position: 100% 50%;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
background-position: 0% 50%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-container {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 600px;
|
|
||||||
background: rgba(255, 255, 255, 0.85);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
||||||
border-radius: 20px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 85vh;
|
|
||||||
box-shadow: 0 20px 40px rgba(0,0,0,0.2);
|
|
||||||
backdrop-filter: blur(15px);
|
|
||||||
-webkit-backdrop-filter: blur(15px);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-header {
|
.doctor-biznes-logo-link {
|
||||||
padding: 1.5rem;
|
display: inline-flex;
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
max-width: 100%;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: transform 0.18s ease, opacity 0.18s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-messages {
|
.doctor-biznes-logo-link:hover {
|
||||||
flex: 1;
|
opacity: 0.96;
|
||||||
overflow-y: auto;
|
transform: translateY(-1px);
|
||||||
padding: 1.5rem;
|
}
|
||||||
|
|
||||||
|
.doctor-biznes-logo-link--nav {
|
||||||
|
flex-shrink: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.doctor-biznes-logo-link--compact .doctor-biznes-logo {
|
||||||
|
width: min(260px, 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.doctor-biznes-logo {
|
||||||
|
display: block;
|
||||||
|
width: min(391px, 100%);
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.doctor-biznes-logo-link--nav .doctor-biznes-logo {
|
||||||
|
width: min(250px, 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-list,
|
||||||
|
.rank-list,
|
||||||
|
.answer-review-list {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-list li,
|
||||||
|
.rank-list li,
|
||||||
|
.answer-review-list li {
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
padding: 0.9rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-list li:first-child,
|
||||||
|
.rank-list li:first-child,
|
||||||
|
.answer-review-list li:first-child {
|
||||||
|
border-top: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rank-list li,
|
||||||
|
.answer-review-list li {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1.25rem;
|
gap: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Custom Scrollbar */
|
.rank-list strong,
|
||||||
::-webkit-scrollbar {
|
.answer-review-list em {
|
||||||
width: 6px;
|
color: var(--accent);
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-track {
|
.compact-card {
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
|
||||||
background: rgba(255, 255, 255, 0.3);
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb:hover {
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.message {
|
|
||||||
max-width: 85%;
|
|
||||||
padding: 0.85rem 1.1rem;
|
|
||||||
border-radius: 16px;
|
|
||||||
line-height: 1.5;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
|
||||||
animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes fadeIn {
|
|
||||||
from { opacity: 0; transform: translateY(20px) scale(0.95); }
|
|
||||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.message.visitor {
|
|
||||||
align-self: flex-end;
|
|
||||||
background: linear-gradient(135deg, #212529 0%, #343a40 100%);
|
|
||||||
color: #fff;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message.bot {
|
|
||||||
align-self: flex-start;
|
|
||||||
background: #ffffff;
|
|
||||||
color: #212529;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area {
|
|
||||||
padding: 1.25rem;
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
border-top: 1px solid rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area form {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0.75rem;
|
flex-direction: column;
|
||||||
|
gap: 0.4rem;
|
||||||
|
min-height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-input-area input {
|
.score-chip {
|
||||||
flex: 1;
|
padding: 1rem 1.1rem;
|
||||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
min-width: 140px;
|
||||||
border-radius: 12px;
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
outline: none;
|
|
||||||
background: rgba(255, 255, 255, 0.9);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-input-area input:focus {
|
.score-chip span {
|
||||||
border-color: #23a6d5;
|
|
||||||
box-shadow: 0 0 0 3px rgba(35, 166, 213, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area button {
|
|
||||||
background: #212529;
|
|
||||||
color: #fff;
|
|
||||||
border: none;
|
|
||||||
padding: 0.75rem 1.5rem;
|
|
||||||
border-radius: 12px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-weight: 600;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area button:hover {
|
|
||||||
background: #000;
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Background Animations */
|
|
||||||
.bg-animations {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
z-index: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob {
|
|
||||||
position: absolute;
|
|
||||||
width: 500px;
|
|
||||||
height: 500px;
|
|
||||||
background: rgba(255, 255, 255, 0.2);
|
|
||||||
border-radius: 50%;
|
|
||||||
filter: blur(80px);
|
|
||||||
animation: move 20s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-1 {
|
|
||||||
top: -10%;
|
|
||||||
left: -10%;
|
|
||||||
background: rgba(238, 119, 82, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-2 {
|
|
||||||
bottom: -10%;
|
|
||||||
right: -10%;
|
|
||||||
background: rgba(35, 166, 213, 0.4);
|
|
||||||
animation-delay: -7s;
|
|
||||||
width: 600px;
|
|
||||||
height: 600px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-3 {
|
|
||||||
top: 40%;
|
|
||||||
left: 30%;
|
|
||||||
background: rgba(231, 60, 126, 0.3);
|
|
||||||
animation-delay: -14s;
|
|
||||||
width: 450px;
|
|
||||||
height: 450px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes move {
|
|
||||||
0% { transform: translate(0, 0) rotate(0deg) scale(1); }
|
|
||||||
33% { transform: translate(150px, 100px) rotate(120deg) scale(1.1); }
|
|
||||||
66% { transform: translate(-50px, 200px) rotate(240deg) scale(0.9); }
|
|
||||||
100% { transform: translate(0, 0) rotate(360deg) scale(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-link {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
background: rgba(0, 0, 0, 0.2);
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
border-radius: 8px;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-link:hover {
|
|
||||||
background: rgba(0, 0, 0, 0.4);
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Admin Styles */
|
|
||||||
.admin-container {
|
|
||||||
max-width: 900px;
|
|
||||||
margin: 3rem auto;
|
|
||||||
padding: 2.5rem;
|
|
||||||
background: rgba(255, 255, 255, 0.85);
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
border-radius: 24px;
|
|
||||||
box-shadow: 0 20px 50px rgba(0,0,0,0.15);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.4);
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-container h1 {
|
|
||||||
margin-top: 0;
|
|
||||||
color: #212529;
|
|
||||||
font-weight: 800;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: separate;
|
|
||||||
border-spacing: 0 8px;
|
|
||||||
margin-top: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table th {
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
padding: 1rem;
|
|
||||||
color: #6c757d;
|
|
||||||
font-weight: 600;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-size: 0.75rem;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table td {
|
|
||||||
background: #fff;
|
|
||||||
padding: 1rem;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table tr td:first-child { border-radius: 12px 0 0 12px; }
|
|
||||||
.table tr td:last-child { border-radius: 0 12px 12px 0; }
|
|
||||||
|
|
||||||
.form-group {
|
|
||||||
margin-bottom: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-group label {
|
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 0.5rem;
|
color: var(--muted);
|
||||||
font-weight: 600;
|
font-size: 0.86rem;
|
||||||
font-size: 0.9rem;
|
}
|
||||||
|
|
||||||
|
.score-chip strong {
|
||||||
|
font-size: 2rem;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attempt-header {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attempt-identity {
|
||||||
|
flex: 1 1 18rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attempt-email {
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.score-chip {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control,
|
||||||
|
.form-check-input,
|
||||||
|
.answer-card,
|
||||||
|
.accordion-item,
|
||||||
|
.accordion-button,
|
||||||
|
.btn,
|
||||||
|
.progress {
|
||||||
|
border-radius: var(--radius-sm) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control {
|
.form-control {
|
||||||
width: 100%;
|
padding: 0.85rem 0.95rem;
|
||||||
padding: 0.75rem 1rem;
|
border-color: var(--border-strong);
|
||||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
box-shadow: none;
|
||||||
border-radius: 12px;
|
|
||||||
background: #fff;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control:focus {
|
.form-control:focus,
|
||||||
outline: none;
|
.form-check-input:focus,
|
||||||
border-color: #23a6d5;
|
.btn:focus,
|
||||||
box-shadow: 0 0 0 3px rgba(35, 166, 213, 0.1);
|
.answer-card:focus-within {
|
||||||
|
border-color: #94a3b8;
|
||||||
|
box-shadow: 0 0 0 0.2rem rgba(148, 163, 184, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-container {
|
.btn {
|
||||||
display: flex;
|
padding: 0.8rem 1.1rem;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-links {
|
|
||||||
display: flex;
|
|
||||||
gap: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-card {
|
|
||||||
background: rgba(255, 255, 255, 0.6);
|
|
||||||
padding: 2rem;
|
|
||||||
border-radius: 20px;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.5);
|
|
||||||
margin-bottom: 2.5rem;
|
|
||||||
box-shadow: 0 10px 30px rgba(0,0,0,0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-card h3 {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-delete {
|
|
||||||
background: #dc3545;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 0.25rem 0.5rem;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-add {
|
|
||||||
background: #212529;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-save {
|
|
||||||
background: #0088cc;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 0.8rem 1.5rem;
|
|
||||||
border-radius: 12px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
width: 100%;
|
letter-spacing: -0.01em;
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.webhook-url {
|
.btn-dark {
|
||||||
font-size: 0.85em;
|
background: var(--accent);
|
||||||
color: #555;
|
border-color: var(--accent);
|
||||||
margin-top: 0.5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-table-container {
|
.btn-dark:hover,
|
||||||
overflow-x: auto;
|
.btn-dark:focus {
|
||||||
background: rgba(255, 255, 255, 0.4);
|
background: #111827;
|
||||||
|
border-color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
.answer-grid {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.answer-card {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 68px;
|
||||||
|
padding: 1rem 1rem 1rem 3rem;
|
||||||
|
border: 1px solid var(--border-strong);
|
||||||
|
background: var(--surface);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.answer-card:hover {
|
||||||
|
border-color: #98a2b3;
|
||||||
|
background: var(--surface-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.answer-card.is-selected {
|
||||||
|
border-color: var(--accent);
|
||||||
|
background: var(--accent-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.answer-input {
|
||||||
|
position: absolute;
|
||||||
|
left: 1rem;
|
||||||
|
width: 1rem;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.answer-label {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-title {
|
||||||
|
font-size: clamp(1.6rem, 2vw, 2.3rem);
|
||||||
|
line-height: 1.2;
|
||||||
|
max-width: 24ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quiz-progress {
|
||||||
|
height: 0.55rem;
|
||||||
|
background: #e8ecf1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quiz-progress .progress-bar {
|
||||||
|
background: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quiz-progress.slim {
|
||||||
|
height: 0.45rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-score-card {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border-radius: 12px;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-table {
|
.admin-workspace {
|
||||||
|
max-width: 1680px;
|
||||||
|
padding-left: clamp(1rem, 2vw, 2rem);
|
||||||
|
padding-right: clamp(1rem, 2vw, 2rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-table-wrap {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
table-layout: fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-table-time {
|
.admin-table thead th,
|
||||||
width: 15%;
|
.admin-table tbody td {
|
||||||
|
white-space: normal;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-table th:nth-child(1),
|
||||||
|
.admin-table td:nth-child(1) {
|
||||||
|
width: 6%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-table th:nth-child(2),
|
||||||
|
.admin-table td:nth-child(2) {
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-table th:nth-child(3),
|
||||||
|
.admin-table td:nth-child(3) {
|
||||||
|
width: 12%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-table th:nth-child(4),
|
||||||
|
.admin-table td:nth-child(4) {
|
||||||
|
width: 13%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-table th:nth-child(5),
|
||||||
|
.admin-table td:nth-child(5) {
|
||||||
|
width: 8%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-table th:nth-child(6),
|
||||||
|
.admin-table td:nth-child(6) {
|
||||||
|
width: 18%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-table th:nth-child(7),
|
||||||
|
.admin-table td:nth-child(7) {
|
||||||
|
width: 11%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-table th:nth-child(8),
|
||||||
|
.admin-table td:nth-child(8) {
|
||||||
|
width: 12%;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
font-size: 0.85em;
|
|
||||||
color: #555;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-table-user {
|
.admin-table thead th {
|
||||||
width: 35%;
|
color: var(--muted);
|
||||||
background: rgba(255, 255, 255, 0.3);
|
font-size: 0.78rem;
|
||||||
border-radius: 8px;
|
text-transform: uppercase;
|
||||||
padding: 8px;
|
letter-spacing: 0.06em;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
border-color: var(--border);
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-table-ai {
|
.admin-table tbody td {
|
||||||
width: 50%;
|
border-color: var(--border);
|
||||||
background: rgba(255, 255, 255, 0.5);
|
vertical-align: middle;
|
||||||
border-radius: 8px;
|
|
||||||
padding: 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-messages {
|
.accordion-item,
|
||||||
|
.accordion-button {
|
||||||
|
border-color: var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion-button:not(.collapsed) {
|
||||||
|
background: var(--accent-soft);
|
||||||
|
color: var(--text);
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #777;
|
}
|
||||||
}
|
|
||||||
|
.alert {
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
border-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.py-lg-6 {
|
||||||
|
padding-top: 5rem !important;
|
||||||
|
padding-bottom: 5rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
.admin-table-wrap {
|
||||||
|
overflow-x: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767.98px) {
|
||||||
|
.display-title {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-title {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,39 +1,33 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const chatForm = document.getElementById('chat-form');
|
const answerCards = document.querySelectorAll('.answer-card');
|
||||||
const chatInput = document.getElementById('chat-input');
|
|
||||||
const chatMessages = document.getElementById('chat-messages');
|
|
||||||
|
|
||||||
const appendMessage = (text, sender) => {
|
answerCards.forEach((card) => {
|
||||||
const msgDiv = document.createElement('div');
|
const input = card.querySelector('.answer-input');
|
||||||
msgDiv.classList.add('message', sender);
|
if (!input) return;
|
||||||
msgDiv.textContent = text;
|
|
||||||
chatMessages.appendChild(msgDiv);
|
|
||||||
chatMessages.scrollTop = chatMessages.scrollHeight;
|
|
||||||
};
|
|
||||||
|
|
||||||
chatForm.addEventListener('submit', async (e) => {
|
const updateSelection = () => {
|
||||||
e.preventDefault();
|
const group = document.querySelectorAll(`input[name="${input.name}"]`);
|
||||||
const message = chatInput.value.trim();
|
group.forEach((radio) => {
|
||||||
if (!message) return;
|
const wrapper = radio.closest('.answer-card');
|
||||||
|
if (wrapper) wrapper.classList.toggle('is-selected', radio.checked);
|
||||||
appendMessage(message, 'visitor');
|
|
||||||
chatInput.value = '';
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch('api/chat.php', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify({ message })
|
|
||||||
});
|
});
|
||||||
const data = await response.json();
|
};
|
||||||
|
|
||||||
// Artificial delay for realism
|
card.addEventListener('click', () => {
|
||||||
setTimeout(() => {
|
input.checked = true;
|
||||||
appendMessage(data.reply, 'bot');
|
updateSelection();
|
||||||
}, 500);
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error('Error:', error);
|
input.addEventListener('change', updateSelection);
|
||||||
appendMessage("Sorry, something went wrong. Please try again.", 'bot');
|
});
|
||||||
|
|
||||||
|
const alerts = document.querySelectorAll('.alert');
|
||||||
|
alerts.forEach((alert) => {
|
||||||
|
if (alert.classList.contains('alert-success') || alert.classList.contains('alert-info')) {
|
||||||
|
window.setTimeout(() => {
|
||||||
|
alert.classList.add('fade');
|
||||||
|
alert.classList.remove('show');
|
||||||
|
}, 4500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
BIN
assets/pasted-20260411-193055-cf804299.png
Normal file
BIN
assets/pasted-20260411-193055-cf804299.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 255 KiB |
BIN
assets/pasted-20260411-194222-a875bba4.png
Normal file
BIN
assets/pasted-20260411-194222-a875bba4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
BIN
assets/pasted-20260411-195026-07534abe.png
Normal file
BIN
assets/pasted-20260411-195026-07534abe.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
119
db/app_39564_2026-04-12_04-11-38_utc.sql
Normal file
119
db/app_39564_2026-04-12_04-11-38_utc.sql
Normal file
File diff suppressed because one or more lines are too long
467
diagnostic.php
Normal file
467
diagnostic.php
Normal file
@ -0,0 +1,467 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
require_once __DIR__ . '/app/bootstrap.php';
|
||||||
|
|
||||||
|
$definition = diagnostic_quiz_definition();
|
||||||
|
$questions = diagnostic_flat_questions();
|
||||||
|
$totalQuestions = count($questions);
|
||||||
|
$totalSections = count($definition['sections'] ?? []);
|
||||||
|
$flash = diagnostic_flash_get();
|
||||||
|
|
||||||
|
if (isset($_GET['reset']) && $_GET['reset'] === '1') {
|
||||||
|
diagnostic_clear_attempt_session();
|
||||||
|
diagnostic_flash_set('info', 'Poprzednia, niedokończona diagnoza została wyczyszczona.');
|
||||||
|
header('Location: /diagnostic.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$attempt = diagnostic_current_attempt();
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$action = $_POST['action'] ?? '';
|
||||||
|
|
||||||
|
if ($action === 'start') {
|
||||||
|
$email = trim((string)($_POST['email'] ?? ''));
|
||||||
|
$marketingConsent = isset($_POST['marketing_consent']) && $_POST['marketing_consent'] === '1';
|
||||||
|
|
||||||
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
diagnostic_flash_set('danger', 'Podaj poprawny adres e-mail, na który mamy wysłać raport.');
|
||||||
|
header('Location: /diagnostic.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
diagnostic_create_attempt($email, $marketingConsent);
|
||||||
|
header('Location: /diagnostic.php?step=1');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action === 'save-answer') {
|
||||||
|
$attempt = diagnostic_current_attempt();
|
||||||
|
if (!$attempt) {
|
||||||
|
diagnostic_flash_set('warning', 'Sesja wygasła. Rozpocznij diagnozę ponownie.');
|
||||||
|
header('Location: /diagnostic.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$step = max(1, (int)($_POST['step'] ?? 1));
|
||||||
|
$nav = $_POST['nav'] ?? 'next';
|
||||||
|
$question = $questions[$step - 1] ?? null;
|
||||||
|
|
||||||
|
if (!$question) {
|
||||||
|
header('Location: /diagnostic.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($nav === 'back') {
|
||||||
|
if (isset($_POST['answer']) && $_POST['answer'] !== '') {
|
||||||
|
diagnostic_save_answer((int)$attempt['id'], $question['id'], (int)$_POST['answer'], $step);
|
||||||
|
}
|
||||||
|
$targetStep = max(1, $step - 1);
|
||||||
|
diagnostic_update_step((int)$attempt['id'], $targetStep);
|
||||||
|
header('Location: /diagnostic.php?step=' . $targetStep);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_POST['answer']) || $_POST['answer'] === '' || !in_array((int)$_POST['answer'], [0, 1, 2, 3], true)) {
|
||||||
|
diagnostic_flash_set('danger', 'Wybierz jedną odpowiedź, aby przejść dalej.');
|
||||||
|
header('Location: /diagnostic.php?step=' . $step);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
diagnostic_save_answer((int)$attempt['id'], $question['id'], (int)$_POST['answer'], $step);
|
||||||
|
|
||||||
|
if ($step >= $totalQuestions) {
|
||||||
|
diagnostic_finalize_attempt((int)$attempt['id']);
|
||||||
|
header('Location: /diagnostic.php?view=result');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$targetStep = $step + 1;
|
||||||
|
diagnostic_update_step((int)$attempt['id'], $targetStep);
|
||||||
|
header('Location: /diagnostic.php?step=' . $targetStep);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action === 'request-consultation') {
|
||||||
|
$attempt = diagnostic_current_attempt();
|
||||||
|
if (!$attempt || ($attempt['status'] ?? '') !== 'completed') {
|
||||||
|
diagnostic_flash_set('warning', 'Najpierw ukończ diagnozę, aby zostawić numer telefonu do kontaktu.');
|
||||||
|
header('Location: /diagnostic.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$phone = diagnostic_normalize_phone((string)($_POST['phone'] ?? ''));
|
||||||
|
if (!diagnostic_phone_is_valid($phone)) {
|
||||||
|
diagnostic_flash_set('danger', 'Podaj poprawny numer telefonu, abyśmy mogli wrócić z propozycją dalszej konsultacji.');
|
||||||
|
header('Location: /diagnostic.php?view=result&modal=consultation');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
diagnostic_save_contact_phone((int)$attempt['id'], $phone);
|
||||||
|
$updatedAttempt = diagnostic_get_attempt((int)$attempt['id']) ?? $attempt;
|
||||||
|
$notificationResult = diagnostic_send_consultation_notification($updatedAttempt);
|
||||||
|
|
||||||
|
if (!empty($notificationResult['success'])) {
|
||||||
|
diagnostic_flash_set('success', 'Dziękujemy. Numer telefonu został zapisany, a administrator otrzymał powiadomienie e-mail o prośbie o kontakt.');
|
||||||
|
} elseif (($notificationResult['reason'] ?? '') === 'missing_recipient') {
|
||||||
|
diagnostic_flash_set('warning', 'Numer telefonu został zapisany, ale adres powiadomień administratora nie jest jeszcze ustawiony w panelu administracyjnym.');
|
||||||
|
} else {
|
||||||
|
error_log('Consultation notification email failed: ' . ($notificationResult['error'] ?? 'unknown'));
|
||||||
|
diagnostic_flash_set('warning', 'Numer telefonu został zapisany, ale nie udało się wysłać powiadomienia e-mail do administratora.');
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: /diagnostic.php?view=result');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$attempt = diagnostic_current_attempt();
|
||||||
|
if ($attempt && ($attempt['status'] ?? '') === 'completed' && (!isset($_GET['step']) && ($_GET['view'] ?? '') !== 'result')) {
|
||||||
|
header('Location: /diagnostic.php?view=result');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ($attempt && ($attempt['status'] ?? '') === 'in_progress' && !isset($_GET['step']) && ($_GET['view'] ?? '') !== 'landing') {
|
||||||
|
header('Location: /diagnostic.php?step=' . (int)$attempt['current_step']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$requestedView = $_GET['view'] ?? '';
|
||||||
|
if ($requestedView === 'result') {
|
||||||
|
$view = 'result';
|
||||||
|
} elseif (isset($_GET['step']) || ($attempt && ($attempt['status'] ?? '') === 'in_progress')) {
|
||||||
|
$view = 'quiz';
|
||||||
|
} else {
|
||||||
|
$view = 'landing';
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentStep = max(1, min($totalQuestions, (int)($_GET['step'] ?? ($attempt['current_step'] ?? 1))));
|
||||||
|
$currentQuestion = $questions[$currentStep - 1] ?? null;
|
||||||
|
$currentAnswer = $attempt['answers'][$currentQuestion['id'] ?? ''] ?? null;
|
||||||
|
$progressPercent = (int)round(($currentStep / max($totalQuestions, 1)) * 100);
|
||||||
|
$openConsultationModal = isset($_GET['modal']) && $_GET['modal'] === 'consultation';
|
||||||
|
$meta = diagnostic_meta('Diagnoza dojrzałości procesowej', 'Profesjonalna diagnoza dojrzałości procesowej z natychmiastowym podsumowaniem i raportem wysyłanym na e-mail.');
|
||||||
|
$resultOverview = ($view === 'result' && $attempt && ($attempt['status'] ?? '') === 'completed') ? diagnostic_resolve_result_overview($attempt) : '';
|
||||||
|
?>
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="pl">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title><?= htmlspecialchars($meta['title']) ?></title>
|
||||||
|
<meta name="description" content="<?= htmlspecialchars($meta['description']) ?>">
|
||||||
|
<meta property="og:title" content="<?= htmlspecialchars($meta['title']) ?>">
|
||||||
|
<meta property="og:description" content="<?= htmlspecialchars($meta['description']) ?>">
|
||||||
|
<meta property="twitter:title" content="<?= htmlspecialchars($meta['title']) ?>">
|
||||||
|
<meta property="twitter:description" content="<?= htmlspecialchars($meta['description']) ?>">
|
||||||
|
<?php if ($meta['image'] !== ''): ?>
|
||||||
|
<meta property="og:image" content="<?= htmlspecialchars($meta['image']) ?>">
|
||||||
|
<meta property="twitter:image" content="<?= htmlspecialchars($meta['image']) ?>">
|
||||||
|
<?php endif; ?>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="/assets/css/custom.css?v=<?= urlencode((string)@filemtime(__DIR__ . '/assets/css/custom.css')) ?>">
|
||||||
|
</head>
|
||||||
|
<body class="app-shell">
|
||||||
|
<header class="site-header border-bottom bg-white sticky-top">
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light py-3">
|
||||||
|
<div class="container">
|
||||||
|
<?= diagnostic_brand_logo_anchor('navbar-brand doctor-biznes-logo-link--nav') ?>
|
||||||
|
<div class="d-flex align-items-center gap-2 ms-auto">
|
||||||
|
<a class="btn btn-sm btn-dark" href="/diagnostic.php<?= $attempt ? '?reset=1' : '' ?>"><?= $attempt ? 'Rozpocznij od nowa' : 'Rozpocznij diagnozę' ?></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="py-4 py-lg-5">
|
||||||
|
<div class="container">
|
||||||
|
<?php if ($flash): ?>
|
||||||
|
<div class="alert alert-<?= htmlspecialchars($flash['type']) ?> mb-4" role="alert">
|
||||||
|
<?= htmlspecialchars($flash['message']) ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($view === 'landing'): ?>
|
||||||
|
<section class="surface-card p-4 p-lg-5 mb-4">
|
||||||
|
<div class="row g-4 align-items-center">
|
||||||
|
<div class="col-lg-7">
|
||||||
|
<div class="eyebrow mb-3">Narzędzie diagnostyczne</div>
|
||||||
|
<h1 class="page-title mb-3"><?= htmlspecialchars($definition['quiz']['title']) ?></h1>
|
||||||
|
<p class="lead text-secondary mb-4"><?= htmlspecialchars($definition['quiz']['subtitle']) ?></p>
|
||||||
|
<div class="row g-3 mb-4">
|
||||||
|
<div class="col-sm-6"><div class="metric-inline"><span>Czas wypełnienia</span><strong><?= htmlspecialchars($definition['quiz']['estimated_time']) ?></strong></div></div>
|
||||||
|
<div class="col-sm-6"><div class="metric-inline"><span>Format</span><strong><?= $totalQuestions ?> pytań w <?= $totalSections ?> obszarach</strong></div></div>
|
||||||
|
<div class="col-sm-6"><div class="metric-inline"><span>Rezultat</span><strong>Wynik na ekranie + raport e-mail</strong></div></div>
|
||||||
|
<div class="col-sm-6"><div class="metric-inline"><span>Odbiorca</span><strong>Właściciele i liderzy operacyjni</strong></div></div>
|
||||||
|
</div>
|
||||||
|
<ul class="feature-list mb-0">
|
||||||
|
<li>Jedno pytanie na ekranie, bez zbędnego rozproszenia.</li>
|
||||||
|
<li>Ocena w 7 kluczowych obszarach operacyjnych firmy.</li>
|
||||||
|
<li>Natychmiastowe podsumowanie z najmocniejszymi i najsłabszymi obszarami.</li>
|
||||||
|
<li>Raport wysyłany na adres e-mail podany przed rozpoczęciem diagnozy.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<div class="surface-card p-4 bg-white border h-100">
|
||||||
|
<div class="eyebrow mb-3">Krok 1 z 2</div>
|
||||||
|
<h2 class="h4 mb-3">Podaj adres e-mail</h2>
|
||||||
|
<p class="text-secondary mb-4">Podsumowanie zobaczysz od razu na ekranie, a rozszerzony raport wyślemy na wskazany adres e-mail. Konto użytkownika nie jest wymagane.</p>
|
||||||
|
<form method="post" novalidate>
|
||||||
|
<input type="hidden" name="action" value="start">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label">Adres e-mail</label>
|
||||||
|
<input type="email" class="form-control form-control-lg" id="email" name="email" placeholder="np. zarzad@twojafirma.pl" required>
|
||||||
|
</div>
|
||||||
|
<p class="small text-secondary mb-3">Podanie adresu e-mail jest wymagane wyłącznie do dostarczenia raportu z diagnozy. Zgoda marketingowa jest opcjonalna i niezależna od wysyłki raportu.</p>
|
||||||
|
<div class="form-check mb-4">
|
||||||
|
<input class="form-check-input" type="checkbox" value="1" id="marketingConsent" name="marketing_consent">
|
||||||
|
<label class="form-check-label text-secondary" for="marketingConsent">
|
||||||
|
Wyrażam zgodę na otrzymywanie dodatkowych materiałów dotyczących usprawniania procesów i zarządzania operacyjnego.
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-dark btn-lg w-100">Rozpocznij diagnozę</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="row g-4">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<div class="surface-card p-4 p-lg-5 h-100">
|
||||||
|
<div class="section-intro mb-3">
|
||||||
|
<div class="eyebrow">Zakres diagnozy</div>
|
||||||
|
<h2 class="section-title">Co ocenia to narzędzie</h2>
|
||||||
|
</div>
|
||||||
|
<div class="row g-3">
|
||||||
|
<?php foreach ($definition['sections'] as $section): ?>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="compact-card">
|
||||||
|
<strong><?= htmlspecialchars($section['name']) ?></strong>
|
||||||
|
<span><?= count($section['questions']) ?> pytań dotyczących dojrzałości operacyjnej w tym obszarze.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="surface-card p-4 p-lg-5 h-100">
|
||||||
|
<div class="section-intro mb-3">
|
||||||
|
<div class="eyebrow">Po co to robić</div>
|
||||||
|
<h2 class="section-title">Dlaczego warto wykonać diagnozę</h2>
|
||||||
|
</div>
|
||||||
|
<ul class="feature-list mb-0">
|
||||||
|
<li>Zobaczysz, które obszary wymagają największej interwencji organizacyjnej.</li>
|
||||||
|
<li>Łatwiej ustalisz priorytety usprawnień zamiast działać intuicyjnie.</li>
|
||||||
|
<li>Otrzymasz punkt wyjścia do rozmowy o wdrożeniu zmian lub konsultacji.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<?php elseif ($view === 'quiz' && $attempt && ($attempt['status'] ?? '') === 'in_progress' && $currentQuestion): ?>
|
||||||
|
<section class="surface-card p-4 p-lg-5 mb-4">
|
||||||
|
<div class="d-flex flex-column flex-lg-row justify-content-between gap-3 align-items-lg-center mb-4">
|
||||||
|
<div>
|
||||||
|
<div class="eyebrow mb-2"><?= htmlspecialchars($currentQuestion['section_name']) ?></div>
|
||||||
|
<h1 class="page-title mb-2"><?= htmlspecialchars($currentQuestion['text']) ?></h1>
|
||||||
|
<p class="text-secondary mb-0">Pytanie <?= $currentStep ?> z <?= $totalQuestions ?>. Odpowiedz zgodnie z aktualnym stanem organizacji, a nie stanem docelowym.</p>
|
||||||
|
</div>
|
||||||
|
<div class="score-chip text-end">
|
||||||
|
<span>Postęp</span>
|
||||||
|
<strong><?= $progressPercent ?>%</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="progress mb-4" style="height: 10px;">
|
||||||
|
<div class="progress-bar bg-dark" role="progressbar" style="width: <?= $progressPercent ?>%;" aria-valuenow="<?= $progressPercent ?>" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="post" novalidate>
|
||||||
|
<input type="hidden" name="action" value="save-answer">
|
||||||
|
<input type="hidden" name="step" value="<?= $currentStep ?>">
|
||||||
|
<div class="row g-3 mb-4">
|
||||||
|
<?php foreach ($definition['answer_scale'] as $value => $label): ?>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="answer-card h-100 <?= ((string)$currentAnswer === (string)$value) ? 'is-selected' : '' ?>">
|
||||||
|
<input class="answer-input" type="radio" name="answer" value="<?= $value ?>" <?= ((string)$currentAnswer === (string)$value) ? 'checked' : '' ?>>
|
||||||
|
<strong><?= htmlspecialchars($label) ?></strong>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex flex-column flex-sm-row gap-3 justify-content-between">
|
||||||
|
<button type="submit" name="nav" value="back" class="btn btn-outline-dark btn-lg<?= $currentStep === 1 ? ' disabled' : '' ?>" <?= $currentStep === 1 ? 'disabled' : '' ?>>Wstecz</button>
|
||||||
|
<button type="submit" name="nav" value="next" class="btn btn-dark btn-lg ms-sm-auto"><?= $currentStep === $totalQuestions ? 'Zakończ diagnozę' : 'Następne pytanie' ?></button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<?php elseif ($view === 'result' && $attempt && ($attempt['status'] ?? '') === 'completed'): ?>
|
||||||
|
<?php $result = $attempt['result'] ?? []; ?>
|
||||||
|
<section class="surface-card p-4 p-lg-5 mb-4">
|
||||||
|
<div class="d-flex flex-column flex-lg-row justify-content-between gap-4 align-items-lg-start mb-4">
|
||||||
|
<div>
|
||||||
|
<div class="eyebrow mb-3">Podsumowanie diagnozy</div>
|
||||||
|
<h1 class="page-title mb-2"><?= htmlspecialchars($result['segment_label'] ?? 'Diagnoza zakończona') ?></h1>
|
||||||
|
<p class="lead text-secondary mb-0"><?= htmlspecialchars($result['segment_summary'] ?? '') ?></p>
|
||||||
|
</div>
|
||||||
|
<div class="score-chip text-end">
|
||||||
|
<span>Łączny wynik</span>
|
||||||
|
<strong><?= (int)($result['percentage_score'] ?? 0) ?>%</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (($attempt['email_report_status'] ?? '') !== 'sent'): ?>
|
||||||
|
<div class="alert alert-warning mb-4" role="alert">Podsumowanie na ekranie jest gotowe. Wysyłka raportu e-mail nie została jeszcze potwierdzona, więc przed użyciem produkcyjnym sprawdź konfigurację SMTP.</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="alert alert-success mb-4" role="alert">Szczegółowy raport został wysłany na adres <?= htmlspecialchars((string)$attempt['email']) ?>.</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="row g-3 mb-4">
|
||||||
|
<?php foreach (($result['section_scores'] ?? []) as $section): ?>
|
||||||
|
<div class="col-md-6 col-xl-4">
|
||||||
|
<div class="section-score-card h-100">
|
||||||
|
<span class="small text-secondary d-block mb-2"><?= htmlspecialchars($section['section_name']) ?></span>
|
||||||
|
<strong class="d-block mb-1"><?= (int)$section['percentage'] ?>%</strong>
|
||||||
|
<div class="progress" style="height: 8px;">
|
||||||
|
<div class="progress-bar bg-dark" role="progressbar" style="width: <?= (int)$section['percentage'] ?>%;" aria-valuenow="<?= (int)$section['percentage'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<?php if ($resultOverview !== ''): ?>
|
||||||
|
<section class="surface-card p-4 p-lg-5 mb-4">
|
||||||
|
<h2 class="section-title mb-3">Co ten wynik mówi o Twojej organizacji</h2>
|
||||||
|
<p class="text-secondary mb-0"><?= nl2br(htmlspecialchars($resultOverview)) ?></p>
|
||||||
|
</section>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<section class="row g-4">
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="surface-card p-4 h-100">
|
||||||
|
<div class="eyebrow mb-3">Najmocniejsze obszary</div>
|
||||||
|
<ol class="rank-list mb-0">
|
||||||
|
<?php foreach (($result['strongest_areas'] ?? []) as $area): ?>
|
||||||
|
<li>
|
||||||
|
<strong><?= htmlspecialchars($area['section_name']) ?></strong>
|
||||||
|
<span><?= (int)$area['percentage'] ?>% dojrzałości w tym obszarze.</span>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="surface-card p-4 h-100">
|
||||||
|
<div class="eyebrow mb-3">Priorytety do poprawy</div>
|
||||||
|
<ol class="rank-list mb-0">
|
||||||
|
<?php foreach (($result['weakest_areas'] ?? []) as $area): ?>
|
||||||
|
<li>
|
||||||
|
<strong><?= htmlspecialchars($area['section_name']) ?></strong>
|
||||||
|
<span><?= (int)$area['percentage'] ?>% — tutaj warto rozpocząć porządkowanie i standaryzację.</span>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="surface-card p-4 h-100">
|
||||||
|
<div class="eyebrow mb-3">Rekomendowane kolejne kroki</div>
|
||||||
|
<ul class="feature-list mb-0">
|
||||||
|
<?php foreach (($result['recommendations'] ?? []) as $recommendation): ?>
|
||||||
|
<li><?= htmlspecialchars($recommendation) ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="surface-card p-4 p-lg-5 mt-4">
|
||||||
|
<div class="row g-4 align-items-center">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<div class="eyebrow mb-3">Kolejny krok</div>
|
||||||
|
<h2 class="section-title mb-3">Wykorzystaj wynik jako podstawę do rozmowy o usprawnieniach</h2>
|
||||||
|
<p class="text-secondary mb-3">Największą wartość przynosi przełożenie diagnozy na plan działań: uporządkowanie odpowiedzialności, standaryzację procesów i wdrożenie prostych mechanizmów kontroli. To naturalny punkt wyjścia do konsultacji operacyjnej lub warsztatu usprawniającego.</p>
|
||||||
|
<?php if (!empty($attempt['contact_phone'])): ?>
|
||||||
|
<div class="alert alert-success mb-0" role="alert">
|
||||||
|
Numer do kontaktu został już zapisany: <strong><?= htmlspecialchars((string)$attempt['contact_phone']) ?></strong>.
|
||||||
|
<?php if (!empty($attempt['consultation_requested_at'])): ?>
|
||||||
|
<span class="d-block small mt-1">Prośba o kontakt została wysłana <?= htmlspecialchars((string)$attempt['consultation_requested_at']) ?>.</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 d-flex flex-column gap-3">
|
||||||
|
<button type="button" class="btn btn-dark btn-lg" data-bs-toggle="modal" data-bs-target="#consultationModal"><?= !empty($attempt['contact_phone']) ? 'Zaktualizuj numer kontaktowy' : 'Umów kolejny krok' ?></button>
|
||||||
|
<a class="btn btn-outline-dark btn-lg" href="/diagnostic.php?reset=1">Wykonaj diagnozę ponownie</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<div class="modal fade" id="consultationModal" tabindex="-1" aria-labelledby="consultationModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<div>
|
||||||
|
<div class="eyebrow mb-2">Dalsza konsultacja</div>
|
||||||
|
<h2 class="modal-title h4 mb-0" id="consultationModalLabel">Podaj numer telefonu</h2>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Zamknij"></button>
|
||||||
|
</div>
|
||||||
|
<form method="post" novalidate>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="hidden" name="action" value="request-consultation">
|
||||||
|
<p class="text-secondary mb-4">Oddzwonimy, aby omówić wynik diagnozy i zaproponować dalszy zakres konsultacji. Numer telefonu jest wymagany, żebyśmy mogli się z Tobą skontaktować.</p>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="contactPhone" class="form-label">Numer telefonu</label>
|
||||||
|
<input type="tel" class="form-control form-control-lg" id="contactPhone" name="phone" inputmode="tel" autocomplete="tel" placeholder="np. +48 500 600 700" value="<?= htmlspecialchars((string)($attempt['contact_phone'] ?? '')) ?>" required>
|
||||||
|
</div>
|
||||||
|
<p class="small text-secondary mb-0">Akceptowane są cyfry oraz znaki <code>+</code>, spacje, myślniki i nawiasy.</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-outline-dark" data-bs-dismiss="modal">Anuluj</button>
|
||||||
|
<button type="submit" class="btn btn-dark">Wyślij numer do kontaktu</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php else: ?>
|
||||||
|
<section class="empty-state text-center py-5 px-4">
|
||||||
|
<div class="eyebrow mb-3">Brak aktywnej diagnozy</div>
|
||||||
|
<h1 class="page-title mb-3">Nie znaleziono aktywnego wyniku</h1>
|
||||||
|
<p class="text-secondary mb-4">Rozpocznij nowe badanie, aby wygenerować podsumowanie dojrzałości procesowej i raport wysyłany e-mailem.</p>
|
||||||
|
<a class="btn btn-dark" href="/diagnostic.php">Rozpocznij diagnozę</a>
|
||||||
|
</section>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="border-top py-4 bg-white">
|
||||||
|
<div class="container d-flex flex-column flex-md-row justify-content-between gap-2">
|
||||||
|
<span class="text-secondary small">Profesjonalna diagnoza dojrzałości procesowej dla właścicieli firm i liderów operacyjnych.</span>
|
||||||
|
<div class="d-flex gap-3 small">
|
||||||
|
<a class="text-decoration-none text-secondary" href="/">Strona główna</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script>window.FL_SHOW_BUDGE=false;</script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" defer></script>
|
||||||
|
<?php if ($openConsultationModal): ?>
|
||||||
|
<script>
|
||||||
|
window.addEventListener('DOMContentLoaded', function () {
|
||||||
|
var consultationModal = document.getElementById('consultationModal');
|
||||||
|
if (consultationModal && window.bootstrap && window.bootstrap.Modal) {
|
||||||
|
window.bootstrap.Modal.getOrCreateInstance(consultationModal).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php endif; ?>
|
||||||
|
<script src="/assets/js/main.js?v=<?= urlencode((string)@filemtime(__DIR__ . '/assets/js/main.js')) ?>" defer></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
16
healthz.php
Normal file
16
healthz.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
require_once __DIR__ . '/app/bootstrap.php';
|
||||||
|
|
||||||
|
$status = ['status' => 'ok', 'time' => gmdate('c')];
|
||||||
|
try {
|
||||||
|
db()->query('SELECT 1');
|
||||||
|
$status['database'] = 'ok';
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
http_response_code(500);
|
||||||
|
$status['status'] = 'error';
|
||||||
|
$status['database'] = 'error';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($status, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||||
305
index.php
305
index.php
@ -1,150 +1,177 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
@ini_set('display_errors', '1');
|
require_once __DIR__ . '/app/bootstrap.php';
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
$definition = diagnostic_quiz_definition();
|
||||||
$now = date('Y-m-d H:i:s');
|
$totalQuestions = count(diagnostic_flat_questions());
|
||||||
|
$totalSections = count($definition['sections']);
|
||||||
|
$meta = diagnostic_meta('Diagnoza dojrzałości procesowej', 'Profesjonalne narzędzie do oceny uporządkowania procesów, komunikacji i kontroli operacyjnej w firmie.');
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="pl">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>New Style</title>
|
<title><?= htmlspecialchars($meta['title']) ?></title>
|
||||||
<?php
|
<meta name="description" content="<?= htmlspecialchars($meta['description']) ?>">
|
||||||
// Read project preview data from environment
|
<meta property="og:title" content="<?= htmlspecialchars($meta['title']) ?>">
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<meta property="og:description" content="<?= htmlspecialchars($meta['description']) ?>">
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<meta property="twitter:title" content="<?= htmlspecialchars($meta['title']) ?>">
|
||||||
?>
|
<meta property="twitter:description" content="<?= htmlspecialchars($meta['description']) ?>">
|
||||||
<?php if ($projectDescription): ?>
|
<?php if ($meta['image'] !== ''): ?>
|
||||||
<!-- Meta description -->
|
<meta property="og:image" content="<?= htmlspecialchars($meta['image']) ?>">
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
<meta property="twitter:image" content="<?= htmlspecialchars($meta['image']) ?>">
|
||||||
<!-- Open Graph meta tags -->
|
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($projectImageUrl): ?>
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<!-- Open Graph image -->
|
<link rel="stylesheet" href="/assets/css/custom.css?v=<?= urlencode((string)@filemtime(__DIR__ . '/assets/css/custom.css')) ?>">
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="app-shell">
|
||||||
<main>
|
<header class="site-header border-bottom sticky-top">
|
||||||
<div class="card">
|
<nav class="navbar navbar-expand-lg navbar-light py-3">
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<div class="container">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<?= diagnostic_brand_logo_anchor('navbar-brand doctor-biznes-logo-link--nav') ?>
|
||||||
<span class="sr-only">Loading…</span>
|
<div class="d-flex align-items-center gap-2 ms-auto">
|
||||||
</div>
|
<a class="btn btn-sm btn-dark" href="/diagnostic.php">Rozpocznij diagnozę</a>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
</div>
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
</div>
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<section class="hero-section py-5 py-lg-6">
|
||||||
|
<div class="container py-lg-4">
|
||||||
|
<div class="row g-4 align-items-center">
|
||||||
|
<div class="col-lg-7">
|
||||||
|
<h1 class="display-title mb-4">Sprawdź, na ile procesy w Twojej firmie są gotowe do wzrostu.</h1>
|
||||||
|
<p class="lead text-secondary mb-3">To narzędzie pomaga właścicielom firm, dyrektorom zarządzającym i liderom operacyjnym szybko ocenić dojrzałość operacyjną organizacji, wskazać obszary chaosu i ustalić priorytety zmian.</p>
|
||||||
|
<div class="d-inline-flex align-items-center gap-2 px-3 py-2 mb-4 rounded-3 border bg-white shadow-sm">
|
||||||
|
<span class="fw-semibold text-dark">Test jest w 100% darmowy</span>
|
||||||
|
<span class="text-secondary small">Bez opłaty za uruchomienie i bez konieczności rozmowy handlowej.</span>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex flex-column flex-sm-row gap-3 mb-4">
|
||||||
|
<a class="btn btn-dark btn-lg" href="/diagnostic.php">Rozpocznij diagnozę</a>
|
||||||
|
<a class="btn btn-outline-dark btn-lg" href="#zakres">Zobacz zakres oceny</a>
|
||||||
|
</div>
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-sm-4"><div class="metric-inline"><span>Pytania</span><strong><?= $totalQuestions ?></strong></div></div>
|
||||||
|
<div class="col-sm-4"><div class="metric-inline"><span>Obszary</span><strong><?= $totalSections ?></strong></div></div>
|
||||||
|
<div class="col-sm-4"><div class="metric-inline"><span>Czas</span><strong><?= htmlspecialchars($definition['quiz']['estimated_time']) ?></strong></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<aside class="surface-card p-4 p-lg-5 h-100">
|
||||||
|
<div class="eyebrow mb-3">Co otrzymasz</div>
|
||||||
|
<div class="small fw-semibold text-success mb-2">Bezpłatna diagnoza online</div>
|
||||||
|
<h2 class="h4 mb-3">Rzetelne podsumowanie dojrzałości procesowej</h2>
|
||||||
|
<p class="text-secondary mb-4">Diagnoza została zaprojektowana jako profesjonalne narzędzie konsultacyjne — nie jako lekki quiz. Użytkownik otrzymuje natychmiastowy wynik na ekranie oraz rozszerzony raport na e-mail.</p>
|
||||||
|
<ul class="feature-list mb-4">
|
||||||
|
<li>Jedno pytanie na ekranie</li>
|
||||||
|
<li>Ocena w 7 sekcjach biznesowych</li>
|
||||||
|
<li>Wynik procentowy, segment dojrzałości i rekomendacje</li>
|
||||||
|
<li>Panel administratora do przeglądu prób i eksportu danych</li>
|
||||||
|
</ul>
|
||||||
|
<a class="btn btn-dark w-100" href="/diagnostic.php">Uruchom narzędzie</a>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="py-5 border-top" id="zakres">
|
||||||
|
<div class="container">
|
||||||
|
<div class="section-intro mb-4">
|
||||||
|
<div class="eyebrow">Zakres oceny</div>
|
||||||
|
<h2 class="section-title">Siedem obszarów, które najczęściej decydują o jakości działania firmy</h2>
|
||||||
|
</div>
|
||||||
|
<div class="row g-3">
|
||||||
|
<?php foreach ($definition['sections'] as $section): ?>
|
||||||
|
<div class="col-md-6 col-xl-4">
|
||||||
|
<article class="compact-card h-100">
|
||||||
|
<strong><?= htmlspecialchars($section['name']) ?></strong>
|
||||||
|
<span><?= count($section['questions']) ?> pytań pomagających ocenić poziom uporządkowania, powtarzalności i kontroli.</span>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="py-5" id="jak-to-dziala">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row g-4 align-items-start">
|
||||||
|
<div class="col-lg-7">
|
||||||
|
<div class="section-intro mb-4">
|
||||||
|
<div class="eyebrow">Jak to działa</div>
|
||||||
|
<h2 class="section-title">Prosty przebieg dla respondenta, uporządkowane dane dla administratora</h2>
|
||||||
|
</div>
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-sm-6"><div class="compact-card"><strong>1. E-mail przed startem</strong><span>Adres jest wymagany do wysłania raportu i zapisania próby w bazie.</span></div></div>
|
||||||
|
<div class="col-sm-6"><div class="compact-card"><strong>2. Wieloetapowa diagnoza</strong><span>Użytkownik przechodzi przez pytania krok po kroku z paskiem postępu.</span></div></div>
|
||||||
|
<div class="col-sm-6"><div class="compact-card"><strong>3. Wynik natychmiast</strong><span>Na ekranie od razu pojawia się segment dojrzałości i ocena sekcji.</span></div></div>
|
||||||
|
<div class="col-sm-6"><div class="compact-card"><strong>4. Raport e-mail</strong><span>Szczegółowe podsumowanie trafia na podany adres e-mail.</span></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<div class="surface-card p-4 p-lg-5">
|
||||||
|
<div class="eyebrow mb-3">Zastosowanie</div>
|
||||||
|
<h2 class="h4 mb-3">Dla kogo powstało to rozwiązanie</h2>
|
||||||
|
<p class="text-secondary mb-4">Narzędzie jest dopasowane do potrzeb małych i średnich firm, które chcą uporządkować operacje, ograniczyć chaos organizacyjny i przygotować się do dalszego skalowania.</p>
|
||||||
|
<ul class="feature-list mb-0">
|
||||||
|
<li>Właściciele firm</li>
|
||||||
|
<li>Zarządy i managing directorzy</li>
|
||||||
|
<li>Szefowie operacji i menedżerowie działów</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="py-5 border-top" id="wnioski">
|
||||||
|
<div class="container">
|
||||||
|
<div class="section-intro mb-4">
|
||||||
|
<div class="eyebrow">Praktyczne wnioski</div>
|
||||||
|
<h2 class="section-title">Jak interpretować wynik diagnozy</h2>
|
||||||
|
</div>
|
||||||
|
<div class="row g-4">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<article class="surface-card p-4 h-100">
|
||||||
|
<p class="small text-secondary mb-2">Widoczność operacyjna</p>
|
||||||
|
<h3 class="h5">Czy firma działa na podstawie danych, czy głównie intuicji i doraźnych działań?</h3>
|
||||||
|
<p class="text-secondary mb-0">Wynik pokaże, czy menedżerowie i właściciel mają realny wgląd w status zadań, opóźnienia, jakość i ryzyka.</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<article class="surface-card p-4 h-100">
|
||||||
|
<p class="small text-secondary mb-2">Powtarzalność</p>
|
||||||
|
<h3 class="h5">Na ile codzienna praca jest oparta na standardach, a nie na pamięci pojedynczych osób?</h3>
|
||||||
|
<p class="text-secondary mb-0">To kluczowy wskaźnik zdolności organizacji do utrzymania jakości i skalowania bez chaosu.</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<article class="surface-card p-4 h-100">
|
||||||
|
<p class="small text-secondary mb-2">Rola właściciela</p>
|
||||||
|
<h3 class="h5">Czy firma potrafi działać sprawnie bez ciągłej interwencji właściciela?</h3>
|
||||||
|
<p class="text-secondary mb-0">Im wyższy poziom dojrzałości, tym większa możliwość przesunięcia uwagi właściciela z bieżących problemów na rozwój.</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="border-top py-4 bg-white">
|
||||||
|
<div class="container d-flex flex-column flex-md-row justify-content-between gap-2">
|
||||||
|
<span class="text-secondary small">Diagnoza dojrzałości procesowej dla właścicieli firm i liderów operacyjnych.</span>
|
||||||
|
<div class="d-flex gap-3 small">
|
||||||
|
<a class="text-decoration-none text-secondary" href="/diagnostic.php">Diagnoza</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</footer>
|
||||||
<footer>
|
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<script>window.FL_SHOW_BUDGE=false;</script>
|
||||||
</footer>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" defer></script>
|
||||||
|
<script src="/assets/js/main.js?v=<?= urlencode((string)@filemtime(__DIR__ . '/assets/js/main.js')) ?>" defer></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -13,92 +13,25 @@ class MailService
|
|||||||
public static function sendMail($to, string $subject, string $htmlBody, ?string $textBody = null, array $opts = [])
|
public static function sendMail($to, string $subject, string $htmlBody, ?string $textBody = null, array $opts = [])
|
||||||
{
|
{
|
||||||
$cfg = self::loadConfig();
|
$cfg = self::loadConfig();
|
||||||
|
$transport = strtolower((string)($cfg['transport'] ?? 'smtp'));
|
||||||
|
|
||||||
$autoload = __DIR__ . '/../vendor/autoload.php';
|
if ($transport !== 'smtp') {
|
||||||
if (file_exists($autoload)) {
|
return [
|
||||||
require_once $autoload;
|
'success' => false,
|
||||||
}
|
'error' => 'MAIL_TRANSPORT must be set to smtp. Native mail() transport is disabled.',
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
];
|
||||||
@require_once 'libphp-phpmailer/autoload.php';
|
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
|
||||||
@require_once 'libphp-phpmailer/src/Exception.php';
|
|
||||||
@require_once 'libphp-phpmailer/src/SMTP.php';
|
|
||||||
@require_once 'libphp-phpmailer/src/PHPMailer.php';
|
|
||||||
}
|
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
|
||||||
@require_once 'PHPMailer/src/Exception.php';
|
|
||||||
@require_once 'PHPMailer/src/SMTP.php';
|
|
||||||
@require_once 'PHPMailer/src/PHPMailer.php';
|
|
||||||
}
|
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
|
||||||
@require_once 'PHPMailer/Exception.php';
|
|
||||||
@require_once 'PHPMailer/SMTP.php';
|
|
||||||
@require_once 'PHPMailer/PHPMailer.php';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
if (!self::ensurePHPMailerLoaded()) {
|
||||||
return [ 'success' => false, 'error' => 'PHPMailer not available' ];
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'SMTP transport requires PHPMailer. Install it via Composer or make the system PHPMailer package available in include_path.',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
|
return self::sendSmtpMail($cfg, $to, $subject, $htmlBody, $textBody, $opts);
|
||||||
try {
|
|
||||||
$mail->isSMTP();
|
|
||||||
$mail->Host = $cfg['smtp_host'] ?? '';
|
|
||||||
$mail->Port = (int)($cfg['smtp_port'] ?? 587);
|
|
||||||
$secure = $cfg['smtp_secure'] ?? 'tls';
|
|
||||||
if ($secure === 'ssl') $mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_SMTPS;
|
|
||||||
elseif ($secure === 'tls') $mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS;
|
|
||||||
else $mail->SMTPSecure = false;
|
|
||||||
$mail->SMTPAuth = true;
|
|
||||||
$mail->Username = $cfg['smtp_user'] ?? '';
|
|
||||||
$mail->Password = $cfg['smtp_pass'] ?? '';
|
|
||||||
|
|
||||||
$fromEmail = $opts['from_email'] ?? ($cfg['from_email'] ?? 'no-reply@localhost');
|
|
||||||
$fromName = $opts['from_name'] ?? ($cfg['from_name'] ?? 'App');
|
|
||||||
$mail->setFrom($fromEmail, $fromName);
|
|
||||||
if (!empty($opts['reply_to']) && filter_var($opts['reply_to'], FILTER_VALIDATE_EMAIL)) {
|
|
||||||
$mail->addReplyTo($opts['reply_to']);
|
|
||||||
} elseif (!empty($cfg['reply_to'])) {
|
|
||||||
$mail->addReplyTo($cfg['reply_to']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recipients
|
|
||||||
$toList = [];
|
|
||||||
if ($to) {
|
|
||||||
if (is_string($to)) $toList = array_map('trim', explode(',', $to));
|
|
||||||
elseif (is_array($to)) $toList = $to;
|
|
||||||
} elseif (!empty(getenv('MAIL_TO'))) {
|
|
||||||
$toList = array_map('trim', explode(',', getenv('MAIL_TO')));
|
|
||||||
}
|
|
||||||
$added = 0;
|
|
||||||
foreach ($toList as $addr) {
|
|
||||||
if (filter_var($addr, FILTER_VALIDATE_EMAIL)) { $mail->addAddress($addr); $added++; }
|
|
||||||
}
|
|
||||||
if ($added === 0) {
|
|
||||||
return [ 'success' => false, 'error' => 'No recipients defined (set MAIL_TO or pass $to)' ];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ((array)($opts['cc'] ?? []) as $cc) { if (filter_var($cc, FILTER_VALIDATE_EMAIL)) $mail->addCC($cc); }
|
|
||||||
foreach ((array)($opts['bcc'] ?? []) as $bcc){ if (filter_var($bcc, FILTER_VALIDATE_EMAIL)) $mail->addBCC($bcc); }
|
|
||||||
|
|
||||||
// Optional DKIM
|
|
||||||
if (!empty($cfg['dkim_domain']) && !empty($cfg['dkim_selector']) && !empty($cfg['dkim_private_key_path'])) {
|
|
||||||
$mail->DKIM_domain = $cfg['dkim_domain'];
|
|
||||||
$mail->DKIM_selector = $cfg['dkim_selector'];
|
|
||||||
$mail->DKIM_private = $cfg['dkim_private_key_path'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$mail->isHTML(true);
|
|
||||||
$mail->Subject = $subject;
|
|
||||||
$mail->Body = $htmlBody;
|
|
||||||
$mail->AltBody = $textBody ?? strip_tags($htmlBody);
|
|
||||||
$ok = $mail->send();
|
|
||||||
return [ 'success' => $ok ];
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
return [ 'success' => false, 'error' => 'PHPMailer error: ' . $e->getMessage() ];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function loadConfig(): array
|
private static function loadConfig(): array
|
||||||
{
|
{
|
||||||
$configPath = __DIR__ . '/config.php';
|
$configPath = __DIR__ . '/config.php';
|
||||||
@ -112,87 +45,165 @@ class MailService
|
|||||||
return $cfg;
|
return $cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a contact message
|
private static function ensurePHPMailerLoaded(): bool
|
||||||
// $to can be: a single email string, a comma-separated list, an array of emails, or null (fallback to MAIL_TO/MAIL_FROM)
|
|
||||||
public static function sendContactMessage(string $name, string $email, string $message, $to = null, string $subject = 'New contact form')
|
|
||||||
{
|
{
|
||||||
$cfg = self::loadConfig();
|
if (class_exists('PHPMailer\PHPMailer\PHPMailer', false)) {
|
||||||
|
return true;
|
||||||
// Try Composer autoload if available (for PHPMailer)
|
|
||||||
$autoload = __DIR__ . '/../vendor/autoload.php';
|
|
||||||
if (file_exists($autoload)) {
|
|
||||||
require_once $autoload;
|
|
||||||
}
|
}
|
||||||
// Fallback to system-wide PHPMailer (installed via apt: libphp-phpmailer)
|
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
$autoloadCandidates = [
|
||||||
// Debian/Ubuntu package layout (libphp-phpmailer)
|
__DIR__ . '/../vendor/autoload.php',
|
||||||
@require_once 'libphp-phpmailer/autoload.php';
|
'libphp-phpmailer/autoload.php',
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
'PHPMailer/PHPMailerAutoload.php',
|
||||||
@require_once 'libphp-phpmailer/src/Exception.php';
|
];
|
||||||
@require_once 'libphp-phpmailer/src/SMTP.php';
|
|
||||||
@require_once 'libphp-phpmailer/src/PHPMailer.php';
|
foreach ($autoloadCandidates as $candidate) {
|
||||||
}
|
$resolved = self::resolveIncludePath($candidate);
|
||||||
// Alternative layout (older PHPMailer package names)
|
if ($resolved) {
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
require_once $resolved;
|
||||||
@require_once 'PHPMailer/src/Exception.php';
|
if (class_exists('PHPMailer\PHPMailer\PHPMailer', false)) {
|
||||||
@require_once 'PHPMailer/src/SMTP.php';
|
return true;
|
||||||
@require_once 'PHPMailer/src/PHPMailer.php';
|
}
|
||||||
}
|
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
|
||||||
@require_once 'PHPMailer/Exception.php';
|
|
||||||
@require_once 'PHPMailer/SMTP.php';
|
|
||||||
@require_once 'PHPMailer/PHPMailer.php';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$transport = $cfg['transport'] ?? 'smtp';
|
$classFileSets = [
|
||||||
if ($transport === 'smtp' && class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
[
|
||||||
return self::sendViaPHPMailer($cfg, $name, $email, $message, $to, $subject);
|
__DIR__ . '/phpmailer/src/Exception.php',
|
||||||
|
__DIR__ . '/phpmailer/src/SMTP.php',
|
||||||
|
__DIR__ . '/phpmailer/src/PHPMailer.php',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'libphp-phpmailer/src/Exception.php',
|
||||||
|
'libphp-phpmailer/src/SMTP.php',
|
||||||
|
'libphp-phpmailer/src/PHPMailer.php',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'PHPMailer/src/Exception.php',
|
||||||
|
'PHPMailer/src/SMTP.php',
|
||||||
|
'PHPMailer/src/PHPMailer.php',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'PHPMailer/Exception.php',
|
||||||
|
'PHPMailer/SMTP.php',
|
||||||
|
'PHPMailer/PHPMailer.php',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($classFileSets as $files) {
|
||||||
|
$resolvedFiles = [];
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$resolved = self::resolveIncludePath($file);
|
||||||
|
if (!$resolved) {
|
||||||
|
$resolvedFiles = [];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$resolvedFiles[] = $resolved;
|
||||||
|
}
|
||||||
|
if (!$resolvedFiles) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($resolvedFiles as $resolvedFile) {
|
||||||
|
require_once $resolvedFile;
|
||||||
|
}
|
||||||
|
if (class_exists('PHPMailer\PHPMailer\PHPMailer', false)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: attempt native mail() — works only if MTA is configured on the VM
|
return class_exists('PHPMailer\PHPMailer\PHPMailer', false);
|
||||||
return self::sendViaNativeMail($cfg, $name, $email, $message, $to, $subject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function sendViaPHPMailer(array $cfg, string $name, string $email, string $body, $to, string $subject)
|
private static function resolveIncludePath(string $path): ?string
|
||||||
{
|
{
|
||||||
|
if (is_file($path)) {
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
$resolved = stream_resolve_include_path($path);
|
||||||
|
if ($resolved && is_file($resolved)) {
|
||||||
|
return $resolved;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function validateSmtpConfig(array $cfg): ?string
|
||||||
|
{
|
||||||
|
$required = [
|
||||||
|
'smtp_host' => 'SMTP_HOST',
|
||||||
|
'smtp_port' => 'SMTP_PORT',
|
||||||
|
'smtp_user' => 'SMTP_USER',
|
||||||
|
'smtp_pass' => 'SMTP_PASS',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($required as $key => $envName) {
|
||||||
|
$value = $cfg[$key] ?? null;
|
||||||
|
if ($value === null || $value === '') {
|
||||||
|
return sprintf('Missing SMTP configuration: %s', $envName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function buildRecipientList($to): array
|
||||||
|
{
|
||||||
|
if ($to) {
|
||||||
|
if (is_string($to)) {
|
||||||
|
return array_map('trim', explode(',', $to));
|
||||||
|
}
|
||||||
|
if (is_array($to)) {
|
||||||
|
return $to;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$defaultTo = getenv('MAIL_TO');
|
||||||
|
if (!empty($defaultTo)) {
|
||||||
|
return array_map('trim', explode(',', $defaultTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function sendSmtpMail(array $cfg, $to, string $subject, string $htmlBody, ?string $textBody, array $opts): array
|
||||||
|
{
|
||||||
|
$configError = self::validateSmtpConfig($cfg);
|
||||||
|
if ($configError !== null) {
|
||||||
|
return [ 'success' => false, 'error' => $configError ];
|
||||||
|
}
|
||||||
|
|
||||||
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
|
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$mail->CharSet = 'UTF-8';
|
||||||
|
$mail->Encoding = PHPMailer\PHPMailer\PHPMailer::ENCODING_BASE64;
|
||||||
$mail->isSMTP();
|
$mail->isSMTP();
|
||||||
$mail->Host = $cfg['smtp_host'] ?? '';
|
$mail->Host = $cfg['smtp_host'] ?? '';
|
||||||
$mail->Port = (int)($cfg['smtp_port'] ?? 587);
|
$mail->Port = (int)($cfg['smtp_port'] ?? 587);
|
||||||
$secure = $cfg['smtp_secure'] ?? 'tls';
|
$secure = strtolower((string)($cfg['smtp_secure'] ?? 'tls'));
|
||||||
if ($secure === 'ssl') $mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_SMTPS;
|
if ($secure === 'ssl') {
|
||||||
elseif ($secure === 'tls') $mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS;
|
$mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_SMTPS;
|
||||||
else $mail->SMTPSecure = false;
|
} elseif ($secure === 'tls') {
|
||||||
|
$mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS;
|
||||||
|
} else {
|
||||||
|
$mail->SMTPSecure = false;
|
||||||
|
}
|
||||||
$mail->SMTPAuth = true;
|
$mail->SMTPAuth = true;
|
||||||
$mail->Username = $cfg['smtp_user'] ?? '';
|
$mail->Username = $cfg['smtp_user'] ?? '';
|
||||||
$mail->Password = $cfg['smtp_pass'] ?? '';
|
$mail->Password = $cfg['smtp_pass'] ?? '';
|
||||||
|
|
||||||
$fromEmail = $cfg['from_email'] ?? 'no-reply@localhost';
|
$fromEmail = $opts['from_email'] ?? ($cfg['from_email'] ?? 'no-reply@localhost');
|
||||||
$fromName = $cfg['from_name'] ?? 'App';
|
$fromName = $opts['from_name'] ?? ($cfg['from_name'] ?? 'App');
|
||||||
$mail->setFrom($fromEmail, $fromName);
|
$mail->setFrom($fromEmail, $fromName);
|
||||||
|
|
||||||
// Use Reply-To for the user's email to avoid spoofing From
|
if (!empty($opts['reply_to']) && filter_var($opts['reply_to'], FILTER_VALIDATE_EMAIL)) {
|
||||||
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
$mail->addReplyTo($opts['reply_to']);
|
||||||
$mail->addReplyTo($email, $name ?: $email);
|
} elseif (!empty($cfg['reply_to']) && filter_var($cfg['reply_to'], FILTER_VALIDATE_EMAIL)) {
|
||||||
}
|
|
||||||
if (!empty($cfg['reply_to'])) {
|
|
||||||
$mail->addReplyTo($cfg['reply_to']);
|
$mail->addReplyTo($cfg['reply_to']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destination: prefer dynamic recipients ($to), fallback to MAIL_TO; no silent FROM fallback
|
$toList = self::buildRecipientList($to);
|
||||||
$toList = [];
|
|
||||||
if ($to) {
|
|
||||||
if (is_string($to)) {
|
|
||||||
// allow comma-separated list
|
|
||||||
$toList = array_map('trim', explode(',', $to));
|
|
||||||
} elseif (is_array($to)) {
|
|
||||||
$toList = $to;
|
|
||||||
}
|
|
||||||
} elseif (!empty(getenv('MAIL_TO'))) {
|
|
||||||
$toList = array_map('trim', explode(',', getenv('MAIL_TO')));
|
|
||||||
}
|
|
||||||
$added = 0;
|
$added = 0;
|
||||||
foreach ($toList as $addr) {
|
foreach ($toList as $addr) {
|
||||||
if (filter_var($addr, FILTER_VALIDATE_EMAIL)) {
|
if (filter_var($addr, FILTER_VALIDATE_EMAIL)) {
|
||||||
@ -204,7 +215,17 @@ class MailService
|
|||||||
return [ 'success' => false, 'error' => 'No recipients defined (set MAIL_TO or pass $to)' ];
|
return [ 'success' => false, 'error' => 'No recipients defined (set MAIL_TO or pass $to)' ];
|
||||||
}
|
}
|
||||||
|
|
||||||
// DKIM (optional)
|
foreach ((array)($opts['cc'] ?? []) as $cc) {
|
||||||
|
if (filter_var($cc, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$mail->addCC($cc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ((array)($opts['bcc'] ?? []) as $bcc) {
|
||||||
|
if (filter_var($bcc, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$mail->addBCC($bcc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($cfg['dkim_domain']) && !empty($cfg['dkim_selector']) && !empty($cfg['dkim_private_key_path'])) {
|
if (!empty($cfg['dkim_domain']) && !empty($cfg['dkim_selector']) && !empty($cfg['dkim_private_key_path'])) {
|
||||||
$mail->DKIM_domain = $cfg['dkim_domain'];
|
$mail->DKIM_domain = $cfg['dkim_domain'];
|
||||||
$mail->DKIM_selector = $cfg['dkim_selector'];
|
$mail->DKIM_selector = $cfg['dkim_selector'];
|
||||||
@ -213,23 +234,117 @@ class MailService
|
|||||||
|
|
||||||
$mail->isHTML(true);
|
$mail->isHTML(true);
|
||||||
$mail->Subject = $subject;
|
$mail->Subject = $subject;
|
||||||
$safeName = htmlspecialchars($name, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
$mail->Body = $htmlBody;
|
||||||
$safeEmail = htmlspecialchars($email, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
$mail->AltBody = $textBody ?? trim(strip_tags($htmlBody));
|
||||||
$safeBody = nl2br(htmlspecialchars($body, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'));
|
|
||||||
$mail->Body = "<p><strong>Name:</strong> {$safeName}</p><p><strong>Email:</strong> {$safeEmail}</p><hr>{$safeBody}";
|
|
||||||
$mail->AltBody = "Name: {$name}\nEmail: {$email}\n\n{$body}";
|
|
||||||
|
|
||||||
$ok = $mail->send();
|
return [ 'success' => $mail->send() ];
|
||||||
return [ 'success' => $ok ];
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return [ 'success' => false, 'error' => 'PHPMailer error: ' . $e->getMessage() ];
|
return [ 'success' => false, 'error' => 'PHPMailer error: ' . $e->getMessage() ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function sendViaNativeMail(array $cfg, string $name, string $email, string $body, $to, string $subject)
|
private static function sendNativeMail(array $cfg, $to, string $subject, string $htmlBody, ?string $textBody, array $opts): array
|
||||||
{
|
{
|
||||||
$opts = ['reply_to' => $email];
|
$toList = self::buildRecipientList($to);
|
||||||
$html = nl2br(htmlspecialchars($body, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'));
|
$validTo = [];
|
||||||
return self::sendMail($to, $subject, $html, $body, $opts);
|
foreach ($toList as $addr) {
|
||||||
|
if (filter_var($addr, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$validTo[] = $addr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (empty($validTo)) {
|
||||||
|
return [ 'success' => false, 'error' => 'No recipients defined (set MAIL_TO or pass $to)' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
$fromEmail = $opts['from_email'] ?? ($cfg['from_email'] ?? 'no-reply@localhost');
|
||||||
|
$fromName = $opts['from_name'] ?? ($cfg['from_name'] ?? 'App');
|
||||||
|
$replyTo = $opts['reply_to'] ?? ($cfg['reply_to'] ?? null);
|
||||||
|
$textBody = $textBody ?? trim(strip_tags($htmlBody));
|
||||||
|
|
||||||
|
$boundary = 'flmail_' . md5((string)microtime(true) . $subject);
|
||||||
|
$encodedSubject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
|
||||||
|
$safeFromName = mb_encode_mimeheader($fromName, 'UTF-8');
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
'MIME-Version: 1.0',
|
||||||
|
'From: ' . $safeFromName . ' <' . $fromEmail . '>',
|
||||||
|
'Content-Type: multipart/alternative; boundary="' . $boundary . '"',
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($replyTo && filter_var($replyTo, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$headers[] = 'Reply-To: ' . $replyTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ccList = [];
|
||||||
|
foreach ((array)($opts['cc'] ?? []) as $cc) {
|
||||||
|
if (filter_var($cc, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$ccList[] = $cc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($ccList) {
|
||||||
|
$headers[] = 'Cc: ' . implode(', ', $ccList);
|
||||||
|
}
|
||||||
|
|
||||||
|
$bccList = [];
|
||||||
|
foreach ((array)($opts['bcc'] ?? []) as $bcc) {
|
||||||
|
if (filter_var($bcc, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$bccList[] = $bcc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($bccList) {
|
||||||
|
$headers[] = 'Bcc: ' . implode(', ', $bccList);
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = "--{$boundary}
|
||||||
|
"
|
||||||
|
. "Content-Type: text/plain; charset=UTF-8
|
||||||
|
"
|
||||||
|
. "Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
"
|
||||||
|
. $textBody . "
|
||||||
|
|
||||||
|
"
|
||||||
|
. "--{$boundary}
|
||||||
|
"
|
||||||
|
. "Content-Type: text/html; charset=UTF-8
|
||||||
|
"
|
||||||
|
. "Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
"
|
||||||
|
. $htmlBody . "
|
||||||
|
|
||||||
|
"
|
||||||
|
. "--{$boundary}--
|
||||||
|
";
|
||||||
|
|
||||||
|
$ok = @mail(implode(', ', $validTo), $encodedSubject, $message, implode("
|
||||||
|
", $headers));
|
||||||
|
if (!$ok) {
|
||||||
|
return [ 'success' => false, 'error' => 'Native mail() failed' ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [ 'success' => true ];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send a contact message
|
||||||
|
// $to can be: a single email string, a comma-separated list, an array of emails, or null (fallback to MAIL_TO/MAIL_FROM)
|
||||||
|
public static function sendContactMessage(string $name, string $email, string $message, $to = null, string $subject = 'New contact form')
|
||||||
|
{
|
||||||
|
$safeName = htmlspecialchars($name, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
||||||
|
$safeEmail = htmlspecialchars($email, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
||||||
|
$safeBody = nl2br(htmlspecialchars($message, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'));
|
||||||
|
|
||||||
|
$html = "<p><strong>Name:</strong> {$safeName}</p><p><strong>Email:</strong> {$safeEmail}</p><hr>{$safeBody}";
|
||||||
|
$text = "Name: {$name}
|
||||||
|
Email: {$email}
|
||||||
|
|
||||||
|
{$message}";
|
||||||
|
$opts = [];
|
||||||
|
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$opts['reply_to'] = $email;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::sendMail($to, $subject, $html, $text, $opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
502
mail/phpmailer/LICENSE
Normal file
502
mail/phpmailer/LICENSE
Normal file
@ -0,0 +1,502 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 2.1, February 1999
|
||||||
|
|
||||||
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
[This is the first released version of the Lesser GPL. It also counts
|
||||||
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
|
the version number 2.1.]
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Lesser General Public License, applies to some
|
||||||
|
specially designated software packages--typically libraries--of the
|
||||||
|
Free Software Foundation and other authors who decide to use it. You
|
||||||
|
can use it too, but we suggest you first think carefully about whether
|
||||||
|
this license or the ordinary General Public License is the better
|
||||||
|
strategy to use in any particular case, based on the explanations below.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom of use,
|
||||||
|
not price. Our General Public Licenses are designed to make sure that
|
||||||
|
you have the freedom to distribute copies of free software (and charge
|
||||||
|
for this service if you wish); that you receive source code or can get
|
||||||
|
it if you want it; that you can change the software and use pieces of
|
||||||
|
it in new free programs; and that you are informed that you can do
|
||||||
|
these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
distributors to deny you these rights or to ask you to surrender these
|
||||||
|
rights. These restrictions translate to certain responsibilities for
|
||||||
|
you if you distribute copies of the library or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link other code with the library, you must provide
|
||||||
|
complete object files to the recipients, so that they can relink them
|
||||||
|
with the library after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
We protect your rights with a two-step method: (1) we copyright the
|
||||||
|
library, and (2) we offer you this license, which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
To protect each distributor, we want to make it very clear that
|
||||||
|
there is no warranty for the free library. Also, if the library is
|
||||||
|
modified by someone else and passed on, the recipients should know
|
||||||
|
that what they have is not the original version, so that the original
|
||||||
|
author's reputation will not be affected by problems that might be
|
||||||
|
introduced by others.
|
||||||
|
|
||||||
|
Finally, software patents pose a constant threat to the existence of
|
||||||
|
any free program. We wish to make sure that a company cannot
|
||||||
|
effectively restrict the users of a free program by obtaining a
|
||||||
|
restrictive license from a patent holder. Therefore, we insist that
|
||||||
|
any patent license obtained for a version of the library must be
|
||||||
|
consistent with the full freedom of use specified in this license.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the
|
||||||
|
ordinary GNU General Public License. This license, the GNU Lesser
|
||||||
|
General Public License, applies to certain designated libraries, and
|
||||||
|
is quite different from the ordinary General Public License. We use
|
||||||
|
this license for certain libraries in order to permit linking those
|
||||||
|
libraries into non-free programs.
|
||||||
|
|
||||||
|
When a program is linked with a library, whether statically or using
|
||||||
|
a shared library, the combination of the two is legally speaking a
|
||||||
|
combined work, a derivative of the original library. The ordinary
|
||||||
|
General Public License therefore permits such linking only if the
|
||||||
|
entire combination fits its criteria of freedom. The Lesser General
|
||||||
|
Public License permits more lax criteria for linking other code with
|
||||||
|
the library.
|
||||||
|
|
||||||
|
We call this license the "Lesser" General Public License because it
|
||||||
|
does Less to protect the user's freedom than the ordinary General
|
||||||
|
Public License. It also provides other free software developers Less
|
||||||
|
of an advantage over competing non-free programs. These disadvantages
|
||||||
|
are the reason we use the ordinary General Public License for many
|
||||||
|
libraries. However, the Lesser license provides advantages in certain
|
||||||
|
special circumstances.
|
||||||
|
|
||||||
|
For example, on rare occasions, there may be a special need to
|
||||||
|
encourage the widest possible use of a certain library, so that it becomes
|
||||||
|
a de-facto standard. To achieve this, non-free programs must be
|
||||||
|
allowed to use the library. A more frequent case is that a free
|
||||||
|
library does the same job as widely used non-free libraries. In this
|
||||||
|
case, there is little to gain by limiting the free library to free
|
||||||
|
software only, so we use the Lesser General Public License.
|
||||||
|
|
||||||
|
In other cases, permission to use a particular library in non-free
|
||||||
|
programs enables a greater number of people to use a large body of
|
||||||
|
free software. For example, permission to use the GNU C Library in
|
||||||
|
non-free programs enables many more people to use the whole GNU
|
||||||
|
operating system, as well as its variant, the GNU/Linux operating
|
||||||
|
system.
|
||||||
|
|
||||||
|
Although the Lesser General Public License is Less protective of the
|
||||||
|
users' freedom, it does ensure that the user of a program that is
|
||||||
|
linked with the Library has the freedom and the wherewithal to run
|
||||||
|
that program using a modified version of the Library.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, whereas the latter must
|
||||||
|
be combined with the library in order to run.
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library or other
|
||||||
|
program which contains a notice placed by the copyright holder or
|
||||||
|
other authorized party saying it may be distributed under the terms of
|
||||||
|
this Lesser General Public License (also called "this License").
|
||||||
|
Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, complete source code means
|
||||||
|
all the source code for all modules it contains, plus any associated
|
||||||
|
interface definition files, plus the scripts used to control compilation
|
||||||
|
and installation of the library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete source code as you receive it, in any medium, provided that
|
||||||
|
you conspicuously and appropriately publish on each copy an
|
||||||
|
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||||
|
all the notices that refer to this License and to the absence of any
|
||||||
|
warranty; and distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
|
and you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Library, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you accompany
|
||||||
|
it with the complete corresponding machine-readable source code, which
|
||||||
|
must be distributed under the terms of Sections 1 and 2 above on a
|
||||||
|
medium customarily used for software interchange.
|
||||||
|
|
||||||
|
If distribution of object code is made by offering access to copy
|
||||||
|
from a designated place, then offering equivalent access to copy the
|
||||||
|
source code from the same place satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also combine or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (1) uses at run time a
|
||||||
|
copy of the library already present on the user's computer system,
|
||||||
|
rather than copying library functions into the executable, and (2)
|
||||||
|
will operate properly with a modified version of the library, if
|
||||||
|
the user installs one, as long as the modified version is
|
||||||
|
interface-compatible with the version that the work was made with.
|
||||||
|
|
||||||
|
c) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
d) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
e) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the materials to be distributed need not include anything that is
|
||||||
|
normally distributed (in either source or binary form) with the major
|
||||||
|
components (compiler, kernel, and so on) of the operating system on
|
||||||
|
which the executable runs, unless that component itself accompanies
|
||||||
|
the executable.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library is void, and will automatically terminate your
|
||||||
|
rights under this License. However, parties who have received copies,
|
||||||
|
or rights, from you under this License will not have their licenses
|
||||||
|
terminated so long as such parties remain in full compliance.
|
||||||
|
|
||||||
|
9. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
subject to these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties with
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Library.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under any
|
||||||
|
particular circumstance, the balance of the section is intended to apply,
|
||||||
|
and the section as a whole is intended to apply in other circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library under this License may add
|
||||||
|
an explicit geographical distribution limitation excluding those countries,
|
||||||
|
so that distribution is permitted only in or among countries not thus
|
||||||
|
excluded. In such case, this License incorporates the limitation as if
|
||||||
|
written in the body of this License.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Lesser General Public License from time to time.
|
||||||
|
Such new versions will be similar in spirit to the present version,
|
||||||
|
but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Library
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
write to the author to ask for permission. For software which is
|
||||||
|
copyrighted by the Free Software Foundation, write to the Free
|
||||||
|
Software Foundation; we sometimes make exceptions for this. Our
|
||||||
|
decision will be guided by the two goals of preserving the free status
|
||||||
|
of all derivatives of our free software and of promoting the sharing
|
||||||
|
and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||||
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||||
|
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||||
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||||
|
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
possible use to the public, we recommend making it free software that
|
||||||
|
everyone can redistribute and change. You can do so by permitting
|
||||||
|
redistribution under these terms (or, alternatively, under the terms of the
|
||||||
|
ordinary General Public License).
|
||||||
|
|
||||||
|
To apply these terms, attach the following notices to the library. It is
|
||||||
|
safest to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the library's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||||
|
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1990
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
That's all there is to it!
|
||||||
2
mail/phpmailer/README.local.txt
Normal file
2
mail/phpmailer/README.local.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Bundled runtime subset of PHPMailer v7.0.2 for SMTP delivery.
|
||||||
|
Files sourced from the official PHPMailer repository.
|
||||||
40
mail/phpmailer/src/Exception.php
Normal file
40
mail/phpmailer/src/Exception.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPMailer Exception class.
|
||||||
|
* PHP Version 5.5.
|
||||||
|
*
|
||||||
|
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||||
|
*
|
||||||
|
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||||
|
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||||
|
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||||
|
* @author Brent R. Matzelle (original founder)
|
||||||
|
* @copyright 2012 - 2020 Marcus Bointon
|
||||||
|
* @copyright 2010 - 2012 Jim Jagielski
|
||||||
|
* @copyright 2004 - 2009 Andy Prevost
|
||||||
|
* @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License
|
||||||
|
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PHPMailer\PHPMailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPMailer exception handler.
|
||||||
|
*
|
||||||
|
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
|
||||||
|
*/
|
||||||
|
class Exception extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Prettify error message output.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function errorMessage()
|
||||||
|
{
|
||||||
|
return '<strong>' . htmlspecialchars($this->getMessage(), ENT_COMPAT | ENT_HTML401) . "</strong><br />\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
5525
mail/phpmailer/src/PHPMailer.php
Normal file
5525
mail/phpmailer/src/PHPMailer.php
Normal file
File diff suppressed because it is too large
Load Diff
1617
mail/phpmailer/src/SMTP.php
Normal file
1617
mail/phpmailer/src/SMTP.php
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user