?lang=de-AT-easy * * Wir nutzen die V1-glossar-Tabelle additiv (sie hat schon short/long/easy-Spalten). * Pfad-Schema: /api/glossary.php?slug=intermodalverkehr (oder via .htaccess /api/glossary/intermodalverkehr) */ declare(strict_types=1); require_once __DIR__ . '/../../bootstrap.php'; v2_validate_method('GET'); v2_auth_require('any'); // Slug kommt entweder als ?slug= oder via PATH_INFO $slug = $_GET['slug'] ?? ''; if (!$slug && !empty($_SERVER['PATH_INFO'])) { $slug = trim($_SERVER['PATH_INFO'], '/'); } if (!$slug) { v2_response_error(400, 'missing_slug', 'Glossar-Slug fehlt.'); } $lang = $_GET['lang'] ?? 'de-AT-standard'; $useEasy = str_ends_with($lang, '-easy'); $row = v2_db_one(" SELECT slug, term, short, short_easy, text, text_easy, image_path FROM glossar WHERE slug = :slug ", [':slug' => $slug]); if (!$row) { v2_response_error(404, 'not_found', "Glossar-Eintrag '$slug' nicht gefunden."); } $shortText = $useEasy && !empty($row['short_easy']) ? $row['short_easy'] : $row['short']; $longText = $useEasy && !empty($row['text_easy']) ? $row['text_easy'] : $row['text']; v2_response_ok([ 'slug' => $row['slug'], 'title' => $row['term'], 'shortText' => $shortText, 'longTextHtml' => $longText, 'imageUrl' => $row['image_path'] ? V2_BASE_URL . '/../assets/img/glossar/' . basename($row['image_path']) : null, ]);