Commit f4613442 authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

Move package actions to package bases



Package actions now operate on package bases instead of packages. Move
all actions to the correct locations.

This also fixes some issues with comment notifications.

Signed-off-by: default avatarLukas Fleischer <archlinux@cryptocrack.de>
parent c1c77836
......@@ -20,6 +20,22 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
include "./404.php";
return;
}
}
include get_route('/' . $tokens[1]);
} elseif (!empty($tokens[1]) && '/' . $tokens[1] == get_pkgbase_route()) {
if (!empty($tokens[2])) {
/* TODO: Create a proper data structure to pass variables from
* the routing framework to the individual pages instead of
* initializing arbitrary variables here. */
$pkgbase_name = $tokens[2];
$base_id = pkgbase_from_name($pkgbase_name);
if (!$base_id) {
header("HTTP/1.0 404 Not Found");
include "./404.php";
return;
}
if (!empty($tokens[3])) {
/* TODO: Remove support for legacy URIs and move these
......@@ -65,23 +81,7 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
return;
}
$_POST['IDs'] = array(pkgid_from_name($tokens[2]) => '1');
}
}
include get_route('/' . $tokens[1]);
} elseif (!empty($tokens[1]) && '/' . $tokens[1] == get_pkgbase_route()) {
if (!empty($tokens[2])) {
/* TODO: Create a proper data structure to pass variables from
* the routing framework to the individual pages instead of
* initializing arbitrary variables here. */
$pkgbase_name = $tokens[2];
$base_id = pkgbase_from_name($pkgbase_name);
if (!$base_id) {
header("HTTP/1.0 404 Not Found");
include "./404.php";
return;
$_POST['IDs'] = array(pkgbase_from_name($tokens[2]) => '1');
}
}
......
......@@ -42,77 +42,6 @@ if (isset($_COOKIE["AURSID"])) {
$atype = "";
}
# Grab the list of Package IDs to be operated on
$ids = array();
if (isset($_POST['IDs'])) {
foreach ($_POST['IDs'] as $id => $i) {
$id = intval($id);
if ($id > 0) {
$ids[] = $id;
}
}
}
# Determine what action to do
$ret = false;
$output = "";
if (check_token()) {
if (current_action("do_Flag")) {
list($ret, $output) = pkg_flag($atype, $ids);
} elseif (current_action("do_UnFlag")) {
list($ret, $output) = pkg_unflag($atype, $ids);
} elseif (current_action("do_Adopt")) {
list($ret, $output) = pkg_adopt($atype, $ids, true);
} elseif (current_action("do_Disown")) {
list($ret, $output) = pkg_adopt($atype, $ids, false);
} elseif (current_action("do_Vote")) {
list($ret, $output) = pkg_vote($atype, $ids, true);
} elseif (current_action("do_UnVote")) {
list($ret, $output) = pkg_vote($atype, $ids, false);
} elseif (current_action("do_Delete")) {
if (isset($_POST['confirm_Delete'])) {
if (!isset($_POST['merge_Into']) || empty($_POST['merge_Into'])) {
list($ret, $output) = pkg_delete($atype, pkgbase_from_pkgid($ids), NULL);
unset($_GET['ID']);
}
else {
$merge_base_id = pkgbase_from_name($_POST['merge_Into']);
if ($merge_base_id) {
list($ret, $output) = pkg_delete($atype, pkgbase_from_pkgid($ids), $merge_base_id);
unset($_GET['ID']);
}
else {
$output = __("Cannot find package to merge votes and comments into.");
}
}
}
else {
$output = __("The selected packages have not been deleted, check the confirmation checkbox.");
}
} elseif (current_action("do_Notify")) {
list($ret, $output) = pkg_notify($atype, $ids);
} elseif (current_action("do_UnNotify")) {
list($ret, $output) = pkg_notify($atype, $ids, false);
} elseif (current_action("do_DeleteComment")) {
list($ret, $output) = pkg_delete_comment($atype);
} elseif (current_action("do_ChangeCategory")) {
list($ret, $output) = pkg_change_category($pkgid, $atype);
}
if (isset($_REQUEST['comment'])) {
$uid = uid_from_sid($_COOKIE["AURSID"]);
add_package_comment($pkgid, $uid, $_REQUEST['comment']);
$ret = true;
}
if ($ret) {
/* Redirect back to package page on success. */
header('Location: ' . get_pkg_uri($pkgname));
exit();
}
}
# Get package details after package actions have been attempted, FS#34508
$details = array();
if (isset($pkgname)) {
$details = get_package_details($pkgid);
......@@ -121,10 +50,6 @@ if (isset($pkgname)) {
html_header($title, $details);
?>
<?php if ($output): ?>
<p class="pkgoutput"><?= $output ?></p>
<?php endif; ?>
<?php
if (isset($pkgid)) {
include('pkg_search_form.php');
......
......@@ -22,7 +22,7 @@ if (!isset($base_id) || !isset($pkgbase_name)) {
unset($base_id, $pkgbase_name);
}
if ($base_id == 0 || $base_id == NULL || $pkgbase_name == NULL) {
if (isset($base_id) && ($base_id == 0 || $base_id == NULL || $pkgbase_name == NULL)) {
header("HTTP/1.0 404 Not Found");
include "./404.php";
return;
......@@ -39,10 +39,90 @@ if (isset($_COOKIE["AURSID"])) {
$atype = "";
}
/* Grab the list of package base IDs to be operated on. */
$ids = array();
if (isset($_POST['IDs'])) {
foreach ($_POST['IDs'] as $id => $i) {
$id = intval($id);
if ($id > 0) {
$ids[] = $id;
}
}
}
/* Perform package base actions. */
$ret = false;
$output = "";
if (check_token()) {
if (current_action("do_Flag")) {
list($ret, $output) = pkg_flag($atype, $ids);
} elseif (current_action("do_UnFlag")) {
list($ret, $output) = pkg_unflag($atype, $ids);
} elseif (current_action("do_Adopt")) {
list($ret, $output) = pkg_adopt($atype, $ids, true);
} elseif (current_action("do_Disown")) {
list($ret, $output) = pkg_adopt($atype, $ids, false);
} elseif (current_action("do_Vote")) {
list($ret, $output) = pkg_vote($atype, $ids, true);
} elseif (current_action("do_UnVote")) {
list($ret, $output) = pkg_vote($atype, $ids, false);
} elseif (current_action("do_Delete")) {
if (isset($_POST['confirm_Delete'])) {
if (!isset($_POST['merge_Into']) || empty($_POST['merge_Into'])) {
list($ret, $output) = pkg_delete($atype, $ids, NULL);
unset($_GET['ID']);
}
else {
$merge_base_id = pkgbase_from_name($_POST['merge_Into']);
if ($merge_base_id) {
list($ret, $output) = pkg_delete($atype, $ids, $merge_base_id);
unset($_GET['ID']);
}
else {
$output = __("Cannot find package to merge votes and comments into.");
}
}
}
else {
$output = __("The selected packages have not been deleted, check the confirmation checkbox.");
}
} elseif (current_action("do_Notify")) {
list($ret, $output) = pkg_notify($atype, $ids);
} elseif (current_action("do_UnNotify")) {
list($ret, $output) = pkg_notify($atype, $ids, false);
} elseif (current_action("do_DeleteComment")) {
list($ret, $output) = pkg_delete_comment($atype);
} elseif (current_action("do_ChangeCategory")) {
list($ret, $output) = pkg_change_category($base_id, $atype);
}
if (isset($_REQUEST['comment'])) {
$uid = uid_from_sid($_COOKIE["AURSID"]);
add_package_comment($base_id, $uid, $_REQUEST['comment']);
$ret = true;
}
if ($ret) {
if (isset($base_id)) {
/* Redirect back to package base page on success. */
header('Location: ' . get_pkgbase_uri($pkgbase_name));
exit();
} else {
/* Redirect back to package search page. */
header('Location: ' . get_pkg_route());
exit();
}
}
}
$details = get_pkgbase_details($base_id);
html_header($title, $details);
?>
<?php if ($output): ?>
<p class="pkgoutput"><?= $output ?></p>
<?php endif; ?>
<?php
include('pkg_search_form.php');
if (isset($_COOKIE["AURSID"])) {
......
......@@ -18,17 +18,17 @@ if (isset($_COOKIE["AURSID"])) {
if ($atype == "Trusted User" || $atype == "Developer"): ?>
<div class="box">
<h2><?= __('Delete Package: %s', htmlspecialchars($pkgname)) ?></h2>
<h2><?= __('Delete Package: %s', htmlspecialchars($pkgbase_name)) ?></h2>
<p>
<?= __('Use this form to delete the package (%s%s%s) from the AUR. ',
'<strong>', htmlspecialchars($pkgname), '</strong>'); ?>
'<strong>', htmlspecialchars($pkgbase_name), '</strong>'); ?>
<?= __('Deletion of a package is permanent. '); ?>
<?= __('Select the checkbox to confirm action.') ?>
</p>
<form action="<?= get_uri('/packages/'); ?>" method="post">
<form action="<?= get_uri('/pkgbase/'); ?>" method="post">
<fieldset>
<input type="hidden" name="IDs[<?= $pkgid ?>]" value="1" />
<input type="hidden" name="ID" value="<?= $pkgid ?>" />
<input type="hidden" name="IDs[<?= $base_id ?>]" value="1" />
<input type="hidden" name="ID" value="<?= $base_id ?>" />
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
<p><input type="checkbox" name="confirm_Delete" value="1" />
<?= __("Confirm package deletion") ?></p>
......
......@@ -18,18 +18,18 @@ if (isset($_COOKIE["AURSID"])) {
if ($atype == "Trusted User" || $atype == "Developer"): ?>
<div class="box">
<h2><?= __('Merge Package: %s', htmlspecialchars($pkgname)) ?></h2>
<h2><?= __('Merge Package: %s', htmlspecialchars($pkgbase_name)) ?></h2>
<p>
<?= __('Use this form to merge the package (%s%s%s) into another package. ',
'<strong>', htmlspecialchars($pkgname), '</strong>'); ?>
'<strong>', htmlspecialchars($pkgbase_name), '</strong>'); ?>
<?= __('Once the package has been merged it cannot be reversed. '); ?>
<?= __('Enter the package name you wish to merge the package into. '); ?>
<?= __('Select the checkbox to confirm action.') ?>
</p>
<form action="<?= get_uri('/packages/'); ?>" method="post">
<form action="<?= get_uri('/pkgbase/'); ?>" method="post">
<fieldset>
<input type="hidden" name="IDs[<?= $pkgid ?>]" value="1" />
<input type="hidden" name="ID" value="<?= $pkgid ?>" />
<input type="hidden" name="IDs[<?= $base_id ?>]" value="1" />
<input type="hidden" name="ID" value="<?= $base_id ?>" />
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
<p><label for="merge_Into" ><?= __("Merge into:") ?></label>
<input type="text" id="merge_Into" name="merge_Into" /></p>
......
......@@ -500,6 +500,9 @@ function display_package_details($id=0, $row, $SID="") {
print "<p>" . $row['error'] . "</p>\n";
}
else {
$base_id = pkgbase_from_pkgid($id);
$pkgbase_name = pkgbase_name_from_id($base_id);
include('pkg_details.php');
if ($SID) {
......@@ -507,7 +510,6 @@ function display_package_details($id=0, $row, $SID="") {
include('pkg_comment_form.php');
}
$base_id = pkgbase_from_pkgid($id);
$comments = package_comments($base_id);
if (!empty($comments)) {
include('pkg_comments.php');
......@@ -536,6 +538,8 @@ function display_pkgbase_details($base_id, $row, $SID="") {
print "<p>" . $row['error'] . "</p>\n";
}
else {
$pkgbase_name = pkgbase_name_from_id($base_id);
include('pkgbase_details.php');
if ($SID) {
......@@ -641,7 +645,8 @@ function pkg_search_page($SID="") {
$q_select .= "Users.Username AS Maintainer,
PackageCategories.Category,
Packages.Name, Packages.Version, Packages.Description,
PackageBases.NumVotes, Packages.ID, PackageBases.OutOfDateTS ";
PackageBases.NumVotes, Packages.ID, Packages.PackageBaseID,
PackageBases.OutOfDateTS ";
$q_from = "FROM Packages
LEFT JOIN PackageBases ON (PackageBases.ID = Packages.PackageBaseID)
......@@ -941,20 +946,19 @@ function pkgbase_maintainer_uid($base_id) {
*
* @global string $AUR_LOCATION The AUR's URL used for notification e-mails
* @param string $atype Account type, output of account_from_sid
* @param array $ids Array of package IDs to flag/unflag
* @param array $base_ids Array of package base IDs to flag/unflag
*
* @return array Tuple of success/failure indicator and error message
*/
function pkg_flag($atype, $ids) {
function pkg_flag($atype, $base_ids) {
global $AUR_LOCATION;
if (!$atype) {
return array(false, __("You must be logged in before you can flag packages."));
}
$ids = sanitize_ids($ids);
$base_ids = pkgbase_from_pkgid($ids);
if (empty($ids)) {
$base_ids = pkgbase_from_pkgid($base_ids);
if (empty($base_ids)) {
return array(false, __("You did not select any packages to flag."));
}
......@@ -972,10 +976,10 @@ function pkg_flag($atype, $ids) {
$f_name = username_from_sid($_COOKIE['AURSID']);
$f_email = email_from_sid($_COOKIE['AURSID']);
$f_uid = uid_from_sid($_COOKIE['AURSID']);
$q = "SELECT Packages.Name, Users.Email, Packages.ID ";
$q.= "FROM Packages, Users ";
$q.= "WHERE Packages.ID IN (" . implode(",", $ids) .") ";
$q.= "AND Users.ID = Packages.MaintainerUID ";
$q = "SELECT PackageBases.Name, Users.Email ";
$q.= "FROM PackageBases, Users ";
$q.= "WHERE PackageBases.ID IN (" . implode(",", $base_ids) .") ";
$q.= "AND Users.ID = PackageBases.MaintainerUID ";
$q.= "AND Users.ID != " . $f_uid;
$result = $dbh->query($q);
if ($result) {
......@@ -1000,18 +1004,17 @@ function pkg_flag($atype, $ids) {
* Unflag package(s) as out-of-date
*
* @param string $atype Account type, output of account_from_sid
* @param array $ids Array of package IDs to flag/unflag
* @param array $base_ids Array of package base IDs to flag/unflag
*
* @return array Tuple of success/failure indicator and error message
*/
function pkg_unflag($atype, $ids) {
function pkg_unflag($atype, $base_ids) {
if (!$atype) {
return array(false, __("You must be logged in before you can unflag packages."));
}
$ids = sanitize_ids($ids);
$base_ids = pkgbase_from_pkgid($ids);
if (empty($ids)) {
$base_ids = pkgbase_from_pkgid($base_ids);
if (empty($base_ids)) {
return array(false, __("You did not select any packages to unflag."));
}
......@@ -1144,12 +1147,12 @@ function pkg_delete ($atype, $base_ids, $merge_base_id) {
* Adopt or disown packages
*
* @param string $atype Account type, output of account_from_sid
* @param array $ids Array of package IDs to adopt/disown
* @param array $base_ids Array of package base IDs to adopt/disown
* @param bool $action Adopts if true, disowns if false. Adopts by default
*
* @return array Tuple of success/failure indicator and error message
*/
function pkg_adopt ($atype, $ids, $action=true) {
function pkg_adopt ($atype, $base_ids, $action=true) {
if (!$atype) {
if ($action) {
return array(false, __("You must be logged in before you can adopt packages."));
......@@ -1158,9 +1161,8 @@ function pkg_adopt ($atype, $ids, $action=true) {
}
}
$pkg_ids = sanitize_ids($ids);
$ids = pkgbase_from_pkgid($pkg_ids);
if (empty($ids)) {
$base_ids = sanitize_ids($base_ids);
if (empty($base_ids)) {
if ($action) {
return array(false, __("You did not select any packages to adopt."));
} else {
......@@ -1180,7 +1182,7 @@ function pkg_adopt ($atype, $ids, $action=true) {
}
$q.= "SET $field = $user ";
$q.= "WHERE ID IN (" . implode(",", $ids) . ") ";
$q.= "WHERE ID IN (" . implode(",", $base_ids) . ") ";
if ($action && $atype == "User") {
/* Regular users may only adopt orphan packages. */
......@@ -1203,12 +1205,12 @@ function pkg_adopt ($atype, $ids, $action=true) {
* Vote and un-vote for packages
*
* @param string $atype Account type, output of account_from_sid
* @param array $ids Array of package IDs to vote/un-vote
* @param array $base_ids Array of package base IDs to vote/un-vote
* @param bool $action Votes if true, un-votes if false. Votes by default
*
* @return array Tuple of success/failure indicator and error message
*/
function pkg_vote ($atype, $ids, $action=true) {
function pkg_vote ($atype, $base_ids, $action=true) {
if (!$atype) {
if ($action) {
return array(false, __("You must be logged in before you can vote for packages."));
......@@ -1217,9 +1219,8 @@ function pkg_vote ($atype, $ids, $action=true) {
}
}
$ids = sanitize_ids($ids);
$base_ids = pkgbase_from_pkgid($ids);
if (empty($ids)) {
$base_ids = sanitize_ids($base_ids);
if (empty($base_ids)) {
if ($action) {
return array(false, __("You did not select any packages to vote for."));
} else {
......@@ -1360,18 +1361,17 @@ function user_notify($uid, $base_id) {
* Toggle notification of packages
*
* @param string $atype Account type, output of account_from_sid
* @param array $ids Array of package IDs to toggle, formatted as $package_id
* @param array $base_ids Array of package base IDs to toggle
*
* @return array Tuple of success/failure indicator and error message
*/
function pkg_notify ($atype, $ids, $action=true) {
function pkg_notify ($atype, $base_ids, $action=true) {
if (!$atype) {
return;
}
$ids = sanitize_ids($ids);
$base_ids = pkgbase_from_pkgid($ids);
if (empty($ids)) {
$base_ids = sanitize_ids($base_ids);
if (empty($base_ids)) {
return array(false, __("Couldn't add to notification list."));
}
......
<div id="generic-form" class="box">
<h2><?= __("Add Comment"); ?></h2>
<form action="<?= get_pkg_uri($row['Name']) ?>" method="post">
<form action="<?= get_pkgbase_uri($pkgbase_name) ?>" method="post">
<fieldset>
<?php
if (isset($_REQUEST['comment']) && check_token()) {
......@@ -8,7 +8,7 @@ if (isset($_REQUEST['comment']) && check_token()) {
}
?>
<div>
<input type="hidden" name="ID" value="<?= intval($row['ID']) ?>" />
<input type="hidden" name="ID" value="<?= intval($base_id) ?>" />
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
</div>
<p>
......
......@@ -2,11 +2,10 @@
$uid = uid_from_sid($SID);
$base_id = pkgbase_from_pkgid($row['ID']);
$count = package_comments_count($base_id);
$pkgname = $row['Name'];
?>
<div id="news">
<h3>
<a href="<?= htmlentities(get_pkg_uri($pkgname), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= __('View all %s comments' , $count) ?>"><?= __('Latest Comments') ?></a>
<a href="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= __('View all %s comments' , $count) ?>"><?= __('Latest Comments') ?></a>
<span class="arrow"></span>
</h3>
......@@ -16,7 +15,7 @@ $pkgname = $row['Name'];
endif; ?>
<h4>
<?php if (canDeleteCommentArray($row, $atype, $uid)): ?>
<form method="post" action="<?= htmlspecialchars(get_pkg_uri($pkgname), ENT_QUOTES); ?>">
<form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name), ENT_QUOTES); ?>">
<fieldset style="display:inline;">
<input type="hidden" name="action" value="do_DeleteComment" />
<input type="hidden" name="comment_id" value="<?= $row['ID'] ?>" />
......@@ -49,7 +48,7 @@ $pkgname = $row['Name'];
<?php if ($count > 10 && !isset($_GET['comments'])): ?>
<div id="news">
<h3>
<a href="<?= htmlentities(get_pkg_uri($pkgname), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= __('View all %s comments', $count) ?>"><?= __('All comments', $count) ?></a>
<a href="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= __('View all %s comments', $count) ?>"><?= __('All comments', $count) ?></a>
</h3>
</div>
<?php endif; ?>
......@@ -20,7 +20,7 @@ $updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($r
$submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
$out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
$urlpath = URL_DIR . substr($row['Name'], 0, 2) . "/" . $row['Name'];
$urlpath = URL_DIR . substr($row['BaseName'], 0, 2) . "/" . $row['BaseName'];
$deps = package_dependencies($row["ID"]);
$requiredby = package_required($row["Name"]);
......@@ -35,12 +35,12 @@ $sources = package_sources($row["ID"]);
<h4><?= __('Package Actions') ?></h4>
<ul class="small">
<li><a href="<?= $urlpath ?>/PKGBUILD"><?= __('View PKGBUILD') ?></a></li>
<li><a href="<?= $urlpath . '/' . $row['Name'] ?>.tar.gz"><?= __('Download tarball') ?></a></li>
<li><a href="<?= $urlpath . '/' . $row['BaseName'] ?>.tar.gz"><?= __('Download tarball') ?></a></li>
<li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
<?php if ($USE_VIRTUAL_URLS && $uid): ?>
<?php if ($row["OutOfDateTS"] === NULL): ?>
<li>
<form action="<?= get_pkg_uri($row['Name']) . 'flag/'; ?>" method="post">
<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>
......@@ -48,7 +48,7 @@ $sources = package_sources($row["ID"]);
<?php elseif (($row["OutOfDateTS"] !== NULL) &&
($uid == $row["MaintainerUID"] || $atype == "Trusted User" || $atype == "Developer")): ?>
<li>
<form action="<?= get_pkg_uri($row['Name']) . 'unflag/'; ?>" method="post">
<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>
......@@ -56,14 +56,14 @@ $sources = package_sources($row["ID"]);
<?php endif; ?>
<?php if (user_voted($uid, $row['ID'])): ?>
<li>
<form action="<?= get_pkg_uri($row['Name']) . 'unvote/'; ?>" method="post">
<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>
<?php else: ?>
<li>
<form action="<?= get_pkg_uri($row['Name']) . 'vote/'; ?>" method="post">
<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>
......@@ -71,28 +71,28 @@ $sources = package_sources($row["ID"]);
<?php endif; ?>
<?php if (user_notify($uid, $row['ID'])): ?>
<li>
<form action="<?= get_pkg_uri($row['Name']) . 'unnotify/'; ?>" method="post">
<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>
<?php else: ?>
<li>
<form action="<?= get_pkg_uri($row['Name']) . 'notify/'; ?>" method="post">
<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>
<?php endif; ?>
<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
<li><a href="<?= get_pkg_uri($row['Name']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
<li><a href="<?= get_pkg_uri($row['Name']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
<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; ?>
<?php endif; ?>
<?php if ($uid && $row["MaintainerUID"] === NULL): ?>
<li>
<form action="<?= get_pkg_uri($row['Name']) . 'adopt/'; ?>" method="post">
<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>
......@@ -100,7 +100,7 @@ $sources = package_sources($row["ID"]);
<?php elseif ($uid && $uid == $row["MaintainerUID"] ||
$atype == "Trusted User" || $atype ==