X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=public%2Findex.php;h=c1679805116d98cbe270fd0deac31b8c5a02df2d;hb=ca28cc374dadf2ba786ccca8a6e4fc824458ccae;hp=08e85131e8897d99ef7e431cb475b6072a7860f7;hpb=920838364f437f686b2de6e210ad846f85a67128;p=pharext%2Freplicator.pharext.org diff --git a/public/index.php b/public/index.php index 08e8513..c167980 100644 --- a/public/index.php +++ b/public/index.php @@ -5,6 +5,7 @@ use http\Env\Response; use http\Header; const UNITS = ["Bytes", "KB", "MB"]; +const SIGS = ["rsa" => "sig", "gpg" => "asc"]; function human_size($s) { $l = floor(log10($s)); @@ -28,6 +29,10 @@ function human_date($t) { return gmdate("Y-m-d", $t); } +function sigof($phar, $typ) { + return str_replace("phars/", "sigs/", $phar) . ".$typ"; +} + function package_versions($package) { $versions = []; foreach (glob("phars/$package/*.ext.phar*") as $phar) { @@ -40,10 +45,15 @@ function package_versions($package) { $release = substr($name, strlen($package)+1); } + foreach (SIGS as $sigtyp => $sigext) { + if (file_exists($sigdat = sigof($phar, $sigext))) { + $sigs[$sigtyp] = $sigdat; + } + } $size = filesize($phar); $date = isset($meta["date"]) ? strtotime($meta["date"]) : filemtime($phar); $pharext = isset($meta["version"]) ? $meta["version"] : "2.0.1"; - $versions[$release][$enc] = compact("phar", "date", "size", "pharext"); + $versions[$release][$enc] = compact("phar", "date", "size", "pharext", "sigs"); uksort($versions[$release], function($a, $b) { $al = strlen($a); $bl = strlen($b); @@ -73,4 +83,4 @@ if (!defined("INCLUDED")) { $neg = "html"; } include_once "$neg.php"; -} \ No newline at end of file +}