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>
35 lines
1011 B
PHP
35 lines
1011 B
PHP
<?php
|
|
require_once __DIR__ . '/../lib/auth.php';
|
|
require_once __DIR__ . '/../lib/db.php';
|
|
require_admin();
|
|
|
|
$action = $_POST['_action'] ?? '';
|
|
|
|
if ($action === 'add') {
|
|
$title = trim((string)($_POST['title'] ?? ''));
|
|
$text = trim((string)($_POST['text'] ?? ''));
|
|
$date = trim((string)($_POST['date'] ?? '')) ?: date('Y-m-d');
|
|
if ($title === '' || $text === '') {
|
|
header('Location: ../pages/admin.php?tab=news&err=empty');
|
|
exit;
|
|
}
|
|
$stmt = db()->prepare(
|
|
'INSERT INTO news (title, text, date, created_at) VALUES (?, ?, ?, ?)'
|
|
);
|
|
$stmt->execute([$title, $text, $date, date('c')]);
|
|
header('Location: ../pages/admin.php?tab=news&ok=added');
|
|
exit;
|
|
}
|
|
|
|
if ($action === 'delete') {
|
|
$id = (int)($_POST['news_id'] ?? 0);
|
|
if ($id > 0) {
|
|
db()->prepare('DELETE FROM news WHERE id = ?')->execute([$id]);
|
|
}
|
|
header('Location: ../pages/admin.php?tab=news&ok=deleted');
|
|
exit;
|
|
}
|
|
|
|
header('Location: ../pages/admin.php?tab=news');
|
|
exit;
|