Upload via GUI (290 Dateien)

This commit is contained in:
2026-10-23 17:22:26 +00:00
parent 41e3aca842
commit 78cf43591a
6 changed files with 543 additions and 1 deletions
+23
View File
@@ -2,6 +2,7 @@
declare(strict_types=1);
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/totp.php';
header('Content-Type: application/json; charset=utf-8');
@@ -147,6 +148,7 @@ function api_require_staff(): array
// auch App-Nutzung hält die automatischen Hintergrund-Jobs am Laufen.
pseudo_cron_schedule_background();
$GLOBALS['__api_staff'] = $staff; // für api_is_following()
return $staff;
}
@@ -271,9 +273,30 @@ function api_ticket_summary(array $ticket): array
'isSpam' => !empty($ticket['is_spam']),
'createdAt' => $ticket['created_at'],
'updatedAt' => $ticket['updated_at'],
'snoozedUntil' => !empty($ticket['snoozed_until']) && $ticket['snoozed_until'] > db_now() ? $ticket['snoozed_until'] : null,
'following' => api_is_following((int) $ticket['id']),
];
}
/** Beobachtet der angemeldete Mitarbeiter dieses Ticket? (für die App) */
function api_is_following(int $ticketId): bool
{
static $mine = null;
if ($mine === null) {
$mine = [];
try {
$staff = $GLOBALS['__api_staff'] ?? null;
if ($staff) {
$stmt = get_db()->prepare('SELECT ticket_id FROM ticket_followers WHERE staff_id = ?');
$stmt->execute([(int) $staff['id']]);
$mine = array_flip(array_map('intval', $stmt->fetchAll(PDO::FETCH_COLUMN)));
}
} catch (Throwable $e) {
}
}
return isset($mine[$ticketId]);
}
function api_add_ticket_message(PDO $pdo, array $staff, array $ticket, string $type, string $rawMessage, ?string $setStatus, ?string $signatureChoice = null): int
{
$permission = $type === 'note' ? 'post_note' : 'reply_ticket';