Add language.php
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<?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>
|
||||
<link rel="stylesheet"
|
||||
href="assets/css/style.css">
|
||||
</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>
|
||||
<?= htmlspecialchars($name) ?>
|
||||
</li>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user