Add a packager field to packages
[aur.git] / web / template / pkg_details.php
blob12aa6924a45902f8e17d2ad638e52da821d060e2
1 <?php
2 $atype = account_from_sid($SID);
3 $uid = uid_from_sid($SID);
5 $pkgid = intval($row['ID']);
6 $base_id = intval($row['BaseID']);
8 $catarr = pkgbase_categories();
10 $submitter = username_from_id($row["SubmitterUID"]);
11 $maintainer = username_from_id($row["MaintainerUID"]);
12 $packager = username_from_id($row["PackagerUID"]);
14 $votes = $row['NumVotes'];
16 # In case of wanting to put a custom message
17 $msg = __('unknown');
18 $license = empty($row['License']) ? $msg : $row['License'];
20 # Print the timestamps for last updates
21 $updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["ModifiedTS"]));
22 $submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
23 $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
25 $urlpath = URL_DIR . substr($row['BaseName'], 0, 2) . "/" . $row['BaseName'];
27 $lics = pkg_licenses($row["ID"]);
28 $grps = pkg_groups($row["ID"]);
30 $deps = pkg_dependencies($row["ID"]);
31 $requiredby = pkg_required($row["Name"]);
33 $rels = pkg_relations($row["ID"]);
34 $rels_c = $rels_p = $rels_r = array();
35 foreach ($rels as $rel) {
36 switch ($rel[1]) {
37 case "conflicts":
38 $rels_c[] = $rel;
39 break;
40 case "provides":
41 $rels_p[] = $rel;
42 break;
43 case "replaces":
44 $rels_r[] = $rel;
45 break;
49 # $sources[0] = 'src';
50 $sources = pkg_sources($row["ID"]);
52 <div id="pkgdetails" class="box">
53 <h2><?= __('Package Details') . ': ' . htmlspecialchars($row['Name']) . ' ' . htmlspecialchars($row['Version']) ?></h2>
54 <div id="detailslinks" class="listing">
55 <div id="actionlist">
56 <h4><?= __('Package Actions') ?></h4>
57 <ul class="small">
58 <li><a href="<?= $urlpath ?>/PKGBUILD"><?= __('View PKGBUILD') ?></a></li>
59 <li><a href="<?= $urlpath . '/' . $row['BaseName'] ?>.tar.gz"><?= __('Download tarball') ?></a></li>
60 <li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
61 <?php if ($USE_VIRTUAL_URLS && $uid): ?>
62 <?php if ($row["OutOfDateTS"] === NULL): ?>
63 <li>
64 <form action="<?= get_pkgbase_uri($row['BaseName']) . 'flag/'; ?>" method="post">
65 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
66 <input type="submit" class="button text-button" name="do_Flag" value="<?= __('Flag package out-of-date') ?>" />
67 </form>
68 </li>
69 <?php elseif (($row["OutOfDateTS"] !== NULL) &&
70 ($uid == $row["MaintainerUID"] || $atype == "Trusted User" || $atype == "Developer")): ?>
71 <li>
72 <form action="<?= get_pkgbase_uri($row['BaseName']) . 'unflag/'; ?>" method="post">
73 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
74 <input type="submit" class="button text-button" name="do_UnFlag" value="<?= __('Unflag package') ?>" />
75 </form>
76 </li>
77 <?php endif; ?>
78 <?php if (pkgbase_user_voted($uid, $base_id)): ?>
79 <li>
80 <form action="<?= get_pkgbase_uri($row['BaseName']) . 'unvote/'; ?>" method="post">
81 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
82 <input type="submit" class="button text-button" name="do_UnVote" value="<?= __('Remove vote') ?>" />
83 </form>
84 </li>
85 <?php else: ?>
86 <li>
87 <form action="<?= get_pkgbase_uri($row['BaseName']) . 'vote/'; ?>" method="post">
88 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
89 <input type="submit" class="button text-button" name="do_Vote" value="<?= __('Vote for this package') ?>" />
90 </form>
91 </li>
92 <?php endif; ?>
93 <?php if (pkgbase_user_notify($uid, $base_id)): ?>
94 <li>
95 <form action="<?= get_pkgbase_uri($row['BaseName']) . 'unnotify/'; ?>" method="post">
96 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
97 <input type="submit" class="button text-button" name="do_UnNotify" value="<?= __('Disable notifications') ?>" />
98 </form>
99 </li>
100 <?php else: ?>
101 <li>
102 <form action="<?= get_pkgbase_uri($row['BaseName']) . 'notify/'; ?>" method="post">
103 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
104 <input type="submit" class="button text-button" name="do_Notify" value="<?= __('Notify of new comments') ?>" />
105 </form>
106 </li>
107 <?php endif; ?>
108 <?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
109 <li><a href="<?= get_pkgbase_uri($row['BaseName']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
110 <li><a href="<?= get_pkgbase_uri($row['BaseName']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
111 <?php endif; ?>
112 <?php endif; ?>
114 <?php if ($uid && $row["MaintainerUID"] === NULL): ?>
115 <li>
116 <form action="<?= get_pkgbase_uri($row['BaseName']) . 'adopt/'; ?>" method="post">
117 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
118 <input type="submit" class="button text-button" name="do_Adopt" value="<?= __('Adopt Package') ?>" />
119 </form>
120 </li>
121 <?php elseif ($uid && $uid == $row["MaintainerUID"] ||
122 $atype == "Trusted User" || $atype == "Developer"): ?>
123 <li>
124 <form action="<?= get_pkgbase_uri($row['BaseName']) . 'disown/'; ?>" method="post">
125 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
126 <input type="submit" class="button text-button" name="do_Disown" value="<?= __('Disown Package') ?>" />
127 </form>
128 </li>
129 <?php endif; ?>
130 </ul>
131 </div>
132 </div>
134 <table id="pkginfo">
135 <tr>
136 <th><?= __('Package Base') . ': ' ?></th>
137 <td class="wrap"><a href="<?= htmlspecialchars(get_pkgbase_uri($row['BaseName']), ENT_QUOTES); ?>"><?= htmlspecialchars($row['BaseName']); ?></a></td>
138 </tr>
139 <tr>
140 <th><?= __('Description') . ': ' ?></th>
141 <td class="wrap"><?= htmlspecialchars($row['Description']); ?></td>
142 </tr>
143 <tr>
144 <th><?= __('Upstream URL') . ': ' ?></th>
145 <td><a href="<?= htmlspecialchars($row['URL'], ENT_QUOTES) ?>" title="<?= __('Visit the website for') . ' ' . htmlspecialchars( $row['Name'])?>"><?= htmlspecialchars($row['URL'], ENT_QUOTES) ?></a></td>
146 </tr>
147 <tr>
148 <th><?= __('Category') . ': ' ?></th>
149 <?php
150 if ($SID && ($uid == $row["MaintainerUID"] ||
151 ($atype == "Developer" || $atype == "Trusted User"))):
153 <td>
154 <form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['BaseName']), ENT_QUOTES); ?>">
155 <div>
156 <input type="hidden" name="action" value="do_ChangeCategory" />
157 <?php if ($SID): ?>
158 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
159 <?php endif; ?>
160 <select name="category_id">
161 <?php
162 foreach ($catarr as $cid => $catname):
164 <option value="<?= $cid ?>"<?php if ($cid == $row["CategoryID"]) { ?> selected="selected" <?php } ?>><?= $catname ?></option>
165 <?php endforeach; ?>
166 </select>
167 <input type="submit" value="<?= __('Change category') ?>"/>
168 </div>
169 </form>
170 <?php else: ?>
171 <td>
172 <a href="<?= get_uri('/packages/'); ?>?C=<?= $row['CategoryID'] ?>"><?= $row['Category'] ?></a>
173 <?php endif; ?>
174 </td>
175 </tr>
176 <?php if (count($lics) > 0): ?>
177 <tr>
178 <th><?= __('Licenses') . ': ' ?></th>
179 <td class="wrap">
180 <?php foreach($lics as $lic): ?>
181 <span class="related">
182 <?php if ($lic !== end($lics)): ?>
183 <?= htmlspecialchars($lic) ?>,
184 <?php else: ?>
185 <?= htmlspecialchars($lic) ?>
186 <?php endif; ?>
187 </span>
188 <?php endforeach; ?>
189 </td>
190 </tr>
191 <?php endif; ?>
192 <?php if (count($grps) > 0): ?>
193 <tr>
194 <th><?= __('Groups') . ': ' ?></th>
195 <td class="wrap">
196 <?php foreach($grps as $grp): ?>
197 <span class="related">
198 <?php if ($grp !== end($grps)): ?>
199 <?= htmlspecialchars($grp) ?>,
200 <?php else: ?>
201 <?= htmlspecialchars($grp) ?>
202 <?php endif; ?>
203 </span>
204 <?php endforeach; ?>
205 </td>
206 </tr>
207 <?php endif; ?>
208 <?php if (count($rels_c) > 0): ?>
209 <tr>
210 <th><?= __('Conflicts') . ': ' ?></th>
211 <td class="wrap relatedto">
212 <?php foreach($rels_c as $rarr): ?>
213 <span class="related">
214 <?php if ($rarr !== end($rels_c)): ?>
215 <?= htmlspecialchars($rarr[0]) ?>,
216 <?php else: ?>
217 <?= htmlspecialchars($rarr[0]) ?>
218 <?php endif; ?>
219 </span>
220 <?php endforeach; ?>
221 </td>
222 </tr>
223 <?php endif; ?>
224 <?php if (count($rels_p) > 0): ?>
225 <tr>
226 <th><?= __('Provides') . ': ' ?></th>
227 <td class="wrap relatedto">
228 <?php foreach($rels_p as $rarr): ?>
229 <span class="related">
230 <?php if ($rarr !== end($rels_p)): ?>
231 <?= htmlspecialchars($rarr[0]) ?>,
232 <?php else: ?>
233 <?= htmlspecialchars($rarr[0]) ?>
234 <?php endif; ?>
235 </span>
236 <?php endforeach; ?>
237 </td>
238 </tr>
239 <?php endif; ?>
240 <?php if (count($rels_r) > 0): ?>
241 <tr>
242 <th><?= __('Replaces') . ': ' ?></th>
243 <td class="wrap relatedto">
244 <?php foreach($rels_r as $rarr): ?>
245 <span class="related">
246 <?php if ($rarr !== end($rels_r)): ?>
247 <?= htmlspecialchars($rarr[0]) ?>,
248 <?php else: ?>
249 <?= htmlspecialchars($rarr[0]) ?>
250 <?php endif; ?>
251 </span>
252 <?php endforeach; ?>
253 </td>
254 </tr>
255 <?php endif; ?>
256 <tr>
257 <th><?= __('Submitter') .': ' ?></th>
258 <?php
259 if ($row["SubmitterUID"]):
260 if ($SID):
261 if (!$USE_VIRTUAL_URLS):
263 <td><a href="<?= get_uri('/account/'); ?>?Action=AccountInfo&amp;ID=<?= htmlspecialchars($row['SubmitterUID'], ENT_QUOTES) ?>" title="<?= __('View account information for')?> <?= htmlspecialchars($submitter) ?>"><?= htmlspecialchars($submitter) ?></a></td>
264 <?php else: ?>
265 <td><a href="<?= get_uri('/account/') . htmlspecialchars($submitter, ENT_QUOTES) ?>" title="<?= __('View account information for %s', htmlspecialchars($submitter)) ?>"><?= htmlspecialchars($submitter) ?></a></td>
266 <?php endif; ?>
267 <?php else: ?>
268 <td><?= htmlspecialchars($submitter) ?></td>
269 <?php endif; ?>
270 <?php else: ?>
271 <td><?= __('None') ?></td>
272 <?php endif; ?>
273 </tr>
274 <tr>
275 <th><?= __('Maintainer') .': ' ?></th>
276 <?php
277 if ($row["MaintainerUID"]):
278 if ($SID):
279 if (!$USE_VIRTUAL_URLS):
281 <td><a href="<?= get_uri('/account/'); ?>?Action=AccountInfo&amp;ID=<?= htmlspecialchars($row['MaintainerUID'], ENT_QUOTES) ?>" title="<?= __('View account information for')?> <?= htmlspecialchars($maintainer) ?>"><?= htmlspecialchars($maintainer) ?></a></td>
282 <?php else: ?>
283 <td><a href="<?= get_uri('/account/') . htmlspecialchars($maintainer, ENT_QUOTES) ?>" title="<?= __('View account information for %s', htmlspecialchars($maintainer)) ?>"><?= htmlspecialchars($maintainer) ?></a></td>
284 <?php endif; ?>
285 <?php else: ?>
286 <td><?= htmlspecialchars($maintainer) ?></td>
287 <?php endif; ?>
288 <?php else: ?>
289 <td><?= __('None') ?></td>
290 <?php endif; ?>
291 </tr>
292 <tr>
293 <th><?= __('Last Packager') .': ' ?></th>
294 <?php
295 if ($row["PackagerUID"]):
296 if ($SID):
297 if (!$USE_VIRTUAL_URLS):
299 <td><a href="<?= get_uri('/account/'); ?>?Action=AccountInfo&amp;ID=<?= htmlspecialchars($row['PackagerUID'], ENT_QUOTES) ?>" title="<?= __('View account information for')?> <?= htmlspecialchars($packager) ?>"><?= htmlspecialchars($packager) ?></a></td>
300 <?php else: ?>
301 <td><a href="<?= get_uri('/account/') . htmlspecialchars($packager, ENT_QUOTES) ?>" title="<?= __('View account information for %s', htmlspecialchars($packager)) ?>"><?= htmlspecialchars($packager) ?></a></td>
302 <?php endif; ?>
303 <?php else: ?>
304 <td><?= htmlspecialchars($packager) ?></td>
305 <?php endif; ?>
306 <?php else: ?>
307 <td><?= __('None') ?></td>
308 <?php endif; ?>
309 </tr>
310 <tr>
311 <th><?= __('Votes') . ': ' ?></th>
312 <?php if ($atype == "Developer" || $atype == "Trusted User"): ?>
313 <?php if ($USE_VIRTUAL_URLS): ?>
314 <td><a href="<?= get_pkgbase_uri($row['BaseName']); ?>voters/"><?= $votes ?></a></td>
315 <?php else: ?>
316 <td><a href="<?= get_uri('/voters/'); ?>?N=<?= htmlspecialchars($row['BaseName'], ENT_QUOTES) ?>"><?= $votes ?></a></td>
317 <?php endif; ?>
318 <?php else: ?>
319 <td><?= $votes ?></td>
320 <?php endif; ?>
321 </tr>
322 <tr>
323 <th><?= __('First Submitted') . ': ' ?></th>
324 <td><?= $submitted_time ?></td>
325 </tr>
326 <tr>
327 <th><?= __('Last Updated') . ': ' ?></th>
328 <td><?= $updated_time ?></td>
329 </tr>
330 </table>
332 <div id="metadata">
333 <div id="pkgdeps" class="listing">
334 <h3><?= __('Dependencies') . " (" . count($deps) . ")"?></h3>
335 <?php if (count($deps) > 0): ?>
336 <ul id="pkgdepslist">
337 <?php while (list($k, $darr) = each($deps)): ?>
338 <li><?= pkg_depend_link($darr[0], $darr[1], $darr[2], $darr[3]); ?></li>
339 <?php endwhile; ?>
340 </ul>
341 <?php endif; ?>
342 </div>
343 <div id="pkgreqs" class="listing">
344 <h3><?= __('Required by') . " (" . count($requiredby) . ")"?></h3>
345 <?php if (count($requiredby) > 0): ?>
346 <ul id="pkgreqslist">
347 <?php
348 # darr: (PackageName, PackageID)
349 while (list($k, $darr) = each($requiredby)):
351 <li><a href="<?= htmlspecialchars(get_pkg_uri($darr[0]), ENT_QUOTES); ?>" title="<?= __('View packages details for').' ' . htmlspecialchars($darr[0]) ?>"><?= htmlspecialchars($darr[0]) ?></a></li>
352 <?php endwhile; ?>
353 </ul>
354 <?php endif; ?>
355 </div>
356 <div id="pkgfiles" class="listing">
357 <h3><?= __('Sources') ?></h3>
358 </div>
359 <?php if (count($sources) > 0): ?>
360 <div>
361 <ul>
362 <?php
363 while (list($k, $src) = each($sources)):
364 $src = explode('::', $src);
365 $parsed_url = parse_url($src[0]);
367 # It is an external source
368 if (isset($parsed_url['scheme']) || isset($src[1])):
370 <li><a href="<?= htmlspecialchars((isset($src[1]) ? $src[1] : $src[0]), ENT_QUOTES) ?>"><?= htmlspecialchars($src[0]) ?> </a></li>
371 <?php
372 else:
373 # It is presumably an internal source
374 $src = $src[0];
376 <li><?= htmlspecialchars($src) ?></li>
377 <?php endif; ?>
378 <?php endwhile; ?>
379 </ul>
380 </div>
381 <?php endif; ?>
382 </div>
383 </div>