2023-06-27 14:31:55 +02:00
|
|
|
<?php
|
|
|
|
require_once "require/base.php";
|
|
|
|
|
|
|
|
$database = new Database();
|
2024-09-01 21:02:51 +02:00
|
|
|
$bonus = $database->getArticleNb(); // L'énigme bonus est la dernière
|
2023-09-02 06:19:09 +02:00
|
|
|
|
2023-06-28 20:38:52 +02:00
|
|
|
if (isset($_GET["id"]) && isset($_GET["team"])) {
|
|
|
|
$art_id = htmlspecialchars($_GET["id"]);
|
|
|
|
$team_id = htmlspecialchars($_GET["team"]);
|
2023-09-02 01:00:27 +02:00
|
|
|
|
|
|
|
// Vérification de l'existence du groupe et de l'énigme :
|
2024-09-01 21:02:51 +02:00
|
|
|
if (!$database->checkArticleExists($art_id)) {
|
|
|
|
if (!$database->checkTeamExists($team_id)) {
|
|
|
|
header("Location: index.php");
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
else if ($art_id == -1) {
|
|
|
|
header("Location: puzzles.php?team=" . $team_id);
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
header("Location: index.php");
|
|
|
|
die();
|
|
|
|
}
|
2023-06-28 20:38:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
2024-09-01 21:02:51 +02:00
|
|
|
// On vérifie si l'énigme bonus n'est pas débloquée :
|
|
|
|
if (!$database->checkTeamBonus($team_id)) {
|
|
|
|
// Si c'est celle qui est sélectionnée, on retourne à la page d'accueil :
|
|
|
|
if ($art_id == $bonus) {
|
|
|
|
header("Location: index.php");
|
|
|
|
die();
|
|
|
|
}
|
2024-03-31 16:27:00 +02:00
|
|
|
}
|
|
|
|
|
2024-09-01 21:02:51 +02:00
|
|
|
$article = $database->getArticle($art_id);
|
|
|
|
$next_art = $database->getNextPuzzle($team_id);
|
|
|
|
$solved = $database->isPuzzleSolved($art_id, $team_id);
|
2023-06-28 20:38:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
header("Location: index.php");
|
|
|
|
die();
|
2023-06-27 14:31:55 +02:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="fr">
|
|
|
|
<head>
|
|
|
|
<?php
|
|
|
|
require_once $rq_path . "head.php";
|
|
|
|
?>
|
2023-06-28 20:38:52 +02:00
|
|
|
<title><?= $tr["tab_title"]["article"] ?></title>
|
|
|
|
<script type="module" src="<?= $rq_path ?>js/qrscan.js"></script>
|
2023-06-27 14:31:55 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<header>
|
|
|
|
<?php
|
|
|
|
require_once $rq_path . "nav.php";
|
|
|
|
?>
|
|
|
|
</header>
|
|
|
|
<main>
|
|
|
|
<header>
|
2024-09-01 21:02:51 +02:00
|
|
|
<h1><?= $tr["page_title"]["article"] . $art_id . " : " . $article["title"] ?></h1>
|
2023-09-03 21:34:28 +02:00
|
|
|
<h2><?= $article["text"] ?></h2>
|
2024-09-01 21:02:51 +02:00
|
|
|
<?php if ($solved) : ?>
|
2024-03-31 16:27:00 +02:00
|
|
|
<a href="article.php?team=<?= $team_id ?>&id=<?= $next_art ?>">
|
2023-09-02 06:19:09 +02:00
|
|
|
<button><?= $tr["article"]["next_but"] ?></button>
|
2024-03-31 16:27:00 +02:00
|
|
|
</a>
|
2023-06-28 20:38:52 +02:00
|
|
|
<p><?= $tr["article"]["success"] ?></p>
|
2023-09-03 21:34:28 +02:00
|
|
|
<?php else : ?>
|
|
|
|
<p><?= $tr["article"]["message"] ?></p>
|
|
|
|
<?php endif; ?>
|
|
|
|
</header>
|
|
|
|
<article>
|
|
|
|
<?php if ($solved) : ?>
|
2023-07-11 12:24:33 +02:00
|
|
|
<p><?= $article["answer"] ?></p>
|
2024-09-01 21:02:51 +02:00
|
|
|
<img src="images/map/puzzles/<?= $article["id"] ?>.png"/>
|
2023-06-28 20:38:52 +02:00
|
|
|
<?php else : ?>
|
|
|
|
<button><?= $tr["article"]["qr_but"] ?></button>
|
2023-09-03 21:34:28 +02:00
|
|
|
<p></p> <!-- Emplacement du message d'erreur JS concernant la caméra. !-->
|
2023-06-28 20:38:52 +02:00
|
|
|
<video></video>
|
|
|
|
<p><?= $tr["article"]["cam_sel"] ?></p>
|
|
|
|
<select>
|
|
|
|
<option value="rear" selected><?= $tr["article"]["r_cam"] ?></option>
|
|
|
|
<option value="front"><?= $tr["article"]["f_cam"] ?></option>
|
|
|
|
</select>
|
|
|
|
<!-- <p>Scanner depuis un fichier</p>
|
|
|
|
<input type="file" id="file-selector"> -->
|
|
|
|
<?php endif; ?>
|
2023-06-27 14:31:55 +02:00
|
|
|
</article>
|
|
|
|
</main>
|
|
|
|
<footer>
|
|
|
|
<?php
|
|
|
|
require_once $rq_path . "footer.php";
|
|
|
|
?>
|
|
|
|
</footer>
|
|
|
|
</body>
|
|
|
|
</html>
|