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

Fix vote/notify link on the package details page



Call pkgbase_user_voted() and pkgbase_user_notify() using the package
base ID instead of using the package ID.

Fixes FS#40165.

Signed-off-by: default avatarLukas Fleischer <archlinux@cryptocrack.de>
parent 05f88b28
......@@ -395,11 +395,12 @@ function pkg_name_is_blacklisted($name) {
function pkg_get_details($id=0) {
$dbh = DB::connect();
$q = "SELECT Packages.*, PackageBases.Name AS BaseName, ";
$q.= "PackageBases.CategoryID, PackageBases.NumVotes, ";
$q.= "PackageBases.OutOfDateTS, PackageBases.SubmittedTS, ";
$q.= "PackageBases.ModifiedTS, PackageBases.SubmitterUID, ";
$q.= "PackageBases.MaintainerUID, PackageCategories.Category ";
$q = "SELECT Packages.*, PackageBases.ID AS BaseID, ";
$q.= "PackageBases.Name AS BaseName, PackageBases.CategoryID, ";
$q.= "PackageBases.NumVotes, PackageBases.OutOfDateTS, ";
$q.= "PackageBases.SubmittedTS, PackageBases.ModifiedTS, ";
$q.= "PackageBases.SubmitterUID, PackageBases.MaintainerUID, ";
$q.= "PackageCategories.Category ";
$q.= "FROM Packages, PackageBases, PackageCategories ";
$q.= "WHERE PackageBases.ID = Packages.PackageBaseID ";
$q.= "AND PackageBases.CategoryID = PackageCategories.ID ";
......
......@@ -3,6 +3,7 @@ $atype = account_from_sid($SID);
$uid = uid_from_sid($SID);
$pkgid = intval($row['ID']);
$base_id = intval($row['BaseID']);
$catarr = pkgbase_categories();
......@@ -73,7 +74,7 @@ $sources = pkg_sources($row["ID"]);
</form>
</li>
<?php endif; ?>
<?php if (pkgbase_user_voted($uid, $row['ID'])): ?>
<?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']) ?>" />
......@@ -88,7 +89,7 @@ $sources = pkg_sources($row["ID"]);
</form>
</li>
<?php endif; ?>
<?php if (pkgbase_user_notify($uid, $row['ID'])): ?>
<?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']) ?>" />
......
......@@ -49,7 +49,7 @@ $pkgs = pkgbase_get_pkgnames($base_id);
</form>
</li>
<?php endif; ?>
<?php if (pkgbase_user_voted($uid, $row['ID'])): ?>
<?php if (pkgbase_user_voted($uid, $base_id)): ?>
<li>
<form action="<?= get_pkgbase_uri($row['Name']) . 'unvote/'; ?>" method="post">
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
......@@ -64,7 +64,7 @@ $pkgs = pkgbase_get_pkgnames($base_id);
</form>
</li>
<?php endif; ?>
<?php if (pkgbase_user_notify($uid, $row['ID'])): ?>
<?php if (pkgbase_user_notify($uid, $base_id)): ?>
<li>
<form action="<?= get_pkgbase_uri($row['Name']) . 'unnotify/'; ?>" method="post">
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment