files: Fix ordering

This commit is contained in:
2024-08-13 15:55:41 +02:00
parent 0dd23c5980
commit 702fa64aa8

View File

@ -50,8 +50,10 @@ if (sizeof($info) > 1 && ($info[1] === 'elwig' || $info[1] === 'winziprint')) {
exit(); exit();
} }
$filesRaw = scandir('.');
usort($filesRaw, 'version_compare');
$files = []; $files = [];
foreach (scandir('.') as $file) { foreach ($filesRaw as $file) {
if (str_starts_with($file, ".") || str_ends_with($file, ".php")) continue; if (str_starts_with($file, ".") || str_ends_with($file, ".php")) continue;
$files[$file] = [filesize($file), filemtime($file), filectime($file)]; $files[$file] = [filesize($file), filemtime($file), filectime($file)];
} }
@ -149,7 +151,7 @@ if ($format === 'json') {
<h3>Downloads</h3> <h3>Downloads</h3>
<p class="center"><a href="/">Startseite</a></p> <p class="center"><a href="/">Startseite</a></p>
<table> <table>
<thead><tr><th>Name</th><th>Größe</th><th>Änderungsdatum</th></tr></thead> <thead><tr><th class="center">Name</th><th class="center">Größe</th><th class="center">Änderungsdatum</th></tr></thead>
<tbody> <tbody>
<?php foreach (array_reverse($entities) as $name => [$prod, $vers, $url, $size, $mtime, $ctime, $mod, $cre]) { <?php foreach (array_reverse($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><td>" . date('d.m.Y, H:i', $mtime) . "</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";