Initial commit: OMSORG website + Mitarbeiter-App

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Felix Kemmler
2026-06-13 20:03:22 +02:00
co-authored by Claude Sonnet 4.6
commit 8beb0fcf52
103 changed files with 7384 additions and 0 deletions
@@ -0,0 +1,45 @@
<?php
require_once __DIR__ . '/../lib/auth.php';
require_admin();
header('Content-Type: application/json');
if (($_SERVER['HTTP_X_REQUESTED_WITH'] ?? '') !== 'XMLHttpRequest') {
echo json_encode(['ok' => false, 'error' => 'forbidden']);
exit;
}
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
echo json_encode(['ok' => false, 'error' => 'method']);
exit;
}
$body = file_get_contents('php://input');
$data = json_decode($body, true);
$order = $data['order'] ?? null;
if (!is_array($order)) {
echo json_encode(['ok' => false, 'error' => 'invalid']);
exit;
}
$ids = array_values(array_filter(array_map('intval', $order), fn($v) => $v > 0));
if (empty($ids)) {
echo json_encode(['ok' => true]);
exit;
}
$now = date('c');
$pos = 10;
$stmt = db()->prepare('UPDATE downloads SET sort_order = ?, updated_at = ? WHERE id = ?');
db()->beginTransaction();
foreach ($ids as $id) {
$stmt->execute([$pos, $now, $id]);
$pos += 10;
}
db()->commit();
echo json_encode(['ok' => true]);
exit;