Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-09-02 15:41:13 +0200
committerErich Eckner <git@eckner.net>2019-09-02 15:41:13 +0200
commitdc902e4d1cbb1229c7ee7f01b03427d39305492e (patch)
tree4a8ec4db5751cb0b28e293d360368e0f8e988c97
parent833379e7d4c586c25b3d87cb6e7b3eb8bd7a0f96 (diff)
keys.php: print number of available fingerprints
-rw-r--r--keys.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/keys.php b/keys.php
index 08263ae..42d9c01 100644
--- a/keys.php
+++ b/keys.php
@@ -2,17 +2,21 @@
require_once "init.php";
-if (!array_key_exists('k', $_GET))
+if (!array_key_exists('k', $_GET)) {
+ print 'There are ' . shell_exec('gpg --list-keys --with-colons | grep "^fpr:" | cut -d: -f10 | wc -l') . ' keys on this server.';
die();
+}
if (preg_match('/^[0-9A-Fa-f]{16,40}$/', $_GET['k']) !== 1)
die();
$output = shell_exec('gpg -a --export ' . $_GET['k']);
print $output;
-if (empty($output)) {
- $fh = fopen('key-wishlist', 'a');
- if ($fh !== false) {
- fwrite($fh, $_GET['k'] . "\n");
- fclose($fh);
- }
+
+if (! empty($output))
+ die();
+
+$fh = fopen('key-wishlist', 'a');
+if ($fh !== false) {
+ fwrite($fh, $_GET['k'] . "\n");
+ fclose($fh);
}