summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/html/index.php34
-rw-r--r--web/html/packages.php75
-rw-r--r--web/html/pkgbase.php82
-rw-r--r--web/html/pkgdel.php10
-rw-r--r--web/html/pkgmerge.php10
-rw-r--r--web/lib/pkgfuncs.inc.php64
-rw-r--r--web/template/pkg_comment_form.php4
-rw-r--r--web/template/pkg_comments.php7
-rw-r--r--web/template/pkg_details.php30
-rw-r--r--web/template/pkg_search_results.php4
-rw-r--r--web/template/pkgbase_details.php26
11 files changed, 175 insertions, 171 deletions
diff --git a/web/html/index.php b/web/html/index.php
index e79955ec..fe74857c 100644
--- a/web/html/index.php
+++ b/web/html/index.php
@@ -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');
}
}
diff --git a/web/html/packages.php b/web/html/packages.php
index d9c3a860..876e2c07 100644
--- a/web/html/packages.php
+++ b/web/html/packages.php
@@ -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');
diff --git a/web/html/pkgbase.php b/web/html/pkgbase.php
index e0c9af69..42705edd 100644
--- a/web/html/pkgbase.php
+++ b/web/html/pkgbase.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"])) {
diff --git a/web/html/pkgdel.php b/web/html/pkgdel.php
index 7f244eb4..d1026ce4 100644
--- a/web/html/pkgdel.php
+++ b/web/html/pkgdel.php
@@ -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>
diff --git a/web/html/pkgmerge.php b/web/html/pkgmerge.php
index 834d0c91..9ffd5e74 100644
--- a/web/html/pkgmerge.php
+++ b/web/html/pkgmerge.php
@@ -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>
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index a63ee6fd..4e37d2f4 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -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."));
}
diff --git a/web/template/pkg_comment_form.php b/web/template/pkg_comment_form.php
index 8e74fe64..8a74dc13 100644
--- a/web/template/pkg_comment_form.php
+++ b/web/template/pkg_comment_form.php
@@ -1,6 +1,6 @@
<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>
diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php
index 820ba6e2..1f47bb3e 100644
--- a/web/template/pkg_comments.php
+++ b/web/template/pkg_comments.php
@@ -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; ?>
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
index d4e4e4ed..5268d3b4 100644
--- a/web/template/pkg_details.php
+++ b/web/template/pkg_details.php
@@ -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 == "Developer"): ?>
<li>
- <form action="<?= get_pkg_uri($row['Name']) . 'disown/'; ?>" method="post">
+ <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>
@@ -130,7 +130,7 @@ if ($SID && ($uid == $row["MaintainerUID"] ||
($atype == "Developer" || $atype == "Trusted User"))):
?>
<td>
- <form method="post" action="<?= htmlspecialchars(get_pkg_uri($row['Name']), ENT_QUOTES); ?>">
+ <form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['BaseName']), ENT_QUOTES); ?>">
<div>
<input type="hidden" name="action" value="do_ChangeCategory" />
<?php if ($SID): ?>
@@ -196,9 +196,9 @@ if ($row["MaintainerUID"]):
<th><?= __('Votes') . ': ' ?></th>
<?php if ($atype == "Developer" || $atype == "Trusted User"): ?>
<?php if ($USE_VIRTUAL_URLS): ?>
- <td><a href="<?= get_pkg_uri($row['Name']); ?>voters/"><?= $votes ?></a></td>
+ <td><a href="<?= get_pkgbase_uri($row['BaseName']); ?>voters/"><?= $votes ?></a></td>
<?php else: ?>
- <td><a href="<?= get_uri('/voters/'); ?>?N=<?= htmlspecialchars($row['Name'], ENT_QUOTES) ?>"><?= $votes ?></a></td>
+ <td><a href="<?= get_uri('/voters/'); ?>?N=<?= htmlspecialchars($row['BaseName'], ENT_QUOTES) ?>"><?= $votes ?></a></td>
<?php endif; ?>
<?php else: ?>
<td><?= $votes ?></td>
diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php
index 16f574af..c9da5f9a 100644
--- a/web/template/pkg_search_results.php
+++ b/web/template/pkg_search_results.php
@@ -28,7 +28,7 @@ if (!$result): ?>
<?php endif; ?>
</div>
- <form id="pkglist-results-form" method="post" action="<?= get_uri('/packages/'); ?>?<?= htmlentities($_SERVER['QUERY_STRING']) ?>">
+ <form id="pkglist-results-form" method="post" action="<?= get_uri('/pkgbase/'); ?>?<?= htmlentities($_SERVER['QUERY_STRING']) ?>">
<table class="results">
<thead>
<tr>
@@ -52,7 +52,7 @@ if (!$result): ?>
<?php while (list($indx, $row) = each($searchresults)): ?>
<tr class="<?= ($indx % 2 == 0) ? 'odd' : 'even' ?>">
<?php if ($SID): ?>
- <td><input type="checkbox" name="IDs[<?= $row["ID"] ?>]" value="1" /></td>
+ <td><input type="checkbox" name="IDs[<?= $row["PackageBaseID"] ?>]" value="1" /></td>
<?php endif; ?>
<td><?= htmlspecialchars($row["Category"]) ?></td>
<td><a href="<?= htmlspecialchars(get_pkg_uri($row["Name"]), ENT_QUOTES); ?>"><?= htmlspecialchars($row["Name"]) ?></a></td>
diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php
index a77ecd39..8da23c43 100644
--- a/web/template/pkgbase_details.php
+++ b/web/template/pkgbase_details.php
@@ -30,12 +30,12 @@ $pkgs = pkgbase_get_pkgnames($base_id);
<h4><?= __('Package Actions') ?></h4>
<ul class="small">
<li><a href="<?= $urlpath ?>/PKGBUILD"><?= __('View PKGBUILD') ?></a></li>
- <li><a href="<?= $urlpath . '/' . $pkgs[0] ?>.tar.gz"><?= __('Download tarball') ?></a></li>
+ <li><a href="<?= $urlpath . '/' . $row['Name'] ?>.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($pkgs[0]) . 'flag/'; ?>" method="post">
+ <form action="<?= get_pkgbase_uri($row['Name']) . '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>
@@ -43,7 +43,7 @@ $pkgs = pkgbase_get_pkgnames($base_id);
<?php elseif (($row["OutOfDateTS"] !== NULL) &&
($uid == $row["MaintainerUID"] || $atype == "Trusted User" || $atype == "Developer")): ?>
<li>
- <form action="<?= get_pkg_uri($pkgs[0]) . 'unflag/'; ?>" method="post">
+ <form action="<?= get_pkgbase_uri($row['Name']) . '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>
@@ -51,14 +51,14 @@ $pkgs = pkgbase_get_pkgnames($base_id);
<?php endif; ?>
<?php if (user_voted($uid, $row['ID'])): ?>
<li>
- <form action="<?= get_pkg_uri($pkgs[0]) . 'unvote/'; ?>" method="post">
+ <form action="<?= get_pkgbase_uri($row['Name']) . '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($pkgs[0]) . 'vote/'; ?>" method="post">
+ <form action="<?= get_pkgbase_uri($row['Name']) . '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>
@@ -66,28 +66,28 @@ $pkgs = pkgbase_get_pkgnames($base_id);
<?php endif; ?>
<?php if (user_notify($uid, $row['ID'])): ?>
<li>
- <form action="<?= get_pkg_uri($pkgs[0]) . 'unnotify/'; ?>" method="post">
+ <form action="<?= get_pkgbase_uri($row['Name']) . '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($pkgs[0]) . 'notify/'; ?>" method="post">
+ <form action="<?= get_pkgbase_uri($row['Name']) . '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($pkgs[0]) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
- <li><a href="<?= get_pkg_uri($pkgs[0]) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
+ <li><a href="<?= get_pkgbase_uri($row['Name']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
+ <li><a href="<?= get_pkgbase_uri($row['Name']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
<?php endif; ?>
<?php endif; ?>
<?php if ($uid && $row["MaintainerUID"] === NULL): ?>
<li>
- <form action="<?= get_pkg_uri($pkgs[0]) . 'adopt/'; ?>" method="post">
+ <form action="<?= get_pkgbase_uri($row['Name']) . '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>
@@ -95,7 +95,7 @@ $pkgs = pkgbase_get_pkgnames($base_id);
<?php elseif ($uid && $uid == $row["MaintainerUID"] ||
$atype == "Trusted User" || $atype == "Developer"): ?>
<li>
- <form action="<?= get_pkg_uri($pkgs[0]) . 'disown/'; ?>" method="post">
+ <form action="<?= get_pkgbase_uri($row['Name']) . '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>
@@ -113,7 +113,7 @@ if ($SID && ($uid == $row["MaintainerUID"] ||
($atype == "Developer" || $atype == "Trusted User"))):
?>
<td>
- <form method="post" action="<?= htmlspecialchars(get_pkg_uri($row['Name']), ENT_QUOTES); ?>">
+ <form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['Name']), ENT_QUOTES); ?>">
<div>
<input type="hidden" name="action" value="do_ChangeCategory" />
<?php if ($SID): ?>
@@ -175,7 +175,7 @@ if ($row["MaintainerUID"]):
<th><?= __('Votes') . ': ' ?></th>
<?php if ($atype == "Developer" || $atype == "Trusted User"): ?>
<?php if ($USE_VIRTUAL_URLS): ?>
- <td><a href="<?= get_pkg_uri($row['Name']); ?>voters/"><?= $votes ?></a></td>
+ <td><a href="<?= get_pkgbase_uri($row['Name']); ?>voters/"><?= $votes ?></a></td>
<?php else: ?>
<td><a href="<?= get_uri('/voters/'); ?>?N=<?= htmlspecialchars($row['Name'], ENT_QUOTES) ?>"><?= $votes ?></a></td>
<?php endif; ?>