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>
43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../lib/auth.php';
|
|
require_once __DIR__ . '/../lib/upload.php';
|
|
require_login();
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
|
header('Location: ../pages/dokumentenarchiv.php');
|
|
exit;
|
|
}
|
|
|
|
$back = '../pages/dokumentenarchiv.php';
|
|
|
|
$allowed_kategorien = ['Fortbildungsnachweis', 'Zeugnis', 'Bescheinigung', 'Sonstiges'];
|
|
$kategorie = trim($_POST['kategorie'] ?? '');
|
|
$beschreibung = trim($_POST['beschreibung'] ?? '');
|
|
|
|
if (!in_array($kategorie, $allowed_kategorien, true)) {
|
|
redirect_error($back, 'Bitte eine Kategorie auswählen.');
|
|
}
|
|
|
|
$filesize = $_FILES['datei']['size'] ?? 0;
|
|
$up = handle_upload($_FILES['datei'] ?? [], [
|
|
'allowed' => UPLOAD_TYPES_DOCS,
|
|
'dir' => dirname(__DIR__) . '/uploads/',
|
|
'prefix' => 'dokument',
|
|
]);
|
|
if (!$up['ok']) {
|
|
redirect_error($back, $up['error']);
|
|
}
|
|
|
|
$safe_name = $up['filename'];
|
|
$original_name = $up['original_name'];
|
|
|
|
$user_id = current_user()['id'];
|
|
$now = date('c');
|
|
|
|
db()->prepare(
|
|
'INSERT INTO dokumente (user_id, kategorie, beschreibung, filename, original_name, filesize, created_at)
|
|
VALUES (?, ?, ?, ?, ?, ?, ?)'
|
|
)->execute([$user_id, $kategorie, $beschreibung, $safe_name, $original_name, $filesize, $now]);
|
|
|
|
redirect_ok($back, 'ok');
|