update config
[pharext/replicator.pharext.org] / public / html.php
1 <?php
2 const INCLUDED = __FILE__;
3 const NCURRENT = 2;
4 require_once "index.php";
5
6 ob_start($res);
7 $res->addHeader("Link", "<".dirname((new http\Env\Url)->path)."concise/css/concise.min.css>; rel=preload; as=style");
8
9 ?>
10 <!doctype html>
11 <html>
12 <head>
13 <meta charset="utf-8">
14 <title>Replicator</title>
15 <link rel="stylesheet" href="concise/css/concise.min.css">
16 <link href="//fonts.googleapis.com/css?family=Droid+Sans" rel="stylesheet" type="text/css">
17 <meta name="viewport" content="width=device-width, initial-scale=1">
18 <style>
19 body {
20 padding-bottom: 2em;
21 padding-top: 7em;
22 }
23 .header {
24 top: 0;
25 width: 100%;
26 }
27 .footer {
28 bottom: 0;
29 width: 100%;
30 text-align: center;
31 font-size: .9em;
32 }
33 .header, .footer {
34 position: fixed;
35 box-shadow: 0px 0px .8em .4em #89a;
36 background: #62B3E7;
37 padding: .5em 0;
38 }
39 .header h1 {
40 font-weight: bold;
41 }
42 .header h1 a, .footer a:hover {
43 text-decoration: none;
44 }
45 .header h1 a:hover {
46 text-decoration: underline;
47 }
48 .header h1 a {
49 /* normalize browser difference */
50 font-size: 1.3em;
51 }
52 .header h1 a, .footer, .footer a {
53 color: #fdfdfd;
54 text-shadow: grey 0 0 .1em;
55 }
56 .header h1 small {
57 color: #666;
58 font-size: 1.3rem;
59 text-shadow: white 0 0 .2em;
60 }
61 li {
62 list-style-type: circle;
63 }
64 pre.publickey {
65 font-size: .8rem;
66 line-height: 1rem;
67 }
68 pre.code {
69 background: #333;
70 color: #62B3E7;
71 padding: 0 1.5em 1.5em 1em;
72 border-radius: 4px;
73 margin-right: 2em;
74 display: inline-block;
75 }
76 pre.code>code {
77 font-size: .9rem;
78 }
79 .row>h3 {
80 margin-bottom: 0;
81 }
82 @media(max-width: 80em) {
83 .column-8 {
84 float: none;
85 width: auto;
86 }
87 }
88 .old-version, #new-toggle {
89 display: none;
90 }
91 </style>
92 </head>
93 <body>
94 <div class="header">
95 <header>
96 <h1 class="container">
97 <a href="?">Replicator</a><br>
98 <small>Replicating PECL releases as pharext packages since 2015</small>
99 </h1>
100 <a href="https://github.com/m6w6/replicator"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
101 </header>
102 </div>
103 <div class="container">
104
105 <?php if (!empty($package)) : $versions = package_versions($package); ?>
106
107 <h2><?= htmlspecialchars($package) ?></h2>
108 <table class="table table-full versions">
109 <thead>
110 <tr>
111 <th class="text-left" colspan="2">Package</th>
112 <th class="text-left" colspan="<?= count(SIGS) ?>">Signatures</th>
113 <th class="text-left">Date</th>
114 <th class="text-right">Pharext</th>
115 </tr>
116 </thead>
117 <tbody>
118
119 <?php $i = 0; foreach (array_reverse($versions) as $version => $phars) : ++$i; ?>
120 <?php foreach (array_map("array_values", $phars) as $ext => list($phar, $date, $size, $pharext)) : ?>
121 <tr <?php if ($i > NCURRENT) : ?>class="old-version"<?php endif; ?> <?php if ($i === NCURRENT) : ?>id="old"<?php endif; ?>>
122 <?php if (empty($ext)) : ?>
123 <td class="text-left" rowspan="<?= count($phars) ?>">
124 <?= htmlspecialchars($package) ?>
125 <?= htmlspecialchars($version) ?>
126 </td>
127 <?php endif ?>
128
129 <td class="text-left">
130 &#10507;&nbsp;<a href="<?= htmlspecialchars($phar) ?>"
131 download>phar<?= htmlspecialchars($ext) ?></a>&nbsp;<small>(<?= human_size($size) ?>)</small><br>
132 </td>
133 <?php foreach (SIGS as $typ => $sig) : ?>
134 <td>
135 #&nbsp;<a href="<?= sigof($phar, $sig) ?>" download><?= "$typ.$sig" ?></a>
136 </td>
137 <?php endforeach; ?>
138 <td class="text-left">
139 <?= human_date($date); ?>
140
141 </td>
142 <td class="text-right <?= version_compare($pharext, "3.0.1", "<") ? "color-red":"" ?>">
143 v<?= $pharext ?>
144 </td>
145 </tr>
146 <?php endforeach; ?>
147 <?php endforeach; ?>
148
149 </tbody>
150 </table>
151 <?php if ($i >= 3) : ?>
152 <p class="small">
153 <a id="old-toggle" href="#old" onclick="toggleOldVersions(this)">Show
154 <?=count($versions)-NCURRENT?> older version(s) &raquo;</a>
155 <a id="new-toggle" href="#" onclick="toggleOldVersions(this)">Show
156 less versions &laquo;</a>
157 </p>
158 <?php endif; ?>
159 <?php else: ?>
160
161 <h2>Available Packages</h2>
162 <ul class="list-inline">
163 <?php foreach (array_map("htmlspecialchars", $packages) as $index => $pkg) : ?>
164 <?php $next = strtolower($pkg{0}); ?>
165 <?php if (isset($prev) && $next != $prev) : ?>
166
167 </ul>
168 <ul class="list-inline">
169 <?php endif; ?>
170
171 <li><a href="?<?= $pkg ?>"><?= $pkg ?></a></li>
172 <?php $prev = $next; ?>
173 <?php endforeach; ?>
174
175 </ul>
176 <?php endif; ?>
177 <hr>
178 <div class="row">
179 <?php if (empty($package)) : ?>
180 <h3>Public keys</h3>
181 <?php else : list($phar) = array_values(current(end($versions))); ?>
182 <h3>Download latest version and signatures:</h3>
183 <div class="column-16">
184 <pre class="code fit-code"><code>
185 curl -sS \
186 -O https://replicator.pharext.org/<?= htmlspecialchars($phar) ?><?php foreach (SIGS as $sig) : ?> \
187 -O https://replicator.pharext.org/<?= htmlspecialchars(sigof($phar, $sig)) ?><?php endforeach; ?></code></pre>
188 </div>
189 </div>
190 <div class="row">
191 <h3>Verify with a public key:</h3>
192 <?php endif; ?>
193
194 <div class="column-8">
195 <h4>RSA <small><a href="replicator.pub" download>replicator.pub</a></small></h4>
196 <?php if (!empty($phar)) : ?>
197 <pre class="code"><code>
198 curl -sSO https://replicator.pharext.org/replicator.pub
199
200 openssl dgst \
201 -verify replicator.pub \
202 -signature <?= htmlspecialchars(basename($phar)).".sig" ?> \
203 <?= htmlspecialchars(basename($phar)) ?></code></pre>
204 <?php endif; ?>
205 <pre class="publickey"><?php readfile("./replicator.pub") ?></pre>
206 </div>
207 <div class="column-8">
208 <h4>OpenPGP <small><a href="4093AEF6.pub" download>4093AEF6.pub</a></small></h4>
209 <?php if (!empty($phar)) : ?>
210 <pre class="code"><code>
211 curl -sSO https://replicator.pharext.org/4093AEF6.pub
212
213 gpg --import 4093AEF6.pub
214
215 gpg --verify <?= htmlspecialchars(basename($phar)).".asc" ?> \
216 <?= htmlspecialchars(basename($phar)) ?></code></pre>
217 <?php endif; ?>
218 <pre class="publickey"><?php readfile("./4093AEF6.pub") ?></pre>
219 </div>
220 </div>
221 </div>
222 <div class="footer">
223 <footer>
224 &copy; 2015 <a href="https://m6w6.name">m6w6</a>, Michael Wallner &mdash; Powered by <a href="//github.com/m6w6/pharext">pharext
225 <?php
226 require_once "../vendor/autoload.php";
227 printf("v%s\n", pharext\Metadata::version());
228 ?>
229 </a>
230 </footer>
231 </div>
232 <script type="text/javascript">
233 function toggleOldVersions(a) {
234 var nodes, row_style;
235
236 if (a.hash.substring(1) === "old") {
237 row_style = "table-row";
238 document.getElementById("old-toggle").style.display = "none";
239 document.getElementById("new-toggle").style.display = "inline";
240 } else {
241 row_style = "none";
242 document.getElementById("old-toggle").style.display = "inline";
243 document.getElementById("new-toggle").style.display = "none";
244 }
245
246 nodes = document.querySelectorAll("table.versions>tbody>tr.old-version");
247
248 for (var i = 0; i < nodes.length; ++i) {
249 nodes.item(i).style.display = row_style;
250 }
251 }
252 </script>
253 </body>
254 </html>
255 <?php
256 $res->send();
257 ?>