use http\Header;
const UNITS = ["Bytes", "KB", "MB"];
+const SIGS = ["rsa" => "sig", "gpg" => "asc"];
function human_size($s) {
$l = floor(log10($s));
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) {
$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);
return $versions;
}
+function package_info($package) {
+ if (($xml = simplexml_load_file("phars/$package/info.xml"))) {
+ return [
+ "title" => (string) $xml->s,
+ "description" => (string) $xml->d,
+ "license" => (string) $xml->l
+ ];
+ }
+}
+
$packages = array_map("basename", glob("phars/*", GLOB_NOSORT|GLOB_ONLYDIR));
sort($packages, SORT_NATURAL|SORT_FLAG_CASE);
$neg = "html";
}
include_once "$neg.php";
-}
\ No newline at end of file
+}