Upload via GUI (258 Dateien)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/includes/bootstrap.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$pdo = get_db();
|
||||
$number = $_GET['n'] ?? '';
|
||||
$known = max(0, (int) ($_GET['count'] ?? 0));
|
||||
|
||||
$stmt = $pdo->prepare(
|
||||
'SELECT t.id, t.user_id, t.ticket_number FROM tickets t WHERE t.ticket_number = ?'
|
||||
);
|
||||
$stmt->execute([$number]);
|
||||
$ticket = $stmt->fetch();
|
||||
|
||||
if (!$ticket) {
|
||||
echo json_encode(['new_count' => $known]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Zugriffsprüfung wie in ticket_view.php
|
||||
$user = current_user();
|
||||
$allowed = ($user && $ticket['user_id'] == $user['id'])
|
||||
|| !empty($_SESSION['guest_ticket_access'][$ticket['ticket_number']]);
|
||||
|
||||
if (!$allowed) {
|
||||
echo json_encode(['new_count' => $known]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare(
|
||||
'SELECT COUNT(*) FROM ticket_threads WHERE ticket_id = ? AND is_internal_note = 0'
|
||||
);
|
||||
$stmt->execute([$ticket['id']]);
|
||||
$count = (int) $stmt->fetchColumn();
|
||||
|
||||
echo json_encode(['new_count' => $count]);
|
||||
Reference in New Issue
Block a user