= htmlspecialchars($t['title'], ENT_QUOTES) ?>
= nl2br(htmlspecialchars(substr($t['body'], 0, 200), ENT_QUOTES)) ?>= strlen($t['body']) > 200 ? '…' : '' ?>
pdo();
$userId = $_SESSION['user_id'] ?? null;
$error = '';
$search = trim((string)($_GET['q'] ?? ''));
$communityCfg = require __DIR__ . '/../../../config/community.php';
$community = $pdo ? new \App\Community($pdo, $communityCfg) : null;
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'thread_create') {
if (!$userId) {
$error = 'Bitte einloggen, um Fragen zu stellen.';
} elseif ($community) {
$title = trim((string)($_POST['title'] ?? ''));
$body = trim((string)($_POST['body'] ?? ''));
if ($title === '' || $body === '') {
$error = 'Titel und Text sind erforderlich.';
} else {
$community->createThread((int)$userId, $title, $body);
redirect('/community');
}
}
}
$threads = $community ? ($search !== '' ? $community->searchThreads($search, 50) : $community->listThreads(50)) : [];
?>
Community = nl2br(htmlspecialchars(substr($t['body'], 0, 200), ENT_QUOTES)) ?>= strlen($t['body']) > 200 ? '…' : '' ?> Keine Treffer.Forum
= htmlspecialchars($t['title'], ENT_QUOTES) ?>