aboutsummaryrefslogtreecommitdiff
path: root/includes/archive
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-08-08 12:04:30 +0200
committerMinteck <nekostarfan@gmail.com>2021-08-08 12:04:30 +0200
commit95112b1eb06a4be531ded59563d53a63a8d614e8 (patch)
treefd3dc676227309c87a39feab9ca458985e327907 /includes/archive
parent87303b0d3540037fb94efdde24dbaacb2880d6cb (diff)
downloadmain-95112b1eb06a4be531ded59563d53a63a8d614e8.tar.gz
main-95112b1eb06a4be531ded59563d53a63a8d614e8.tar.bz2
main-95112b1eb06a4be531ded59563d53a63a8d614e8.zip
Opening!
Diffstat (limited to 'includes/archive')
-rw-r--r--includes/archive/main.php62
1 files changed, 41 insertions, 21 deletions
diff --git a/includes/archive/main.php b/includes/archive/main.php
index 28cb438..593c161 100644
--- a/includes/archive/main.php
+++ b/includes/archive/main.php
@@ -1,22 +1,42 @@
-<p><?= l("Download the old of the oldest software I made", "Téléchargez les plus vieux des vieux logiciels que j'ai créé") ?>. <?= l("Some of this software is", "Certains de ces logiciels sont") ?> <u><?= l("proprietary", "propriétaires") ?></u> <?= l("and you can't change or distribute it without my consent", "et vous ne pouvez pas les modifier ou les distribuer sans mon accord") ?>. <?= l("Active projects are not listed here and can be downloaded from their respective page", "Les projets en cours de développement ne sont pas listés ici et peuvent être téléchargés sur leur page respective") ?>.</p>
-
-<div class="list-group">
- <?php
-
- $files = scandir($_SERVER['DOCUMENT_ROOT'] . "/archive/get");
-
- foreach ($files as $file) {
- if (substr($file, -5) === ".json" && file_exists($_SERVER['DOCUMENT_ROOT'] . "/archive/get/" . substr($file, 0, -5) . ".zip")) {
- $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/archive/get/" . $file), true);
- echo('<a href="/archive/get/'.substr($file, 0, -5).'.zip" class="list-group-item list-group-item-action"><span class="badge bg-secondary rounded-pill">'.$data['date'].'</span> '.$data['title']);
- if ($data['unreleased']) {
- echo(' <span class="badge bg-warning">' . l("Unreleased", "Jamais sorti") . '</span>');
- }
- echo('</a>');
- }
- }
-
- ?>
-</div>
-<br>
+<p><?= l("Download the old of the oldest software I made", "Téléchargez les plus vieux des vieux logiciels que j'ai créé") ?>. <?= l("Some of this software is", "Certains de ces logiciels sont") ?> <u><?= l("proprietary", "propriétaires") ?></u> <?= l("and you can't change or distribute it without my consent", "et vous ne pouvez pas les modifier ou les distribuer sans mon accord") ?>. <?= l("Active projects are not listed here and can be downloaded from their respective page", "Les projets en cours de développement ne sont pas listés ici et peuvent être téléchargés sur leur page respective") ?>.</p>
+
+<div class="list-group">
+ <?php
+
+ $pfiles = scandir($_SERVER['DOCUMENT_ROOT'] . "/archive/get");
+ $files = [];
+
+ foreach ($pfiles as $file) {
+ if ($file !== "." && $file !== ".." && substr($file, -5) === ".json") {
+ $files[$file] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/archive/get/" . $file), true);
+
+ $parts = explode("/", $files[$file]["date"]);
+ $files[$file]["rawdate"] = $parts[1] . "-" . $parts[0];
+ $files[$file]["id"] = $file;
+ }
+ }
+
+ usort($files, function($a, $b) {
+ return strtoupper($a['rawdate']) <=> strtoupper($b['rawdate']);
+ });
+
+ foreach ($files as $data) {
+ $file = $data["id"];
+
+ if (substr($file, -5) === ".json" && file_exists($_SERVER['DOCUMENT_ROOT'] . "/archive/get/" . substr($file, 0, -5) . ".zip")) {
+ echo('<a href="/archive/get/'.substr($file, 0, -5).'.zip" class="list-group-item list-group-item-action"><img src="'.(trim(file_exists($_SERVER['DOCUMENT_ROOT'] . "/static/archives/" . substr($file, 0, -5) . ".png") ? "/static/archives/" . substr($file, 0, -5) . ".png" : "/static/genericProjectIcon.png")).'" alt="" width="24px"> '.$data['title'] . ' ');
+ if (isset($data["description"])) {
+ echo('<span class="text-muted"> · ' . l($data["description"]["en"], $data["description"]["fr"]) . '</span>');
+ }
+ echo('<span class="badge bg-secondary rounded-pill" style="float:right;">'.$data['date'].'</span>');
+ if ($data['unreleased']) {
+ echo(' <span class="badge bg-warning">' . l("Unreleased", "Jamais sorti") . '</span>');
+ }
+ echo('</a>');
+ }
+ }
+
+ ?>
+</div>
+<br>
<small><p class="text-muted"><?= l("Project start dates are estimated and cannot always be accurate", "Les dates de début des projets sont des estimations et ne peuvent pas être toujours précises") ?></p></small> \ No newline at end of file