Upload via GUI (267 Dateien)
This commit is contained in:
@@ -174,6 +174,33 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
else { set_setting('logo_path', '/assets/branding/logo.'.$ext.'?v='.time()); audit_log($staff['id'],'Logo aktualisiert'); flash('success','Logo aktualisiert.'); redirect('/staff/settings.php?tab=design'); }
|
||||
}
|
||||
}
|
||||
if ($action === 'upload_favicon') {
|
||||
$file = $_FILES['favicon'] ?? [];
|
||||
$ext = strtolower(pathinfo($file['name'] ?? '', PATHINFO_EXTENSION));
|
||||
$err = null;
|
||||
if (empty($file['name'])) $err = 'Bitte eine Datei auswählen.';
|
||||
elseif (($file['error'] ?? UPLOAD_ERR_NO_FILE) !== UPLOAD_ERR_OK) $err = 'Upload fehlgeschlagen' . (($file['error'] ?? 0) === UPLOAD_ERR_INI_SIZE ? ' (die Datei ist größer als das Upload-Limit des Servers).' : '.');
|
||||
elseif ($file['size'] > 1024 * 1024) $err = 'Das Favicon darf höchstens 1 MB groß sein.';
|
||||
elseif (!isset(favicon_types()[$ext])) $err = 'Erlaubt: ICO, PNG, JPG, GIF, WebP, SVG.';
|
||||
else $err = favicon_validate_file($file['tmp_name'], $ext);
|
||||
if ($err !== null) { $errors[] = $err; }
|
||||
else {
|
||||
foreach (array_keys(favicon_types()) as $e2) @unlink($branding . '/favicon.' . $e2);
|
||||
if (!move_uploaded_file($file['tmp_name'], $branding . '/favicon.' . $ext)) { $errors[] = 'Speichern fehlgeschlagen (Ordner assets/branding/ nicht beschreibbar?).'; }
|
||||
else { set_setting('favicon_path', '/assets/branding/favicon.' . $ext . '?v=' . time()); audit_log($staff['id'], 'Favicon aktualisiert'); flash('success', 'Favicon aktualisiert. Browser zeigen Änderungen oft erst nach Neuladen (Strg+F5) oder in einem neuen Tab.'); redirect('/staff/settings.php?tab=design'); }
|
||||
}
|
||||
}
|
||||
if ($action === 'remove_favicon') {
|
||||
foreach (array_keys(favicon_types()) as $e2) @unlink($branding . '/favicon.' . $e2);
|
||||
set_setting('favicon_path', null); audit_log($staff['id'], 'Favicon entfernt'); flash('success', 'Favicon entfernt.'); redirect('/staff/settings.php?tab=design');
|
||||
}
|
||||
if ($action === 'save_logo_options') {
|
||||
$hide = !empty($_POST['logo_hide_name']) ? '1' : '0';
|
||||
set_setting('logo_hide_name', $hide);
|
||||
audit_log($staff['id'], $hide === '1' ? 'Name neben dem Logo ausgeblendet' : 'Name neben dem Logo wird angezeigt');
|
||||
flash('success', $hide === '1' ? 'Der Name wird neben dem Logo nicht mehr angezeigt.' : 'Der Name wird wieder neben dem Logo angezeigt.');
|
||||
redirect('/staff/settings.php?tab=design');
|
||||
}
|
||||
if ($action === 'remove_logo') {
|
||||
foreach (['png','jpg','jpeg','gif','svg'] as $e2) @unlink($branding.'/logo.'.$e2);
|
||||
set_setting('logo_path', null); audit_log($staff['id'],'Logo entfernt'); flash('success','Logo entfernt.'); redirect('/staff/settings.php?tab=design');
|
||||
@@ -556,7 +583,7 @@ require __DIR__ . '/_header.php';
|
||||
|
||||
<div class="card">
|
||||
<h3>Firmenlogo</h3>
|
||||
<p class="muted" style="font-size:.85rem;margin-bottom:16px">PNG/SVG empfohlen, max. 2 MB. Wird überall statt „DeskHub" angezeigt.</p>
|
||||
<p class="muted" style="font-size:.85rem;margin-bottom:16px">PNG/SVG empfohlen, max. 2 MB. Wird überall statt „DeskHub" angezeigt. Der Name der Installation steht standardmäßig daneben und lässt sich unten ausblenden.</p>
|
||||
<?php if ($currentLogo): ?>
|
||||
<div style="background:#16202a;padding:14px;border-radius:8px;margin-bottom:14px;display:inline-block">
|
||||
<img src="<?= e($currentLogo) ?>" alt="Logo" style="max-height:48px;max-width:220px">
|
||||
@@ -565,6 +592,14 @@ require __DIR__ . '/_header.php';
|
||||
<?= csrf_field() ?><input type="hidden" name="action" value="remove_logo">
|
||||
<button type="submit" class="btn secondary">Entfernen</button>
|
||||
</form>
|
||||
<form method="post" style="margin-top:14px">
|
||||
<?= csrf_field() ?><input type="hidden" name="action" value="save_logo_options">
|
||||
<label style="display:flex;align-items:center;gap:8px;font-weight:400;cursor:pointer">
|
||||
<input type="checkbox" name="logo_hide_name" value="1" style="width:auto" <?= get_setting('logo_hide_name', '0') === '1' ? 'checked' : '' ?>>
|
||||
Name „<?= e(get_setting('display_name', 'DeskHub')) ?>“ neben dem Logo ausblenden
|
||||
</label>
|
||||
<div class="btn-row"><button type="submit" class="btn secondary">Speichern</button></div>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<p class="muted">Kein Logo hinterlegt.</p>
|
||||
<?php endif; ?>
|
||||
@@ -575,6 +610,30 @@ require __DIR__ . '/_header.php';
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>Favicon (Symbol im Browser-Tab)</h3>
|
||||
<p class="muted" style="font-size:.85rem;margin-bottom:16px">ICO, PNG, JPG, GIF, WebP oder SVG, höchstens 1 MB, am besten quadratisch (z. B. 256×256). Ohne Favicon verwendet DeskHub das Logo.</p>
|
||||
<?php $currentFavicon = get_setting('favicon_path'); ?>
|
||||
<?php if ($currentFavicon): ?>
|
||||
<div style="display:flex;align-items:center;gap:14px;margin-bottom:14px">
|
||||
<span style="background:repeating-conic-gradient(#e5e7eb 0% 25%, #fff 0% 50%) 50% / 12px 12px;border:1px solid var(--border);border-radius:8px;padding:8px;display:inline-flex">
|
||||
<img src="<?= e($currentFavicon) ?>" alt="Favicon" style="width:32px;height:32px;object-fit:contain">
|
||||
</span>
|
||||
<form method="post" style="display:inline" onsubmit="return confirm('Favicon entfernen?')">
|
||||
<?= csrf_field() ?><input type="hidden" name="action" value="remove_favicon">
|
||||
<button type="submit" class="btn secondary">Entfernen</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<p class="muted">Kein eigenes Favicon hinterlegt.</p>
|
||||
<?php endif; ?>
|
||||
<form method="post" enctype="multipart/form-data" style="margin-top:16px">
|
||||
<?= csrf_field() ?><input type="hidden" name="action" value="upload_favicon">
|
||||
<input type="file" name="favicon" accept=".ico,.png,.jpg,.jpeg,.gif,.webp,.svg">
|
||||
<div class="btn-row"><button type="submit" class="btn">Hochladen</button></div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>Titelbild (Hero-Banner)</h3>
|
||||
<p class="muted" style="font-size:.85rem;margin-bottom:16px">Hintergrundbild im dunklen Hero-Bereich. Mind. 1600×500 px, max. 5 MB.</p>
|
||||
|
||||
Reference in New Issue
Block a user