From d2ea5ebbcd10278793e6b3f1990b91054ba5ff85 Mon Sep 17 00:00:00 2001 From: antux18 Date: Tue, 13 Feb 2024 10:22:28 +0100 Subject: [PATCH 1/9] Modif README. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0a175a6..d9c08df 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# Chasse au trésor Lycée Pange +# Jeu de pistes Sarreguemines **Auteur :** Antoine WAEHREN ## Crédits -Ce projet utilise le module QR Scanner de NIMIQ : https://github.com/nimiq/qr-scanner \ No newline at end of file +Ce projet utilise le module QR Scanner de NIMIQ : https://github.com/nimiq/qr-scanner -- 2.39.5 From b2bdc6350f947a2621d967488e5f8b85868f0c5b Mon Sep 17 00:00:00 2001 From: antux18 Date: Tue, 13 Feb 2024 10:36:59 +0100 Subject: [PATCH 2/9] =?UTF-8?q?Suppression=20de=20la=20fonction=20d'=C3=A9?= =?UTF-8?q?nigme=20bonus=20+=20changement=20du=20nom=20de=20l'app.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- answer.php | 11 ----------- article.php | 12 ------------ data/article.db | Bin 40960 -> 40960 bytes data/teams.db | Bin 45056 -> 45056 bytes puzzles.php | 15 +-------------- require/database.php | 7 ------- require/locales/en.php | 14 +++++++------- require/locales/fr.php | 16 ++++++++-------- 8 files changed, 16 insertions(+), 59 deletions(-) diff --git a/answer.php b/answer.php index 00aab09..2d328bc 100644 --- a/answer.php +++ b/answer.php @@ -56,17 +56,6 @@ $stmt->bindValue(":puzzle_id", $art_id); $stmt->bindValue(":team_id", $team_id); $stmt->execute(); - - // On ajoute l'énigme bonus si toutes les autres sont résolues : - $stmt = $database->pdo_teams->prepare("SELECT COUNT(*) FROM solved WHERE team_id == :team_id"); - $stmt->bindValue(":team_id", $team_id); - $stmt->execute(); - - if ($stmt->fetchAll()[0]["COUNT(*)"] == "12") { // Il y a 12 énigmes sans compter la bonus - $stmt = $database->pdo_teams->prepare("UPDATE teams SET bonus = 1 WHERE id = :team_id"); - $stmt->bindValue(":team_id", $team_id); - $stmt->execute(); - } } $data["valid_qr"] = true; diff --git a/article.php b/article.php index 95783fe..8483a34 100644 --- a/article.php +++ b/article.php @@ -27,18 +27,6 @@ } else { - // 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 liste des énigmes : - if ($art_id == $max_art) { - header("Location: puzzles.php?team=" . $team_id); - die(); - } - - // On retire l'énigme bonus du total : - $max_art--; - } - // On indique si l'énigme est résolue : $stmt = $database->pdo_teams->prepare("SELECT * FROM solved WHERE (team_id == :team_id AND puzzle_id == :puzzle_id)"); $stmt->bindValue(":team_id", $team_id); diff --git a/data/article.db b/data/article.db index 10f51c9174599e637426cf55f2adf262c490aad0..428531b4db56fb523ec40499ecb20c2dd91921bc 100644 GIT binary patch delta 59 zcmV-B0L1@*zyg540+1U47Lgo71r`7&r1+xV} RoCE>{7qNj81hckCN>?d35-$J% delta 640 zcmYL{zityj5XN&34ieH48j}Jf<^jwh-~|u{DUQOwM1i!MyYXdVZ}-^QwTv4Z0ew)a zNEGR?3yR2y0tzDCn^5u;%&sHRoV2&!%>2G@c6#2Lp0|!}B%RMUd+p9jHu!s1oZebZ z*S{|=!?*Rd_G*%(>Eh>|t!v5JqW$2@rB?F$?ESA~@^LS{va<21BRJGnOY;>8on!XIXvapm_l)3Bc*o?o8H5;vjRm>T zP97iaTz%7=UZ5^Xjl4)VGKX5Wt(|fvZrODtir%6DJ3FNIaOvw8#WDF;yT;R}1%Mx$Fg-ij1i4ovP@B^T% Ozq`5LU;NnIdi4)lwevXu diff --git a/data/teams.db b/data/teams.db index 27d92d3153fce3188cfb391d4913638c9c85c012..4bcc5551541bce928fdffd3f7bf6ff993f366d9c 100644 GIT binary patch delta 243 zcmZp8z|`=7X@az%9|HpeHxRP}F)I+uP1G@#_G8e?y1>i(j)9f8g_-Xoe;RKKA3NVM zzG}Ye&4vP8ypvmavsn1586+n`2X<#*nCm`4L>^*6B7dyBh%*p z`j7Z0P7vYdWM>v<1e?YLRG=@g`GNcmenA$Xfm}cgayJ_gvjXK_@biF#nE1bejQa)@ VdBxAg%FM{f#Kg?Z$+@V(001e4J9q#9 delta 652 zcmZp8z|`=7X@az%F9QPuHxRP}F)I*DPt-A%^kvXXd&SFF&A`gr!oc^DKaKYt-!a}6 zUfzw3bv!J5`xsj%ItsG@D>j8G!^B%twFtzwy4I6Lh7DML-{!@G>!pY;0s>QetIhWMpDu kX6EDsdI$tqfS3b_nSmJON$$;z4lm><32 diff --git a/puzzles.php b/puzzles.php index de4076a..a88c400 100644 --- a/puzzles.php +++ b/puzzles.php @@ -31,20 +31,7 @@ false ); - // On vérifie si l'équipe a débloqué l'énigme bonus : - $stmt = $database->pdo_teams->prepare("SELECT * FROM teams WHERE id = :id"); - $stmt->bindValue(":id", $team_id); - $stmt->execute(); - - // Si c'est le cas, on affiche toutes les énigmes : - if ($stmt->fetchAll()[0][1] == 1) { - $stmt = $database->pdo_article->prepare("SELECT * FROM puzzles"); - } - - // Sinon, on cache la bonus : - else { - $stmt = $database->pdo_article->prepare("SELECT * FROM puzzles WHERE id <> 13"); - } + $stmt = $database->pdo_article->prepare("SELECT * FROM puzzles"); $stmt->execute(); $puzzles = $stmt->fetchAll(); diff --git a/require/database.php b/require/database.php index aa04737..fe69edf 100644 --- a/require/database.php +++ b/require/database.php @@ -24,7 +24,6 @@ $this->pdo_teams = new PDO("sqlite:" . dirname(__FILE__) . $data_path . "teams.db"); $this->pdo_teams->query('CREATE TABLE IF NOT EXISTS "teams" ( "id" INTEGER NOT NULL UNIQUE, - "bonus" INTEGER NOT NULL, PRIMARY KEY("id" AUTOINCREMENT) )'); @@ -57,12 +56,6 @@ return $query->fetch()["COUNT(*)"]; } - function checkTeamBonus(int $team) { - // $team doit être une équipe existante : - $query = $this->pdo_teams->query("SELECT bonus FROM teams WHERE id = " . $team); - return $query->fetch()[0] == 1; - } - // public function getTeamsNb() { // $query = $this->pdo_teams->query("SELECT COUNT(*) FROM teams"); // return $query->fetch()["COUNT(*)"]; diff --git a/require/locales/en.php b/require/locales/en.php index 61bc898..a9e71f7 100644 --- a/require/locales/en.php +++ b/require/locales/en.php @@ -1,19 +1,19 @@ [ - "home" => "Home - Lycée Pange Code Hunt", - "team_confirm" => "Team confirmation - Lycée Pange Code Hunt", - "puzzles" => "Puzzles list - Lycée Pange Code Hunt", - "article" => "Puzzle - Lycée Pange Code Hunt" + "home" => "Home - Citizenship Code Hunt", + "team_confirm" => "Team confirmation - Citizenship Code Hunt", + "puzzles" => "Puzzles list - Citizenship Code Hunt", + "article" => "Puzzle - Citizenship Code Hunt" ], "page_title" => [ - "home" => "Code Hunt", + "home" => "Citizenship Code Hunt", "team_confirm" => "Team confirmation", "puzzles" => "Puzzles list for team n°", "article" => "Puzzle n°" ], "home" => [ - "subtitle" => "Welcome to the code hunt of Lycée Jean de Pange of Sarreguemines !", + "subtitle" => "Welcome to the Citizenship Code Hunt !", "message" => "Enter your team number to begin :", "team" => "Team number...", "button" => "OK" @@ -38,7 +38,7 @@ "map_desc" => "Here is a map showing the location of the puzzles you already solved :" ], "nav" => [ - "title" => "Code Hunt Pange", + "title" => "Citizenship Code Hunt", "home" => "Home" ], "footer" => [ diff --git a/require/locales/fr.php b/require/locales/fr.php index 3433df2..9494eaf 100644 --- a/require/locales/fr.php +++ b/require/locales/fr.php @@ -1,19 +1,19 @@ [ - "home" => "Accueil - Chasse au code Lycée Pange", - "team_confirm" => "Confirmation du choix d'équipe - Chasse au code Lycée Pange", - "puzzles" => "Liste des énigmes - Chasse au code Lycée Pange", - "article" => "Énigme - Chasse au code Lycée Pange" + "home" => "Accueil - Jeu de Pistes de la Citoyenneté", + "team_confirm" => "Confirmation du choix d'équipe - Jeu de Pistes de la Citoyenneté", + "puzzles" => "Liste des énigmes - Jeu de Pistes de la Citoyenneté", + "article" => "Énigme - Jeu de Pistes de la Citoyenneté" ], "page_title" => [ - "home" => "Chasse au code", + "home" => "Jeu de Pistes de la Citoyenneté", "team_confirm" => "Confirmation du choix d'équipe", "puzzles" => "Liste des puzzles pour l'équipe n°", "article" => "Énigme n°" ], "home" => [ - "subtitle" => "Bienvenue à la chasse au code du Lycée Jean de Pange de Sarreguemines !", + "subtitle" => "Bienvenue dans le Jeu de Pistes de la Citoyenneté !", "message" => "Pour commencer, veuillez entrer le numéro de votre équipe :", "team" => "Numéro d'équipe...", "button" => "Valider" @@ -38,11 +38,11 @@ "map_desc" => "Voici la carte des emplacements des énigmes que vous avez résolues :" ], "nav" => [ - "title" => "Chasse au code Pange", + "title" => "Jeu de Pistes de la Citoyenneté", "home" => "Accueil" ], "footer" => [ - "text" => "Lycée Jean de Pange Sarreguemines
Code source" + "text" => "Lycée Jean de Pange Sarreguemines
Code source" ] ]; ?> \ No newline at end of file -- 2.39.5 From fabc5e55fd80fb1ad71b450c0c885418d82ea4cb Mon Sep 17 00:00:00 2001 From: antux18 Date: Tue, 13 Feb 2024 10:51:14 +0100 Subject: [PATCH 3/9] =?UTF-8?q?Modification=20des=20=C3=A9nigmes=20+=20ajo?= =?UTF-8?q?ut=20de=20la=20lettre=20r=C3=A9compense.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- article.php | 2 +- data/article.db | Bin 40960 -> 40960 bytes data/teams.db | Bin 45056 -> 45056 bytes 3 files changed, 1 insertion(+), 1 deletion(-) diff --git a/article.php b/article.php index 8483a34..d503f0a 100644 --- a/article.php +++ b/article.php @@ -78,7 +78,7 @@

- .png"/> +

diff --git a/data/article.db b/data/article.db index 428531b4db56fb523ec40499ecb20c2dd91921bc..507c973921567838e69ad489f028be083315e1b6 100644 GIT binary patch delta 933 zcmZoTz|?SnX@az%ECT}r7Z5W8F&hv|Pt-9Mmu1k)y1>iV&%n%Q%fM&L_ndDB?=Rk8 zn*{}q^G>$q3uV-t*r>{+D>(TwpAI)`lb8Uzx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U}l0=S`f$bsyM($K-=(KR6u3ouX2II5U(5@uG z%iR>yE;Bf0&35q%=jP9yDQ>Od+xnj0DsK228hOR{n(0@F*;M$I-lR;=;BKKPktLe` zErfQV)2HdZH}S`iUSPAWW-SMC1Z>h~3HEP2sp8k2GI|cS?6-22H6#4kx(_4P<6m1q z-kl?2Br@4G3Ps|{7t1D~a$P_Vplfn0)_|k}M_K*{byXO(^yxOHX#!w34s_;uj#oVh z*n?KxwIIdP1A7QvkLm5gz28xL{H(_T3fBtDg;bQgn%zLl!-dPsXKt)+pUJXw_UgvP z?Z?qMGY}e;ltItdPMu2PwuGF{b`L;hQsO(Q$=26PD0kgpWvWAYzLIB0&)#C2>u+0J)vRL2q{4iuvL5U ziRqeyqNdj}A5rwPY-eu^%lAg;-p!q8$0rYde;*WT1f9kY#1K8w)P@Oav`!`ZU-;q4 z8 Date: Tue, 13 Feb 2024 13:21:03 +0100 Subject: [PATCH 4/9] =?UTF-8?q?D=C3=A9but=20impl=C3=A9mentation=20de=20l'o?= =?UTF-8?q?rdre=20des=20=C3=A9nigmes=20(pas=20fonctionnel).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/teams.db | Bin 45056 -> 45056 bytes puzzles.php | 26 ++++++++++++++++++++++++-- require/base.php | 1 + require/puzzles_order.php | 9 +++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 require/puzzles_order.php diff --git a/data/teams.db b/data/teams.db index 123a93a29d5b2b32d7984ab5e6f04e492b7e7d84..e39bdfb4123feff8722dac5985ae41e83c608681 100644 GIT binary patch delta 232 zcmZp8z|`=7X@az17y|Ey1>i(j)9f8g@NxQe;RKKUpAiu zuOqMHWaBKxR}vFV3GjaW;TNl{9;_p;*4Nj zOuRtXF!6t5;Q!74Z8M|8D}D}UCT0c(W=7`C|MHmxB!JQ&zyicvKn(H(2M{v@)xMCQ MB*3znrQwf00B689QUCw| delta 212 zcmZp8z|`=7X@az%KLY~;HxRP}F)I+uP1G@#_Gi#5TExryj)9f8g_-Xoe;RKKA3NVM zzG}Ye&4vP8ypvmavsn1586+nexecute(); $puzzles = $stmt->fetchAll(); + + // Recherche de l'ordre des énigmes : + $stmt = $database->pdo_teams->prepare("SELECT pzorder FROM teams WHERE id == :id"); + $stmt->bindValue(":id", $team_id); + $stmt->execute(); + $order = $stmt->fetch(); + + echo (string) $order["pzorder"]; + + // Si un ordre d'énigmes n'a pas été défini au préalable pour cette équipe, on en choisit un au hasard : + if ($order == NULL) { + $order = rand(0, sizeof($pzorder)); + $stmt = $database->pdo_teams->prepare("UPDATE teams SET pzorder = :order WHERE id == :id"); + $stmt->bindValue(":id", $team_id); + $stmt->bindValue(":order", $order); + $stmt->execute(); + } } } @@ -65,8 +83,12 @@

    - -
  • ">
  • + + + +
  • ">
  • + +
diff --git a/require/base.php b/require/base.php index 7c2d9d7..0edc066 100644 --- a/require/base.php +++ b/require/base.php @@ -1,5 +1,6 @@ \ No newline at end of file -- 2.39.5 From 559d42fff18de27d0288bc62f614be1b19f30920 Mon Sep 17 00:00:00 2001 From: antux18 Date: Fri, 16 Feb 2024 10:55:10 +0100 Subject: [PATCH 5/9] =?UTF-8?q?Fin=20impl=C3=A9mentation=20ordre=20des=20?= =?UTF-8?q?=C3=A9nigmes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/teams.db | Bin 45056 -> 45056 bytes puzzles.php | 10 +++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/data/teams.db b/data/teams.db index e39bdfb4123feff8722dac5985ae41e83c608681..200a3922428e8432d84b3ca8f916b1931cf7f9fd 100644 GIT binary patch delta 61 zcmZp8z|`=7X@WFk;zSu|)cif&bfPMujK*{49*j42&$y POw0@*z`FUrKVt#_S^W^l delta 55 zcmZp8z|`=7X@WFk*hCp;)-VRWtP2}c=Gt>JFfcIje`DbP&HrsPqrxkGPG%-%1_owE LW`@oG{TUMg=Y$W_ diff --git a/puzzles.php b/puzzles.php index 097d27e..64e8f5d 100644 --- a/puzzles.php +++ b/puzzles.php @@ -41,12 +41,12 @@ $stmt = $database->pdo_teams->prepare("SELECT pzorder FROM teams WHERE id == :id"); $stmt->bindValue(":id", $team_id); $stmt->execute(); - $order = $stmt->fetch(); - - echo (string) $order["pzorder"]; + $result = $stmt->fetch(); + $order = $result["pzorder"]; // Si un ordre d'énigmes n'a pas été défini au préalable pour cette équipe, on en choisit un au hasard : - if ($order == NULL) { + if (is_null($order)) { + echo "lol"; $order = rand(0, sizeof($pzorder)); $stmt = $database->pdo_teams->prepare("UPDATE teams SET pzorder = :order WHERE id == :id"); $stmt->bindValue(":id", $team_id); @@ -83,7 +83,7 @@

    - +
  • ">
  • -- 2.39.5 From f655529f318817c02c3d6fb39314c7ee648fa711 Mon Sep 17 00:00:00 2001 From: antux18 Date: Fri, 16 Feb 2024 10:56:02 +0100 Subject: [PATCH 6/9] Suppression echo inutile + modif bdd. --- data/teams.db | Bin 45056 -> 45056 bytes puzzles.php | 1 - 2 files changed, 1 deletion(-) diff --git a/data/teams.db b/data/teams.db index 200a3922428e8432d84b3ca8f916b1931cf7f9fd..ab1d5ebde64d5cc19c555483935b480fbd102fde 100644 GIT binary patch delta 55 zcmZp8z|`=7X@WFk(nJ|&)+7eKtP2}c=Gt>JFfcIje`DbP&HrsPqrxkGPG%-%1_owE LW`@oG{TUMg>zEJg delta 61 zcmZp8z|`=7X@WFk;zSu|)cif&bfPMujK*{49*j42&$y POw0@*z`FUrKVt#_S^W^l diff --git a/puzzles.php b/puzzles.php index 64e8f5d..be86eca 100644 --- a/puzzles.php +++ b/puzzles.php @@ -46,7 +46,6 @@ // Si un ordre d'énigmes n'a pas été défini au préalable pour cette équipe, on en choisit un au hasard : if (is_null($order)) { - echo "lol"; $order = rand(0, sizeof($pzorder)); $stmt = $database->pdo_teams->prepare("UPDATE teams SET pzorder = :order WHERE id == :id"); $stmt->bindValue(":id", $team_id); -- 2.39.5 From d0a515df65ab1428052aa27d530fa8c3645cf1be Mon Sep 17 00:00:00 2001 From: antux18 Date: Sun, 31 Mar 2024 16:27:00 +0200 Subject: [PATCH 7/9] =?UTF-8?q?Ajout=20d'un=20bouton=20suivant=20et=20pr?= =?UTF-8?q?=C3=A9c=C3=A9dent=20pour=20les=20=C3=A9nigmes.=20Corrections=20?= =?UTF-8?q?traductions.=20Corrections=20ordres=20des=20=C3=A9nigmes.=20Cor?= =?UTF-8?q?rections=20CSS.=20Corrections=20DB.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- article.php | 34 +++++++++++++++++++++++++++++++--- data/teams.db | Bin 45056 -> 45056 bytes puzzles.php | 2 +- require/database.php | 2 ++ require/locales/en.php | 17 +++++++++-------- require/locales/fr.php | 17 +++++++++-------- require/puzzles_order.php | 6 +++--- style.css | 1 + 8 files changed, 56 insertions(+), 23 deletions(-) diff --git a/article.php b/article.php index d503f0a..fb73093 100644 --- a/article.php +++ b/article.php @@ -5,6 +5,7 @@ $solved = false; $team_id = -1; $art_id = -1; + $art_index = -1; // Index de l'article dans la liste pzorder assignée à l'équipe $database = new Database(); @@ -27,6 +28,30 @@ } else { + // On cherche l'index de l'article dans la liste pzorder assignée à l'équipe : + $stmt = $database->pdo_teams->prepare("SELECT pzorder FROM teams WHERE id == :id"); + $stmt->bindValue(":id", $team_id); + $stmt->execute(); + $result = $stmt->fetch(); + $order = $result["pzorder"]; + + // Si un ordre d'énigmes n'a pas été défini au préalable pour cette équipe, on en choisit un au hasard : + if (is_null($order)) { + $order = rand(0, sizeof($pzorder)); + $stmt = $database->pdo_teams->prepare("UPDATE teams SET pzorder = :order WHERE id == :id"); + $stmt->bindValue(":id", $team_id); + $stmt->bindValue(":order", $order); + $stmt->execute(); + } + + $pzo_arr = $pzorder[$order]; + $art_index = array_search($art_id, $pzo_arr); + $prev_art = $pzo_arr[$art_index - 1]; + if ($art_index == 0) { + $prev_art = $pzo_arr[$max_art - 1]; + } + $next_art = $pzo_arr[($art_index + 1) % $max_art]; + // On indique si l'énigme est résolue : $stmt = $database->pdo_teams->prepare("SELECT * FROM solved WHERE (team_id == :team_id AND puzzle_id == :puzzle_id)"); $stmt->bindValue(":team_id", $team_id); @@ -59,15 +84,18 @@
    -

    +

    + + + - +

    diff --git a/data/teams.db b/data/teams.db index ab1d5ebde64d5cc19c555483935b480fbd102fde..c819427ae8b5a8bc92e0bc41e0686a263d7fec50 100644 GIT binary patch delta 61 zcmZp8z|`=7X@WFk@JFfcIje`DbP&HrsPqrxkGPG%-%1_owE LW`@oG{TUMg>zEJg diff --git a/puzzles.php b/puzzles.php index be86eca..d7f0cbd 100644 --- a/puzzles.php +++ b/puzzles.php @@ -85,7 +85,7 @@ -
  • ">
  • +
  • ">
  • diff --git a/require/database.php b/require/database.php index fe69edf..83c1949 100644 --- a/require/database.php +++ b/require/database.php @@ -17,6 +17,7 @@ "answer" TEXT NOT NULL, "location" TEXT NOT NULL, "code" TEXT NOT NULL, + "reward" TEXT NOT NULL, PRIMARY KEY("id" AUTOINCREMENT) )'); @@ -24,6 +25,7 @@ $this->pdo_teams = new PDO("sqlite:" . dirname(__FILE__) . $data_path . "teams.db"); $this->pdo_teams->query('CREATE TABLE IF NOT EXISTS "teams" ( "id" INTEGER NOT NULL UNIQUE, + "pzorder" INTEGER, PRIMARY KEY("id" AUTOINCREMENT) )'); diff --git a/require/locales/en.php b/require/locales/en.php index a9e71f7..63eff91 100644 --- a/require/locales/en.php +++ b/require/locales/en.php @@ -1,19 +1,19 @@ [ - "home" => "Home - Citizenship Code Hunt", - "team_confirm" => "Team confirmation - Citizenship Code Hunt", - "puzzles" => "Puzzles list - Citizenship Code Hunt", - "article" => "Puzzle - Citizenship Code Hunt" + "home" => "Home - Citizen's journey", + "team_confirm" => "Team confirmation - Citizen's journey", + "puzzles" => "Puzzles list - Citizen's journey", + "article" => "Puzzle - Citizen's journey" ], "page_title" => [ - "home" => "Citizenship Code Hunt", + "home" => "Citizen's journey", "team_confirm" => "Team confirmation", "puzzles" => "Puzzles list for team n°", "article" => "Puzzle n°" ], "home" => [ - "subtitle" => "Welcome to the Citizenship Code Hunt !", + "subtitle" => "Welcome to the Citizen's journey !", "message" => "Enter your team number to begin :", "team" => "Team number...", "button" => "OK" @@ -27,7 +27,8 @@ "message" => "This puzzle describes a specific place. Head to that place, then scan the QR code you'll find there.", "success" => "Well done ! Your team solved this puzzle !", "back_but" => "Puzzle list", - "next_but" => "Next puzzle", + "prev_but" => "🡰 Prev.", + "next_but" => "Next 🡲", "qr_but" => "Scan QR code", "cam_sel" => "Selected camera :", "f_cam" => "Front camera", @@ -38,7 +39,7 @@ "map_desc" => "Here is a map showing the location of the puzzles you already solved :" ], "nav" => [ - "title" => "Citizenship Code Hunt", + "title" => "Citizen's journey", "home" => "Home" ], "footer" => [ diff --git a/require/locales/fr.php b/require/locales/fr.php index 9494eaf..620d390 100644 --- a/require/locales/fr.php +++ b/require/locales/fr.php @@ -1,19 +1,19 @@ [ - "home" => "Accueil - Jeu de Pistes de la Citoyenneté", - "team_confirm" => "Confirmation du choix d'équipe - Jeu de Pistes de la Citoyenneté", - "puzzles" => "Liste des énigmes - Jeu de Pistes de la Citoyenneté", - "article" => "Énigme - Jeu de Pistes de la Citoyenneté" + "home" => "Accueil - Parcours du citoyen", + "team_confirm" => "Confirmation du choix d'équipe - Parcours du citoyen", + "puzzles" => "Liste des énigmes - Parcours du citoyen", + "article" => "Énigme - Parcours du citoyen" ], "page_title" => [ - "home" => "Jeu de Pistes de la Citoyenneté", + "home" => "Parcours du citoyen", "team_confirm" => "Confirmation du choix d'équipe", "puzzles" => "Liste des puzzles pour l'équipe n°", "article" => "Énigme n°" ], "home" => [ - "subtitle" => "Bienvenue dans le Jeu de Pistes de la Citoyenneté !", + "subtitle" => "Bienvenue dans le Parcours du citoyen !", "message" => "Pour commencer, veuillez entrer le numéro de votre équipe :", "team" => "Numéro d'équipe...", "button" => "Valider" @@ -27,7 +27,8 @@ "message" => "Cette énigme décrit un endroit précis. Dirigez-vous vers cet endroit, puis scannez le QR code que vous-y trouverez.", "success" => "Bien joué ! Votre équipe a résolu cette énigme !", "back_but" => "Liste des énigmes", - "next_but" => "Énigme suivante", + "prev_but" => "🡰 Préc.", + "next_but" => "Suiv. 🡲", "qr_but" => "Scanner le QR code", "cam_sel" => "Caméra sélectionnée :", "f_cam" => "Caméra avant", @@ -38,7 +39,7 @@ "map_desc" => "Voici la carte des emplacements des énigmes que vous avez résolues :" ], "nav" => [ - "title" => "Jeu de Pistes de la Citoyenneté", + "title" => "Parcours du citoyen", "home" => "Accueil" ], "footer" => [ diff --git a/require/puzzles_order.php b/require/puzzles_order.php index e72c49c..35c6aad 100644 --- a/require/puzzles_order.php +++ b/require/puzzles_order.php @@ -1,9 +1,9 @@ \ No newline at end of file diff --git a/style.css b/style.css index d35b9b1..afb7608 100644 --- a/style.css +++ b/style.css @@ -149,6 +149,7 @@ main header section { display: flex; flex-direction: row; justify-content: center; + align-items: center; gap: 15px; } -- 2.39.5 From 2de91ad8a3d25561a3543b0754abe1da8da708a6 Mon Sep 17 00:00:00 2001 From: antux18 Date: Sun, 31 Mar 2024 17:03:54 +0200 Subject: [PATCH 8/9] Corrections traductions. --- require/locales/en.php | 12 ++++++------ require/locales/fr.php | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/require/locales/en.php b/require/locales/en.php index 63eff91..dbef657 100644 --- a/require/locales/en.php +++ b/require/locales/en.php @@ -13,14 +13,14 @@ "article" => "Puzzle n°" ], "home" => [ - "subtitle" => "Welcome to the Citizen's journey !", - "message" => "Enter your team number to begin :", + "subtitle" => "Welcome to the Citizen's journey!", + "message" => "Enter your team number to begin:", "team" => "Team number...", "button" => "OK" ], "team_confirm" => [ "subtitle" => "Please make sure you selected the right team.", - "message" => "Your name must appear on the following list : ", + "message" => "Your name must appear on the following list: ", "button" => "Yes, this is my team !" ], "article" => [ @@ -30,13 +30,13 @@ "prev_but" => "🡰 Prev.", "next_but" => "Next 🡲", "qr_but" => "Scan QR code", - "cam_sel" => "Selected camera :", + "cam_sel" => "Selected camera:", "f_cam" => "Front camera", "r_cam" => "Rear camera" ], "puzzles" => [ - "message" => "Select a puzzle in the list below :", - "map_desc" => "Here is a map showing the location of the puzzles you already solved :" + "message" => "Select a puzzle in the list below:", + "map_desc" => "Here is a map showing the location of the puzzles you already solved:" ], "nav" => [ "title" => "Citizen's journey", diff --git a/require/locales/fr.php b/require/locales/fr.php index 620d390..be0fba4 100644 --- a/require/locales/fr.php +++ b/require/locales/fr.php @@ -1,19 +1,19 @@ [ - "home" => "Accueil - Parcours du citoyen", - "team_confirm" => "Confirmation du choix d'équipe - Parcours du citoyen", - "puzzles" => "Liste des énigmes - Parcours du citoyen", - "article" => "Énigme - Parcours du citoyen" + "home" => "Accueil - Parcours citoyen", + "team_confirm" => "Confirmation du choix d'équipe - Parcours citoyen", + "puzzles" => "Liste des énigmes - Parcours citoyen", + "article" => "Énigme - Parcours citoyen" ], "page_title" => [ - "home" => "Parcours du citoyen", + "home" => "Parcours citoyen", "team_confirm" => "Confirmation du choix d'équipe", "puzzles" => "Liste des puzzles pour l'équipe n°", "article" => "Énigme n°" ], "home" => [ - "subtitle" => "Bienvenue dans le Parcours du citoyen !", + "subtitle" => "Bienvenue dans le Parcours citoyen !", "message" => "Pour commencer, veuillez entrer le numéro de votre équipe :", "team" => "Numéro d'équipe...", "button" => "Valider" @@ -39,7 +39,7 @@ "map_desc" => "Voici la carte des emplacements des énigmes que vous avez résolues :" ], "nav" => [ - "title" => "Parcours du citoyen", + "title" => "Parcours citoyen", "home" => "Accueil" ], "footer" => [ -- 2.39.5 From 6e063e4ce18e3b6587de083cd47bc63dc7705047 Mon Sep 17 00:00:00 2001 From: antux18 Date: Sun, 31 Mar 2024 17:09:14 +0200 Subject: [PATCH 9/9] Modif gitignore. --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 45b2cea..78997a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ localhost-key.pem -localhost.pem \ No newline at end of file +localhost.pem +data/teams.db +data/article.db \ No newline at end of file -- 2.39.5