Upload via GUI (290 Dateien)

This commit is contained in:
2026-10-23 17:22:21 +00:00
parent 14b74ef747
commit 80be774c3e
4 changed files with 125 additions and 2 deletions
+92
View File
@@ -1,5 +1,6 @@
<?php
require_once __DIR__ . '/../includes/bootstrap.php';
require_once __DIR__ . '/../includes/ticket_extras.php'; // falls bootstrap.php noch die alte Version ist
require_once __DIR__ . '/../includes/imap_spam.php';
$staff = require_staff_login();
$pdo = get_db();
@@ -128,6 +129,21 @@ $allTags = $pdo->query('SELECT name FROM tags ORDER BY name')->fetchAll(PDO::FET
$errors = [];
$snoozedUntil = null;
$followers = [];
$isFollowing = false;
$similar = ['articles' => [], 'tickets' => []];
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
try {
$snoozedUntil = !empty($ticket['snoozed_until']) && $ticket['snoozed_until'] > db_now() ? $ticket['snoozed_until'] : null;
$followers = ticket_followers($pdo, (int) $ticket['id']);
foreach ($followers as $f) if ((int) $f['id'] === (int) $staff['id']) $isFollowing = true;
$similar = ticket_similar($pdo, $ticket, staff_department_ids($staff));
} catch (Throwable $e) {
// Datenbank noch nicht aktualisiert: Zusatzfunktionen bleiben leer
}
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Kunden sperren (eigener Block ohne globale verify_csrf)
if (($_POST['action'] ?? '') === 'ban_user') {
@@ -272,6 +288,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
require_once __DIR__ . '/../includes/push.php';
push_new_reply($ticket, $staff['name']);
}
ticket_followers_notify($ticket, 'Antwort von ' . $staff['name'], (int) $staff['id']);
} else {
save_mentions($pdo, $ticket['id'], $threadId, $staff['id'], $message, $ticket);
log_activity($pdo, $ticket['id'], $staff['id'], 'Interne Notiz hinzugefügt');
@@ -330,6 +347,33 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
redirect('/staff/ticket_view.php?n=' . urlencode($number));
}
if ($action === 'snooze') {
$until = ticket_snooze_until((string) ($_POST['snooze_choice'] ?? ''), (string) ($_POST['snooze_custom'] ?? ''));
if ($until === null) {
flash('error', 'Bitte einen Zeitpunkt in der Zukunft wählen (höchstens 1 Jahr).');
} else {
ticket_snooze_set($pdo, (int) $ticket['id'], (int) $staff['id'], $until);
flash('success', 'Wiedervorlage bis ' . date('d.m.Y H:i', (int) strtotime($until)) . ' Uhr. Das Ticket kommt dann zurück und du wirst benachrichtigt.');
}
redirect('/staff/ticket_view.php?n=' . urlencode($number));
}
if ($action === 'unsnooze') {
ticket_snooze_clear($pdo, (int) $ticket['id'], (int) $staff['id'], 'Wiedervorlage aufgehoben');
flash('success', 'Wiedervorlage aufgehoben.');
redirect('/staff/ticket_view.php?n=' . urlencode($number));
}
if ($action === 'follow' || $action === 'unfollow') {
try {
if ($action === 'follow') { ticket_follow($pdo, (int) $ticket['id'], (int) $staff['id']); flash('success', 'Du beobachtest dieses Ticket jetzt und bekommst Benachrichtigungen bei Antworten.'); }
else { ticket_unfollow($pdo, (int) $ticket['id'], (int) $staff['id']); flash('success', 'Du beobachtest dieses Ticket nicht mehr.'); }
} catch (Throwable $e) {
flash('error', 'Das ging nicht. Bitte unter System-Update die Datenbank aktualisieren.');
}
redirect('/staff/ticket_view.php?n=' . urlencode($number));
}
if ($action === 'add_collaborator') {
$ccEmail = trim($_POST['collaborator_email'] ?? '');
$ccName = trim($_POST['collaborator_name'] ?? '');
@@ -1224,6 +1268,54 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
<?php endif; ?>
</div>
<!-- Wiedervorlage und Beobachter -->
<div class="card" style="padding:16px 20px">
<span style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)">Wiedervorlage</span>
<?php if ($snoozedUntil): ?>
<p style="font-size:.84rem;margin:8px 0">💤 Bis <strong><?= e(date('d.m.Y H:i', (int) strtotime($snoozedUntil))) ?> Uhr</strong> ausgeblendet, dann kommt es zurück.</p>
<form method="post"><?= csrf_field() ?><input type="hidden" name="action" value="unsnooze"><button type="submit" class="btn secondary" style="width:100%;font-size:.82rem;justify-content:center">Jetzt zurückholen</button></form>
<?php else: ?>
<form method="post" style="margin-top:8px">
<?= csrf_field() ?><input type="hidden" name="action" value="snooze">
<select name="snooze_choice" style="font-size:.84rem;padding:7px 10px;margin-bottom:6px" onchange="document.getElementById('snooze-custom').style.display=this.value==='custom'?'':'none'">
<?php foreach (ticket_snooze_options() as $k => $l): ?><option value="<?= e($k) ?>"><?= e($l) ?></option><?php endforeach; ?>
</select>
<input type="datetime-local" name="snooze_custom" id="snooze-custom" style="display:none;font-size:.84rem;padding:7px 10px;margin-bottom:6px">
<button type="submit" class="btn secondary" style="width:100%;font-size:.82rem;justify-content:center">Auf später legen</button>
</form>
<p style="font-size:.76rem;color:var(--muted);margin:6px 0 0">Das Ticket verschwindet aus den Listen und kommt zum Zeitpunkt zurück, mit Benachrichtigung. Antwortet der Kunde früher, kommt es sofort zurück.</p>
<?php endif; ?>
<div style="margin-top:14px;padding-top:12px;border-top:1px solid var(--border-soft)">
<span style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)">Beobachter</span>
<?php if ($followers): ?>
<div style="font-size:.83rem;margin:6px 0"><?= e(implode(', ', array_column($followers, 'name'))) ?></div>
<?php else: ?>
<p style="font-size:.79rem;color:var(--muted);margin:6px 0">Niemand. Beobachter bekommen Benachrichtigungen, ohne dass ihnen das Ticket zugewiesen ist.</p>
<?php endif; ?>
<form method="post"><?= csrf_field() ?><input type="hidden" name="action" value="<?= $isFollowing ? 'unfollow' : 'follow' ?>"><button type="submit" class="btn secondary" style="width:100%;font-size:.82rem;justify-content:center"><?= $isFollowing ? 'Nicht mehr beobachten' : '👁 Ticket beobachten' ?></button></form>
</div>
</div>
<?php if ($similar['articles'] || $similar['tickets']): ?>
<!-- Ähnliche Artikel und Tickets -->
<div class="card" style="padding:16px 20px">
<span style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)">Dazu passend</span>
<?php if ($similar['articles']): ?>
<div style="font-size:.76rem;color:var(--muted);margin:8px 0 2px">Wissensdatenbank</div>
<?php foreach ($similar['articles'] as $sa): ?>
<div style="font-size:.84rem;padding:3px 0"><a href="<?= e($sa['url']) ?>" target="_blank" rel="noopener"><?= e($sa['title']) ?></a> <button type="button" class="link" style="background:none;border:0;color:var(--muted);cursor:pointer;font-size:.74rem" onclick="navigator.clipboard&&navigator.clipboard.writeText(location.origin+'<?= e($sa['url']) ?>');this.textContent='kopiert'">Link kopieren</button></div>
<?php endforeach; ?>
<?php endif; ?>
<?php if ($similar['tickets']): ?>
<div style="font-size:.76rem;color:var(--muted);margin:8px 0 2px">Ähnliche gelöste Tickets</div>
<?php foreach ($similar['tickets'] as $st): ?>
<div style="font-size:.84rem;padding:3px 0"><a href="/staff/ticket_view.php?n=<?= e(urlencode((string) $st['number'])) ?>" target="_blank" rel="noopener">#<?= e($st['number']) ?></a> <?= e(mb_strimwidth((string) $st['subject'], 0, 48, '…')) ?></div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<!-- Kollaboratoren -->
<div class="card" style="padding:16px 20px">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px">