summaryrefslogtreecommitdiffstats
path: root/web/template/pkg_details.php
diff options
context:
space:
mode:
Diffstat (limited to 'web/template/pkg_details.php')
-rw-r--r--web/template/pkg_details.php74
1 files changed, 21 insertions, 53 deletions
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
index 6864431f..e894c07e 100644
--- a/web/template/pkg_details.php
+++ b/web/template/pkg_details.php
@@ -83,6 +83,9 @@ foreach ($rels as $rel) {
# $sources[0] = 'src';
$sources = pkg_sources($row["ID"]);
+
+$base_uri = get_pkgbase_uri($row['BaseName']);
+
?>
<div id="pkgdetails" class="box">
<h2><?= __('Package Details') . ': ' . htmlspecialchars($row['Name']) . ' ' . htmlspecialchars($row['Version']) ?></h2>
@@ -99,75 +102,40 @@ $sources = pkg_sources($row["ID"]);
<li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
<?php if ($uid): ?>
<?php if ($row["OutOfDateTS"] === NULL): ?>
- <li>
- <form action="<?= get_pkgbase_uri($row['BaseName']) . 'flag/'; ?>" method="post">
- <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
- <input type="submit" class="button text-button" name="do_Flag" value="<?= __('Flag package out-of-date') ?>" />
- </form>
- </li>
+ <li><?= html_action_form($base_uri . 'flag/', "do_Flag", __('Flag package out-of-date')) ?></li>
<?php elseif (($row["OutOfDateTS"] !== NULL) && has_credential(CRED_PKGBASE_UNFLAG, $maintainers)): ?>
- <li>
- <form action="<?= get_pkgbase_uri($row['BaseName']) . 'unflag/'; ?>" method="post">
- <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
- <input type="submit" class="button text-button" name="do_UnFlag" value="<?= __('Unflag package') ?>" />
- </form>
- </li>
+ <li><?= html_action_form($base_uri . 'unflag/', "do_UnFlag", __('Unflag package')) ?></li>
<?php endif; ?>
+
<?php if (pkgbase_user_voted($uid, $base_id)): ?>
- <li>
- <form action="<?= get_pkgbase_uri($row['BaseName']) . 'unvote/'; ?>" method="post">
- <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
- <input type="submit" class="button text-button" name="do_UnVote" value="<?= __('Remove vote') ?>" />
- </form>
- </li>
+ <li><?= html_action_form($base_uri . 'unvote/', "do_UnVote", __('Remove vote')) ?></li>
<?php else: ?>
- <li>
- <form action="<?= get_pkgbase_uri($row['BaseName']) . 'vote/'; ?>" method="post">
- <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
- <input type="submit" class="button text-button" name="do_Vote" value="<?= __('Vote for this package') ?>" />
- </form>
- </li>
+ <li><?= html_action_form($base_uri . 'vote/', "do_Vote", __('Vote for this package')) ?></li>
<?php endif; ?>
+
<?php if (pkgbase_user_notify($uid, $base_id)): ?>
- <li>
- <form action="<?= get_pkgbase_uri($row['BaseName']) . 'unnotify/'; ?>" method="post">
- <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
- <input type="submit" class="button text-button" name="do_UnNotify" value="<?= __('Disable notifications') ?>" />
- </form>
- </li>
+ <li><?= html_action_form($base_uri . 'unnotify/', "do_UnNotify", __('Disable notifications')) ?></li>
<?php else: ?>
- <li>
- <form action="<?= get_pkgbase_uri($row['BaseName']) . 'notify/'; ?>" method="post">
- <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
- <input type="submit" class="button text-button" name="do_Notify" value="<?= __('Notify of new comments') ?>" />
- </form>
- </li>
+ <li><?= html_action_form($base_uri . 'notify/', "do_Notify", __('Notify of new comments')) ?></li>
<?php endif; ?>
+
<?php if (has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array($row["MaintainerUID"]))): ?>
- <li><a href="<?= get_pkgbase_uri($row['BaseName']) . 'comaintainers/'; ?>"><?= __('Manage Co-Maintainers'); ?></a></li>
+ <li><?= html_action_link($base_uri . 'comaintainers/', __('Manage Co-Maintainers')) ?></a></li>
<?php endif; ?>
+
<li><span class="flagged"><?php if ($row["RequestCount"] > 0) { echo _n('%d pending request', '%d pending requests', $row["RequestCount"]); } ?></span></li>
- <li><a href="<?= get_pkgbase_uri($row['BaseName']) . 'request/'; ?>"><?= __('File Request'); ?></a></li>
+ <li><?= html_action_link($base_uri . 'request/', __('File Request')) ?></a></li>
+
<?php if (has_credential(CRED_PKGBASE_DELETE)): ?>
- <li><a href="<?= get_pkgbase_uri($row['BaseName']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
- <li><a href="<?= get_pkgbase_uri($row['BaseName']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
- <?php endif; ?>
+ <li><?= html_action_link($base_uri . 'delete/', __('Delete Package')) ?></a></li>
+ <li><?= html_action_link($base_uri . 'merge/', __('Merge Package')) ?></a></li>
<?php endif; ?>
<?php if ($uid && $row["MaintainerUID"] === NULL): ?>
- <li>
- <form action="<?= get_pkgbase_uri($row['BaseName']) . 'adopt/'; ?>" method="post">
- <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
- <input type="submit" class="button text-button" name="do_Adopt" value="<?= __('Adopt Package') ?>" />
- </form>
- </li>
+ <li><?= html_action_form($base_uri . 'adopt/', "do_Adopt", __('Adopt Package')) ?></li>
<?php elseif (has_credential(CRED_PKGBASE_DISOWN, array($row["MaintainerUID"]))): ?>
- <li>
- <form action="<?= get_pkgbase_uri($row['BaseName']) . 'disown/'; ?>" method="post">
- <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
- <input type="submit" class="button text-button" name="do_Disown" value="<?= __('Disown Package') ?>" />
- </form>
- </li>
+ <li><?= html_action_form($base_uri . 'disown/', "do_Disown", __('Disown Package')) ?></li>
+ <?php endif; ?>
<?php endif; ?>
</ul>
</div>