show package info
[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 .package-description {
92 white-space: pre-line;
93 }
94 </style>
95 </head>
96 <body>
97 <div class="header">
98 <header>
99 <h1 class="container">
100 <a href="?">Replicator</a><br>
101 <small>Replicating PECL releases as pharext packages since 2015</small>
102 </h1>
103 <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>
104 </header>
105 </div>
106 <div class="container">
107
108 <?php if (!empty($package)) : $versions = package_versions($package); $info = package_info($package); ?>
109
110 <h2><?= htmlspecialchars($package) ?></h2>
111 <?php if ($info) : ?>
112 <h3><?= htmlspecialchars($info["title"]) ?><br>
113 <small>License: <?= htmlspecialchars($info["license"]) ?></small></h3>
114 <p class="package-description"><?= htmlspecialchars($info["description"]) ?></p>
115 <?php endif; ?>
116 <table class="table table-full versions">
117 <thead>
118 <tr>
119 <th class="text-left" colspan="2">Package</th>
120 <th class="text-left" colspan="<?= count(SIGS) ?>">Signatures</th>
121 <th class="text-left">Date</th>
122 <th class="text-right">Pharext</th>
123 </tr>
124 </thead>
125 <tbody>
126
127 <?php $i = 0; foreach (array_reverse($versions) as $version => $phars) : ++$i; ?>
128 <?php foreach (array_map("array_values", $phars) as $ext => list($phar, $date, $size, $pharext)) : ?>
129 <tr <?php if ($i > NCURRENT) : ?>class="old-version"<?php endif; ?> <?php if ($i === NCURRENT) : ?>id="old"<?php endif; ?>>
130 <?php if (empty($ext)) : ?>
131 <td class="text-left" rowspan="<?= count($phars) ?>">
132 <?= htmlspecialchars($package) ?>
133 <?= htmlspecialchars($version) ?>
134 </td>
135 <?php endif ?>
136
137 <td class="text-left">
138 &#10507;&nbsp;<a href="<?= htmlspecialchars($phar) ?>"
139 download>phar<?= htmlspecialchars($ext) ?></a>&nbsp;<small>(<?= human_size($size) ?>)</small><br>
140 </td>
141 <?php foreach (SIGS as $typ => $sig) : ?>
142 <td>
143 #&nbsp;<a href="<?= sigof($phar, $sig) ?>" download><?= "$typ.$sig" ?></a>
144 </td>
145 <?php endforeach; ?>
146 <td class="text-left">
147 <?= human_date($date); ?>
148
149 </td>
150 <td class="text-right <?= version_compare($pharext, "3.0.1", "<") ? "color-red":"" ?>">
151 v<?= $pharext ?>
152 </td>
153 </tr>
154 <?php endforeach; ?>
155 <?php endforeach; ?>
156
157 </tbody>
158 </table>
159 <?php if ($i >= 3) : ?>
160 <p class="small">
161 <a id="old-toggle" href="#old" onclick="toggleOldVersions(this)">Show
162 <?=count($versions)-NCURRENT?> older version(s) &raquo;</a>
163 <a id="new-toggle" href="#" onclick="toggleOldVersions(this)">Show
164 less versions &laquo;</a>
165 </p>
166 <?php endif; ?>
167 <?php else: ?>
168
169 <h2>Available Packages</h2>
170 <ul class="list-inline">
171 <?php foreach (array_map("htmlspecialchars", $packages) as $index => $pkg) : ?>
172 <?php $next = strtolower($pkg{0}); ?>
173 <?php if (isset($prev) && $next != $prev) : ?>
174
175 </ul>
176 <ul class="list-inline">
177 <?php endif; ?>
178
179 <li><a href="?<?= $pkg ?>"><?= $pkg ?></a></li>
180 <?php $prev = $next; ?>
181 <?php endforeach; ?>
182
183 </ul>
184 <?php endif; ?>
185 <hr>
186 <div class="row">
187 <?php if (empty($package)) : ?>
188 <h3>Public keys</h3>
189 <?php else : list($phar) = array_values(current(end($versions))); ?>
190 <h3>Download latest version and signatures:</h3>
191 <div class="column-16">
192 <pre class="code fit-code"><code>
193 curl -sS \
194 -O https://replicator.pharext.org/<?= htmlspecialchars($phar) ?><?php foreach (SIGS as $sig) : ?> \
195 -O https://replicator.pharext.org/<?= htmlspecialchars(sigof($phar, $sig)) ?><?php endforeach; ?></code></pre>
196 </div>
197 </div>
198 <div class="row">
199 <h3>Verify with a public key:</h3>
200 <?php endif; ?>
201
202 <div class="column-8">
203 <h4>RSA <small><a href="replicator.pub" download>replicator.pub</a></small></h4>
204 <?php if (!empty($phar)) : ?>
205 <pre class="code"><code>
206 curl -sSO https://replicator.pharext.org/replicator.pub
207
208 openssl dgst \
209 -verify replicator.pub \
210 -signature <?= htmlspecialchars(basename($phar)).".sig" ?> \
211 <?= htmlspecialchars(basename($phar)) ?></code></pre>
212 <?php endif; ?>
213 <pre class="publickey"><?php readfile("./replicator.pub") ?></pre>
214 </div>
215 <div class="column-8">
216 <h4>OpenPGP <small><a href="4093AEF6.pub" download>4093AEF6.pub</a></small></h4>
217 <?php if (!empty($phar)) : ?>
218 <pre class="code"><code>
219 curl -sSO https://replicator.pharext.org/4093AEF6.pub
220
221 gpg --import 4093AEF6.pub
222
223 gpg --verify <?= htmlspecialchars(basename($phar)).".asc" ?> \
224 <?= htmlspecialchars(basename($phar)) ?></code></pre>
225 <?php endif; ?>
226 <pre class="publickey"><?php readfile("./4093AEF6.pub") ?></pre>
227 </div>
228 </div>
229 </div>
230 <div class="footer">
231 <footer>
232 &copy; 2015 <a href="https://m6w6.name">m6w6</a>, Michael Wallner &mdash; Powered by <a href="//github.com/m6w6/pharext">pharext
233 <?php
234 require_once "../vendor/autoload.php";
235 printf("v%s\n", pharext\Metadata::version());
236 ?>
237 </a>
238 </footer>
239 </div>
240 <script type="text/javascript">
241 function toggleOldVersions(a) {
242 var nodes, row_style;
243
244 if (a.hash.substring(1) === "old") {
245 row_style = "table-row";
246 document.getElementById("old-toggle").style.display = "none";
247 document.getElementById("new-toggle").style.display = "inline";
248 } else {
249 row_style = "none";
250 document.getElementById("old-toggle").style.display = "inline";
251 document.getElementById("new-toggle").style.display = "none";
252 }
253
254 nodes = document.querySelectorAll("table.versions>tbody>tr.old-version");
255
256 for (var i = 0; i < nodes.length; ++i) {
257 nodes.item(i).style.display = row_style;
258 }
259 }
260 </script>
261 </body>
262 </html>
263 <?php
264 $res->send();
265 ?>