files: Update table and version parsing
This commit is contained in:
@ -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>
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
date_default_timezone_set('Europe/Vienna');
|
||||
|
||||
function get_fmt(): string {
|
||||
$fmt = _get_fmt();
|
||||
if ($fmt === 'ascii') {
|
||||
|
@ -2,4 +2,7 @@
|
||||
html {
|
||||
font-family: 'Arial', sans-serif;
|
||||
}
|
||||
|
||||
|
||||
table td {
|
||||
padding: 0.125em 0.5em;
|
||||
}
|
||||
|
Reference in New Issue
Block a user