Reorganize into monorepo layout, move mitarbeiter-app to legacy reference
Consolidates the previously separate omsorgapp and omsorgCore repos (each had their own nested .git with GitHub history) plus the old root-level website/mitarbeiter-app into a single monorepo, matching the structure already documented in the root CLAUDE.md. Also moves the PHP employee app aside as omsorgWeb/mitarbeiter-app-legacy/ to serve as a template for a ground-up rewrite. Fixes .gitignore in the same pass: the config-secrets/uploads/data patterns were unanchored (relative to repo root, not depth-agnostic), so they silently stopped matching once the app moved under omsorgWeb/. Patterns are now **/-prefixed and cover both mitarbeiter-app and mitarbeiter-app-legacy, keeping DB/SMTP credentials and uploaded employee documents out of version control. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
8beb0fcf52
commit
b6c1389c55
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../lib/auth.php';
|
||||
require_once __DIR__ . '/../lib/upload.php';
|
||||
require_admin();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
header('Location: ../pages/admin.php?tab=fortbildung');
|
||||
exit;
|
||||
}
|
||||
|
||||
$action = $_POST['_action'] ?? '';
|
||||
|
||||
/* ── Add ──────────────────────────────────────────────────────────────── */
|
||||
if ($action === 'add') {
|
||||
$title = trim($_POST['title'] ?? '');
|
||||
$description = trim($_POST['description'] ?? '');
|
||||
|
||||
if ($title === '') {
|
||||
header('Location: ../pages/admin.php?tab=fortbildung&err=notitle');
|
||||
exit;
|
||||
}
|
||||
|
||||
$up = handle_upload($_FILES['file'] ?? [], [
|
||||
'allowed' => UPLOAD_TYPES_OFFICE,
|
||||
'dir' => dirname(__DIR__) . '/fortbildung-materials/',
|
||||
'naming' => 'hash',
|
||||
'max_bytes' => 20 * 1024 * 1024,
|
||||
'messages' => [
|
||||
'missing' => 'nofile', 'upload' => 'nofile',
|
||||
'ext' => 'badext', 'mime' => 'badmime',
|
||||
'size' => 'toobig', 'move' => 'upload',
|
||||
],
|
||||
]);
|
||||
if (!$up['ok']) {
|
||||
header('Location: ../pages/admin.php?tab=fortbildung&err=' . $up['error']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$safe_name = $up['filename'];
|
||||
$original_name = $up['original_name'];
|
||||
|
||||
$sort_order = (int)db()->query('SELECT COALESCE(MAX(sort_order), 0) + 10 FROM fortbildung_materials')->fetchColumn();
|
||||
$now = date('c');
|
||||
|
||||
$stmt = db()->prepare(
|
||||
'INSERT INTO fortbildung_materials (title, description, filename, original_name, sort_order, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)'
|
||||
);
|
||||
$stmt->execute([$title, $description, $safe_name, $original_name, $sort_order, $now, $now]);
|
||||
|
||||
header('Location: ../pages/admin.php?tab=fortbildung&ok=added');
|
||||
exit;
|
||||
}
|
||||
|
||||
/* ── Delete ───────────────────────────────────────────────────────────── */
|
||||
if ($action === 'delete') {
|
||||
$id = (int)($_POST['material_id'] ?? 0);
|
||||
if ($id <= 0) {
|
||||
header('Location: ../pages/admin.php?tab=fortbildung&err=invalid');
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare('SELECT filename FROM fortbildung_materials WHERE id = ?');
|
||||
$stmt->execute([$id]);
|
||||
$row = $stmt->fetch();
|
||||
|
||||
if ($row) {
|
||||
db()->prepare('DELETE FROM fortbildung_materials WHERE id = ?')->execute([$id]);
|
||||
@unlink(dirname(__DIR__) . '/fortbildung-materials/' . $row['filename']);
|
||||
}
|
||||
|
||||
header('Location: ../pages/admin.php?tab=fortbildung&ok=deleted');
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Location: ../pages/admin.php?tab=fortbildung');
|
||||
exit;
|
||||
Reference in New Issue
Block a user