Files
woordjes/language.php
T
2026-06-16 11:34:14 +02:00

97 lines
1.5 KiB
PHP

<?php
require_once 'includes/config.php';
require_once 'includes/auth.php';
require_once 'includes/functions.php';
requireLogin();
$lang =
$_GET['lang'] ?? '';
$path =
languagePath(
$_SESSION['user'],
$lang
);
if (!is_dir($path)) {
die('Onbekende taal');
}
$lists = [];
if (is_dir($path . '/lists')) {
$lists = glob(
$path . '/lists/*.json'
);
}
?>
<!DOCTYPE html>
<html>
<head>
<title><?= $lang ?></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#222">
<link rel="manifest" href="/manifest.json">
<link rel="stylesheet" href="/assets/css/style.css">
<link rel="apple-touch-icon" sizes="180x180" href="/assets/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/img/favicon.ico">
<link rel="icon" type="image/png" sizes="16x16" href="/assets/img/favicon-16x16.png">
</head>
<body>
<div class="container">
<div class="card">
<h1>
<?= htmlspecialchars($lang) ?>
</h1>
<p>
<a href="create_list.php?lang=<?= urlencode($lang) ?>">
Nieuwe woordenlijst
</a>
</p>
</div>
<div class="card">
<h2>Woordenlijsten</h2>
<ul>
<?php foreach($lists as $file): ?>
<?php
$name =
basename(
$file,
'.json'
);
?>
<li>
<a href="learn.php?lang=<?= urlencode($lang) ?>&list=<?= urlencode($name) ?>">
<?= htmlspecialchars($name) ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</body>
</html>