Avoid double slashes in notification email body
[aur.git] / web / template / pkgbase_details.php
blobb8d36ed98d0b5b8080929f572938e3d54e107c67
1 <?php
2 $uid = uid_from_sid($SID);
4 $base_id = intval($row['ID']);
6 $catarr = pkgbase_categories();
8 $submitter = username_from_id($row["SubmitterUID"]);
9 $maintainer = username_from_id($row["MaintainerUID"]);
10 $packager = username_from_id($row["PackagerUID"]);
12 $votes = $row['NumVotes'];
14 # In case of wanting to put a custom message
15 $msg = __('unknown');
17 # Print the timestamps for last updates
18 $updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["ModifiedTS"]));
19 $submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
20 $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
22 $package_url = config_get('options', 'package_url');
23 $urlpath = $package_url . substr($row['Name'], 0, 2) . "/" . $row['Name'];
25 $pkgs = pkgbase_get_pkgnames($base_id);
27 <div id="pkgdetails" class="box">
28 <h2><?= __('Package Base Details') . ': ' . htmlspecialchars($row['Name']) ?></h2>
29 <div id="detailslinks" class="listing">
30 <div id="actionlist">
31 <h4><?= __('Package Actions') ?></h4>
32 <ul class="small">
33 <li><a href="<?= $urlpath ?>/PKGBUILD"><?= __('View PKGBUILD') ?></a></li>
34 <li><a href="<?= $urlpath . '/' . $row['Name'] ?>.tar.gz"><?= __('Download tarball') ?></a></li>
35 <li><a href="https://wiki.archlinux.org/index.php/Special:Search?search=<?= urlencode($row['Name']) ?>"><?= __('Search wiki') ?></a></li>
36 <li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
37 <?php if ($uid): ?>
38 <?php if ($row["OutOfDateTS"] === NULL): ?>
39 <li>
40 <form action="<?= get_pkgbase_uri($row['Name']) . 'flag/'; ?>" method="post">
41 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
42 <input type="submit" class="button text-button" name="do_Flag" value="<?= __('Flag package out-of-date') ?>" />
43 </form>
44 </li>
45 <?php elseif (($row["OutOfDateTS"] !== NULL) && has_credential(CRED_PKGBASE_UNFLAG, array($row["MaintainerUID"]))): ?>
46 <li>
47 <form action="<?= get_pkgbase_uri($row['Name']) . 'unflag/'; ?>" method="post">
48 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
49 <input type="submit" class="button text-button" name="do_UnFlag" value="<?= __('Unflag package') ?>" />
50 </form>
51 </li>
52 <?php endif; ?>
53 <?php if (pkgbase_user_voted($uid, $base_id)): ?>
54 <li>
55 <form action="<?= get_pkgbase_uri($row['Name']) . 'unvote/'; ?>" method="post">
56 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
57 <input type="submit" class="button text-button" name="do_UnVote" value="<?= __('Remove vote') ?>" />
58 </form>
59 </li>
60 <?php else: ?>
61 <li>
62 <form action="<?= get_pkgbase_uri($row['Name']) . 'vote/'; ?>" method="post">
63 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
64 <input type="submit" class="button text-button" name="do_Vote" value="<?= __('Vote for this package') ?>" />
65 </form>
66 </li>
67 <?php endif; ?>
68 <?php if (pkgbase_user_notify($uid, $base_id)): ?>
69 <li>
70 <form action="<?= get_pkgbase_uri($row['Name']) . 'unnotify/'; ?>" method="post">
71 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
72 <input type="submit" class="button text-button" name="do_UnNotify" value="<?= __('Disable notifications') ?>" />
73 </form>
74 </li>
75 <?php else: ?>
76 <li>
77 <form action="<?= get_pkgbase_uri($row['Name']) . 'notify/'; ?>" method="post">
78 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
79 <input type="submit" class="button text-button" name="do_Notify" value="<?= __('Notify of new comments') ?>" />
80 </form>
81 </li>
82 <?php endif; ?>
83 <li><span class="flagged"><?php if ($row["RequestCount"] > 0) { echo _n('%d pending request', '%d pending requests', $row["RequestCount"]); } ?></span></li>
84 <li><a href="<?= get_pkgbase_uri($row['Name']) . 'request/'; ?>"><?= __('File Request'); ?></a></li>
85 <?php if (has_credential(CRED_PKGBASE_DELETE)): ?>
86 <li><a href="<?= get_pkgbase_uri($row['Name']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
87 <li><a href="<?= get_pkgbase_uri($row['Name']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
88 <?php endif; ?>
89 <?php endif; ?>
91 <?php if ($uid && $row["MaintainerUID"] === NULL): ?>
92 <li>
93 <form action="<?= get_pkgbase_uri($row['Name']) . 'adopt/'; ?>" method="post">
94 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
95 <input type="submit" class="button text-button" name="do_Adopt" value="<?= __('Adopt Package') ?>" />
96 </form>
97 </li>
98 <?php elseif (has_credential(CRED_PKGBASE_DISOWN, array($row["MaintainerUID"]))): ?>
99 <li>
100 <form action="<?= get_pkgbase_uri($row['Name']) . 'disown/'; ?>" method="post">
101 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
102 <input type="submit" class="button text-button" name="do_Disown" value="<?= __('Disown Package') ?>" />
103 </form>
104 </li>
105 <?php endif; ?>
106 </ul>
107 </div>
108 </div>
110 <table id="pkginfo">
111 <tr>
112 <th><?= __('Category') . ': ' ?></th>
113 <?php
114 if (has_credential(CRED_PKGBASE_CHANGE_CATEGORY, array($row["MaintainerUID"]))):
116 <td>
117 <form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['Name']), ENT_QUOTES); ?>">
118 <div>
119 <input type="hidden" name="action" value="do_ChangeCategory" />
120 <?php if ($SID): ?>
121 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
122 <?php endif; ?>
123 <select name="category_id">
124 <?php
125 foreach ($catarr as $cid => $catname):
127 <option value="<?= $cid ?>"<?php if ($cid == $row["CategoryID"]) { ?> selected="selected" <?php } ?>><?= $catname ?></option>
128 <?php endforeach; ?>
129 </select>
130 <input type="submit" value="<?= __('Change category') ?>"/>
131 </div>
132 </form>
133 <?php else: ?>
134 <td>
135 <a href="<?= get_uri('/packages/'); ?>?C=<?= $row['CategoryID'] ?>"><?= $row['Category'] ?></a>
136 <?php endif; ?>
137 </td>
138 </tr>
139 <tr>
140 <th><?= __('Submitter') .': ' ?></th>
141 <?php if ($row["SubmitterUID"] && $SID): ?>
142 <td><a href="<?= get_uri('/account/') . html_format_username($submitter, ENT_QUOTES) ?>" title="<?= __('View account information for %s', html_format_username($submitter)) ?>"><?= html_format_username($submitter) ?></a></td>
143 <?php elseif ($row["SubmitterUID"] && !$SID): ?>
144 <td><?= html_format_username($submitter) ?></td>
145 <?php else: ?>
146 <td><?= __('None') ?></td>
147 <?php endif; ?>
148 </tr>
149 <tr>
150 <th><?= __('Maintainer') .': ' ?></th>
151 <?php if ($row["MaintainerUID"] && $SID): ?>
152 <td><a href="<?= get_uri('/account/') . html_format_username($maintainer) ?>" title="<?= __('View account information for %s', html_format_username($maintainer)) ?>"><?= html_format_username($maintainer) ?></a></td>
153 <?php elseif ($row["MaintainerUID"] && !$SID): ?>
154 <td><?= html_format_username($maintainer) ?></td>
155 <?php else: ?>
156 <td><?= __('None') ?></td>
157 <?php endif; ?>
158 </tr>
159 <tr>
160 <th><?= __('Last Packager') .': ' ?></th>
161 <?php if ($row["PackagerUID"] && $SID): ?>
162 <td><a href="<?= get_uri('/account/') . html_format_username($packager) ?>" title="<?= __('View account information for %s', html_format_username($packager)) ?>"><?= html_format_username($packager) ?></a></td>
163 <?php elseif ($row["PackagerUID"] && !$SID): ?>
164 <td><?= html_format_username($packager) ?></td>
165 <?php else: ?>
166 <td><?= __('None') ?></td>
167 <?php endif; ?>
168 </tr>
169 <tr>
170 <th><?= __('Votes') . ': ' ?></th>
171 <?php if (has_credential(CRED_PKGBASE_LIST_VOTERS)): ?>
172 <td><a href="<?= get_pkgbase_uri($row['Name']); ?>voters/"><?= $votes ?></a></td>
173 <?php else: ?>
174 <td><?= $votes ?></td>
175 <?php endif; ?>
176 </tr>
177 <tr>
178 <th><?= __('First Submitted') . ': ' ?></th>
179 <td><?= $submitted_time ?></td>
180 </tr>
181 <tr>
182 <th><?= __('Last Updated') . ': ' ?></th>
183 <td><?= $updated_time ?></td>
184 </tr>
185 </table>
187 <div id="metadata">
188 <div id="pkgs" class="listing">
189 <h3><?= __('Packages') . " (" . count($pkgs) . ")"?></h3>
190 <?php if (count($pkgs) > 0): ?>
191 <ul>
192 <?php
193 while (list($k, $pkg) = each($pkgs)):
195 <li><a href="<?= htmlspecialchars(get_pkg_uri($pkg), ENT_QUOTES); ?>" title="<?= __('View packages details for').' '. htmlspecialchars($pkg) ?>"><?= htmlspecialchars($pkg) ?></a></li>
196 <?php endwhile; ?>
197 </ul>
198 <?php endif; ?>
199 </div>
200 </div>
201 </div>