files: Update table and version parsing

This commit is contained in:
2024-01-29 15:23:36 +01:00
parent c15952d063
commit 9a31364d88
3 changed files with 14 additions and 5 deletions

View File

@ -47,12 +47,16 @@ foreach ($files as $name => [$size, $mtime, $ctime]) {
$cre
];
}
$versions = [];
if ($getVers === 'latest') {
$versions = [];
foreach ($entities as $name => [$prod, $vers, $url, $size, $mtime, $ctime, $mod, $cre]) {
$versions[$prod] = $vers;
if ($prod === $getProd) $versions[] = $vers;
}
usort($versions, 'version_compare');
$getVers = $versions[sizeof($versions) - 1];
}
$entities = array_filter($entities, function($e) {
global $getProd;
global $getVers;
@ -85,10 +89,10 @@ if ($format === 'json') {
require "../header.inc"; ?>
<h1>Downloads</h1>
<table>
<thead><tr><th>Name</th><th>Größe</th></tr></thead>
<thead><tr><th>Name</th><th>Größe</th><th>Änderungsdatum</th></tr></thead>
<tbody>
<?php foreach ($entities as $name => [$prod, $vers, $url, $size, $mtime, $ctime, $mod, $cre]) {
echo " <tr><td><a href='files/$name'>$name</a></td><td>" . number_format($size / 1024 / 1024, 1) . " MB</td></tr>\n";
echo " <tr><td><a href='files/$name'>$name</a></td><td>" . number_format($size / 1024 / 1024, 1) . " MB</td><td>" . date('d.m.Y, H:i', $mtime) . "</td></tr>\n";
} ?>
</tbody>
</table>

View File

@ -1,5 +1,7 @@
<?php
date_default_timezone_set('Europe/Vienna');
function get_fmt(): string {
$fmt = _get_fmt();
if ($fmt === 'ascii') {

View File

@ -2,4 +2,7 @@
html {
font-family: 'Arial', sans-serif;
}
table td {
padding: 0.125em 0.5em;
}