summaryrefslogtreecommitdiff
path: root/buildmaster/gpg-keys.php
blob: a279ac55475f84c68703b8d775586876edb0df8d (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
78
79
<?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` ORDER BY `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`"
  );

  print "<html>\n";
  print "  <head>\n";
  print "    <title>list of gpg-keys</title>\n";
  print "  </head>\n";
  print "  <body>\n";

  show_warning_on_offline_slave();

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