45 lines
3.3 KiB
PHP
45 lines
3.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Prüft, dass die Anmeldeseite der Mitarbeiter themefähig ist: Kopf-, Fußzeile und Hintergrund kommen aus dem Stylesheet (Klassen und
|
|
* --staff-login-*-Variablen) statt aus fest eingebauten Farben, das bisherige Aussehen bleibt der Standard, und Kendo-Center nutzt es.
|
|
*/
|
|
|
|
$root = dirname(__DIR__);
|
|
$failures = [];
|
|
$check = function (bool $ok, string $what) use (&$failures): void {
|
|
if (!$ok) $failures[] = $what;
|
|
};
|
|
$php = (string) file_get_contents($root . '/staff/login.php');
|
|
$css = (string) file_get_contents($root . '/assets/css/style.css');
|
|
|
|
$check(str_contains($php, '<header class="staff-login-header">') && str_contains($php, '<footer class="staff-login-footer">') && str_contains($php, 'staff-login-title') && str_contains($php, 'staff-login-back'), 'Kopfzeile, Fußzeile, Titel und Link nutzen Klassen');
|
|
$check(!preg_match('/<(header|footer|body)[^>]*style="[^"]*(background:\s*(rgba|#)|color:)/', $php), 'keine fest eingebauten Farben mehr in Kopfzeile, Fußzeile und Body');
|
|
$check(preg_match('/<body class="login-page staff-login-page"(<\?php if \(\$banner\): \?> style="background-image:[^"]*"<\?php endif; \?>)?>/', $php) === 1, 'am Body bleibt nur das (veränderliche) Bannerbild als Inline-Stil');
|
|
$check(str_contains($css, '.staff-login-header') && str_contains($css, 'var(--staff-login-chrome, rgba(14,26,34,.95))') && str_contains($css, 'var(--staff-login-bg, #16202a)'), 'Stylesheet: Standardwerte entsprechen dem bisherigen Aussehen (Kopfzeile rgba(14,26,34,.95), Hintergrund #16202a)');
|
|
foreach (['--staff-login-chrome', '--staff-login-line', '--staff-login-chrome-ink', '--staff-login-chrome-muted', '--staff-login-chrome-faint', '--staff-login-bg'] as $v) {
|
|
$check(str_contains($css, 'var(' . $v), "Stylesheet nutzt die Variable {$v}");
|
|
}
|
|
// Das Staff-Layout der übrigen Seiten ist nicht betroffen
|
|
$check(!str_contains((string) file_get_contents($root . '/staff/_header.php'), 'staff-login'), 'der Mitarbeiter-Bereich nach der Anmeldung bleibt unverändert');
|
|
|
|
// Theme „Kendo-Center“ (liegt im Projektordner neben DeskHub-Webseite)
|
|
$zip = dirname($root) . '/theme/Kendo-Center.zip';
|
|
if (is_file($zip) && class_exists('ZipArchive')) {
|
|
$z = new ZipArchive();
|
|
$z->open($zip);
|
|
$theme = (string) $z->getFromName('theme.css');
|
|
$z->close();
|
|
$check(preg_match('/body\.staff-login-page\s*\{[^}]*--staff-login-chrome:\s*#0c2130[^}]*--staff-login-bg:|body\.staff-login-page\s*\{[^}]*--staff-login-bg:[^}]*--staff-login-chrome:\s*#0c2130/s', $theme) === 1, 'Kendo-Center: Kopf- und Fußzeile in der Farbe der Kopfzeile des Kundenportals (#0c2130)');
|
|
$check(str_contains($theme, '--staff-login-line: 3px solid var(--primary)') && str_contains($theme, '--staff-login-bg: #f0f5f5'), 'Kendo-Center: türkise Linie und Hintergrund passend zum Anmeldebereich');
|
|
$check(preg_match('/Version:\s*1\.0\.[2-9]/', $theme) === 1, 'Kendo-Center: Versionsnummer wurde erhöht (damit das Update erkannt wird)');
|
|
$check(substr_count($theme, '{') === substr_count($theme, '}'), 'Kendo-Center: Klammern im Stylesheet stimmen');
|
|
$check(!str_contains($theme, '8px 8px 0 rgba(22,43,58,.14)'), 'Kendo-Center: weicher Schatten an der Anmeldekarte');
|
|
}
|
|
if ($failures) {
|
|
fwrite(STDERR, "Fehlgeschlagen:\n - " . implode("\n - ", $failures) . "\n");
|
|
exit(1);
|
|
}
|
|
echo 'Staff login theme checks passed.' . "\n";
|