files: Update table and version parsing
This commit is contained in:
@ -47,12 +47,16 @@ foreach ($files as $name => [$size, $mtime, $ctime]) {
|
|||||||
$cre
|
$cre
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$versions = [];
|
|
||||||
if ($getVers === 'latest') {
|
if ($getVers === 'latest') {
|
||||||
|
$versions = [];
|
||||||
foreach ($entities as $name => [$prod, $vers, $url, $size, $mtime, $ctime, $mod, $cre]) {
|
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) {
|
$entities = array_filter($entities, function($e) {
|
||||||
global $getProd;
|
global $getProd;
|
||||||
global $getVers;
|
global $getVers;
|
||||||
@ -85,10 +89,10 @@ if ($format === 'json') {
|
|||||||
require "../header.inc"; ?>
|
require "../header.inc"; ?>
|
||||||
<h1>Downloads</h1>
|
<h1>Downloads</h1>
|
||||||
<table>
|
<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>
|
<tbody>
|
||||||
<?php foreach ($entities as $name => [$prod, $vers, $url, $size, $mtime, $ctime, $mod, $cre]) {
|
<?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>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
date_default_timezone_set('Europe/Vienna');
|
||||||
|
|
||||||
function get_fmt(): string {
|
function get_fmt(): string {
|
||||||
$fmt = _get_fmt();
|
$fmt = _get_fmt();
|
||||||
if ($fmt === 'ascii') {
|
if ($fmt === 'ascii') {
|
||||||
|
@ -3,3 +3,6 @@ html {
|
|||||||
font-family: 'Arial', sans-serif;
|
font-family: 'Arial', sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table td {
|
||||||
|
padding: 0.125em 0.5em;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user