Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/keys.php
blob: 6bf77b4142f246f0280814489927a44281ba0e94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

require_once "init.php";

if (!array_key_exists('k', $_GET)) {
  print
    'There are ' .
    trim(shell_exec('gpg --list-keys --with-colons | grep "^fpr:" | cut -d: -f10 | wc -l')) .
    ' keys on this server.<br>' .
    "\n";
  print
    'You can <a href="?k=' .
    trim(shell_exec('gpg --list-keys --with-colons deep42thought@archlinux32.org | grep -m1 "^fpr:" | cut -d: -f10')) .
    '">download</a> them.' . "\n";
  die();
}
if (preg_match('/^[0-9A-Fa-f]{16,40}$/', $_GET['k']) !== 1)
  die();

header('Content-Type: text/plain');
$output = shell_exec('gpg -a --export ' . $_GET['k']);
print $output;

if (! empty($output))
  die();

$fh = fopen('key-wishlist', 'a');
if ($fh !== false) {
  fwrite($fh, $_GET['k'] . "\n");
  fclose($fh);
}