summaryrefslogtreecommitdiff
path: root/buildmaster/gpg-keys.php
blob: ed33418e5f7ad49750c895a1d548d271d123fc7f (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
require_once "../init.php";
require_once BASE . "/lib/mysql.php";
require_once BASE . "/lib/http.php";

  if (array_key_exists('fp', $_GET)) {
    $result = mysql_run_query(
      "SELECT" .
      " `gpg_keys`.`fingerprint`," .
      "`gpg_keys`.`public_key`" .
      " FROM `gpg_keys`" .
      " WHERE `gpg_keys`.`fingerprint`=from_base64(\"" . base64_encode(strtoupper($_GET['fp'])) . "\")"
    );
    if ($result -> num_rows == 0)
      throw_http_error(400, 'Key not found');
    $result = $result -> fetch_assoc();
    print "<html>\n";
    print "  <head>\n";
    print "    <title>\n";
    print "      Archlinux 32 Key Server -- Get \"" . $result['fingerprint'] . "\"\n";
    print "    </title>\n";
    print "    <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n";
    print "  </head>\n";
    print "  <body>\n";
    print "    <h1>Archlinux 32 Key Server -- Get \"" . $result['fingerprint'] . "\"</h1>\n";
    print "    <pre>\n";
    print $result['public_key'] . "\n";
    print "    </pre>\n";
    print "  </body>\n";
    print "</html>\n";
    die();
  };

  $result = mysql_run_query(
    "SELECT" .
    " GROUP_CONCAT(`email_actions`.`name`) AS `action`," .
    "`persons`.`name` AS `person`," .
    "`gpg_keys`.`fingerprint`" .
    " FROM `email_actions`" .
    mysql_join_email_actions_allowed_email_actions() .
    " RIGHT" . mysql_join_allowed_email_actions_gpg_keys() .
    mysql_join_gpg_keys_persons() .
    " GROUP BY `gpg_keys`.`id`" .
    " ORDER BY `persons`.`name`"
  );

?>
<html>
  <head>
    <title>list of gpg-keys</title>
  </head>
  <body>
<?php
show_warning_on_offline_slave();

  print "<table border=1>\n";
  if ($result->num_rows > 0) {
    print "<tr><th>person</th><th>action</th><th>fingerprint</th></tr>\n";
    while ($row = $result -> fetch_assoc()) {
      foreach ($row as $key => $value) {
        if ($value=="") {
          $row[$key]="&nbsp;";
        }
      }
      print "<tr>";
      print "<td>" . $row["person"] . "</td>";
      print "<td>" . $row["action"] . "</td>";
      print "<td><a href=\"?fp=" .
        $row["fingerprint"] .
        "\">" . $row["fingerprint"] . "</a></td>";
      print "</tr>\n";
    }
  }
  print "</table>\n";

?>
</body></html>