mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Hand diff of simo's patch to remove flag safe functionality.
Simo's original commit text: The idea of safe flagging is unclear, poorly named, misunderstood, and not even used. At the time this patch was created, less than a third of the packages in unsupported were flagged safe, and less than a tenth of users knew how to interpret it. The safe flag has been replaced by a disclaimer on the main page.
This commit is contained in:
parent
6dbe12264a
commit
a9837329d6
5 changed files with 2 additions and 177 deletions
|
@ -123,8 +123,6 @@ CREATE TABLE Packages (
|
|||
SubmitterUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- who submitted it?
|
||||
MaintainerUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- User
|
||||
AURMaintainerUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- TU/Dev
|
||||
Safe TINYINT UNSIGNED NOT NULL DEFAULT 0, -- verified to be safe?
|
||||
VerifiedBy INTEGER UNSIGNED NOT NULL DEFAULT 0, -- who verified?
|
||||
FULLTEXT (Name,Description),
|
||||
PRIMARY KEY (ID),
|
||||
UNIQUE (Name),
|
||||
|
|
|
@ -210,11 +210,6 @@ $result = db_query($q, $dbh);
|
|||
$row = mysql_fetch_row($result);
|
||||
$update_count = $row[0];
|
||||
|
||||
$q = "SELECT count(*) FROM Packages,PackageLocations WHERE Packages.LocationID = PackageLocations.ID AND PackageLocations.Location = 'unsupported' AND Packages.Safe = 1";
|
||||
$result = db_query($q, $dbh);
|
||||
$row = mysql_fetch_row($result);
|
||||
$safe_count = $row[0];
|
||||
|
||||
# Added the user statistcs.
|
||||
# Added by: dsa <dsandrade@gmail.com>
|
||||
$user = username_from_sid($_COOKIE["AURSID"]);
|
||||
|
@ -271,30 +266,6 @@ if (!empty($user)) {
|
|||
print "<td class='boxSoft'><span class='f4'>$flagged_outdated</span></td>";
|
||||
print "</tr>";
|
||||
|
||||
# Number of safe packages
|
||||
print "<tr>";
|
||||
print "<td class='boxSoft'>";
|
||||
if ($atype == 'Trusted User' || $atype == 'Developer') {
|
||||
$q = "SELECT count(*) FROM Packages,Users WHERE Packages.Safe = 1 AND Packages.VerifiedBy = Users.ID AND Users.Username='".mysql_real_escape_string($user)."'";
|
||||
$result = db_query($q, $dbh);
|
||||
$row = mysql_fetch_row($result);
|
||||
$flagged_safe = $row[0];
|
||||
|
||||
print "<span class='f4'>".__("Flagged as safe by me")."</span>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$q = "SELECT count(*) FROM Packages,Users WHERE Packages.Safe = 1 AND Packages.MaintainerUID = Users.ID AND Users.Username='".mysql_real_escape_string($user)."'";
|
||||
$result = db_query($q, $dbh);
|
||||
$row = mysql_fetch_row($result);
|
||||
$flagged_safe = $row[0];
|
||||
|
||||
print "<span class='f4'>".__("Flagged as safe")."</span>";
|
||||
}
|
||||
print "</td>";
|
||||
print "<td class='boxSoft'><span class='f4'>$flagged_safe</span></td>";
|
||||
print "</tr>";
|
||||
|
||||
print "</table><br />";
|
||||
}
|
||||
|
||||
|
@ -313,13 +284,6 @@ print "</td>";
|
|||
print "<td class='boxSoft'><span class='f4'>$unsupported_count</span></td>";
|
||||
print "</tr>";
|
||||
|
||||
print "<tr>";
|
||||
print "<td class='boxSoft'>";
|
||||
print "<span class='f4'>".__("Packages in unsupported and flagged as safe")."</span>";
|
||||
print "</td>";
|
||||
print "<td class='boxSoft'><span class='f4'>$safe_count</span></td>";
|
||||
print "</tr>";
|
||||
|
||||
print "<tr>";
|
||||
print "<td class='boxSoft'>";
|
||||
print "<span class='f4'>".__("Packages in [community]")."</span>";
|
||||
|
@ -356,6 +320,7 @@ print "</tr>\n";
|
|||
print "</table>\n";
|
||||
echo "</div>\n";
|
||||
# End Table 1
|
||||
echo "<span class='f4'>".__("DISCLAIMER: Unsupported PKGBUILDs are user produced content, by downloading them you agree to do so at your own risk.")."</span>";
|
||||
echo " </div>";
|
||||
echo "</div>";
|
||||
html_footer(AUR_VERSION);
|
||||
|
|
|
@ -491,55 +491,6 @@ if (isset($_REQUEST["do_Flag"])) {
|
|||
# FIXME: If someone hits the detail page's vote button, this link dies
|
||||
pkgsearch_results_link();
|
||||
|
||||
|
||||
} elseif (isset($_REQUEST["do_FlagSafe"])) {
|
||||
if (!$atype) {
|
||||
print __("You must be logged in before you can flag packages.");
|
||||
print "<br />\n";
|
||||
} else {
|
||||
if (!empty($ids) && $atype == "Trusted User") {
|
||||
$dbh = db_connect();
|
||||
# There currently shouldn't be multiple requests here, but the format in which
|
||||
# it's sent requires this
|
||||
while (list($pid, $v) = each($ids)) {
|
||||
$q = "UPDATE Packages SET Safe = 1, VerifiedBy = ".uid_from_sid($_COOKIE["AURSID"])." WHERE ID = ".$pid;
|
||||
db_query($q, $dbh);
|
||||
print '<p>';
|
||||
print __("The selected packages have been flagged safe.");
|
||||
print '<br /></p>';
|
||||
pkgdetails_link($pid);
|
||||
}
|
||||
} else {
|
||||
print '<p>';
|
||||
print __("Couldn't flag package safe.");
|
||||
print '<br /></p>';
|
||||
}
|
||||
}
|
||||
|
||||
} elseif (isset($_REQUEST["do_UnFlagSafe"])) {
|
||||
if (!$atype) {
|
||||
print __("You must be logged in before you can unflag packages.");
|
||||
print "<br />\n";
|
||||
} else {
|
||||
if (!empty($ids) && $atype == "Trusted User") {
|
||||
$dbh = db_connect();
|
||||
# There currently shouldn't be multiple requests here, but the format in which
|
||||
# it's sent requires this
|
||||
while (list($pid, $v) = each($ids)) {
|
||||
$q = "UPDATE Packages SET Safe = 0 WHERE ID = ".$pid;
|
||||
db_query($q, $dbh);
|
||||
print '<p>';
|
||||
print __("The selected packages have been unflagged safe.");
|
||||
print '<br /></p>';
|
||||
pkgdetails_link($pid);
|
||||
}
|
||||
} else {
|
||||
print '<p>';
|
||||
print __("Couldn't unflag package safe.");
|
||||
print '<br /></p>';
|
||||
}
|
||||
}
|
||||
|
||||
} elseif (isset($_REQUEST["do_Notify"])) {
|
||||
# I realize that the implementation here seems a bit convoluted, but we want to
|
||||
# ensure that everything happens as it should, even if someone called this page
|
||||
|
|
|
@ -412,11 +412,6 @@ if ($_COOKIE["AURSID"]) {
|
|||
$q.="Description='".mysql_real_escape_string($new_pkgbuild['pkgdesc'])."', ";
|
||||
$q.="URL='".mysql_real_escape_string($new_pkgbuild['url'])."', ";
|
||||
$q.="LocationID=2, ";
|
||||
if (account_from_sid($_COOKIE["AURSID"]) == "Trusted User" || account_from_sid($_COOKIE["AURSID"]) == "Developer") {
|
||||
$q.="Safe=1, VerifiedBy=".uid_from_sid($_COOKIE["AURSID"]).", ";
|
||||
} else {
|
||||
$q.="Safe=0, ";
|
||||
}
|
||||
$fspath=INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
|
||||
$q.="FSPath='".mysql_real_escape_string($fspath)."', ";
|
||||
$urlpath=URL_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
|
||||
|
@ -481,9 +476,6 @@ if ($_COOKIE["AURSID"]) {
|
|||
#
|
||||
$q = "INSERT INTO Packages ";
|
||||
$q.= " (Name, License, Version, CategoryID, Description, URL, LocationID, ";
|
||||
if (account_from_sid($_COOKIE["AURSID"]) == "Trusted User" || account_from_sid($_COOKIE["AURSID"]) == "Developer") {
|
||||
$q.= "Safe, VerifiedBy,";
|
||||
}
|
||||
$q.= " SubmittedTS, SubmitterUID, MaintainerUID, FSPath, URLPath) ";
|
||||
$q.= "VALUES ('";
|
||||
$q.= mysql_real_escape_string($new_pkgbuild['pkgname'])."', '";
|
||||
|
|
|
@ -355,15 +355,6 @@ function package_details($id=0, $SID="") {
|
|||
echo "<a href='http://cvs.archlinux.org/cgi-bin/viewcvs.cgi/" . $row["Category"] . "/" . $row["Name"] . "/?cvsroot=AUR&only_with_tag=CURRENT'>CVS</td>";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
if ($row["LocationID"] == 2) {
|
||||
echo " <tr><td colspan='3'>";
|
||||
if ($row["Safe"]) {
|
||||
echo "<span class='f7'>".__("The above files have been verified (by %h%s%h) and are safe to use.", array("<a href='/account.php?Action=AccountInfo&ID=".$row["VerifiedBy"]."'>", username_from_id($row["VerifiedBy"]), "</a>"))."</span></td>";
|
||||
} else {
|
||||
echo "<span class='f6'>".__("Be careful! The above files may contain malicious code that can damage your system.")."</span></td>";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
}
|
||||
if ($row["OutOfDate"] == 1) {
|
||||
echo "\n<tr><td colspan='2'>";
|
||||
echo "<span class='f6'>".__("This package has been flagged out of date.")."</span></td></tr>";
|
||||
|
@ -487,17 +478,6 @@ function package_details($id=0, $SID="") {
|
|||
echo "<input type='submit' class='button' name='do_UnNotify'";
|
||||
echo " value='".__("UnNotify")."' title='".__("No New Comment Notification")."'>";
|
||||
}
|
||||
# Flag Safe Button
|
||||
#
|
||||
if ($row["LocationID"] == 2 && (account_from_sid($SID) == "Trusted User" || account_from_sid($SID) == "Developer")) {
|
||||
if ($row["Safe"] == 0) {
|
||||
echo "<input type='submit' class='button' name='do_FlagSafe'";
|
||||
echo " value='".__("Flag Safe")."' title='".__("Flag Package Safe To Use")."'>";
|
||||
} else {
|
||||
echo "<input type='submit' class='button' name='do_UnFlagSafe'";
|
||||
echo " value='".__("Unflag Safe")."' title='".__("Unflag Package Safe To Use")."'>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($row["OutOfDate"] == 0) {
|
||||
echo "<input type='submit' class='button' name='do_Flag'";
|
||||
|
@ -743,37 +723,6 @@ function pkg_search_page($SID="") {
|
|||
print " </select>\n";
|
||||
print "</td>\n";
|
||||
|
||||
/* Status Safe-Unsafe */
|
||||
|
||||
# Added the code below to handle the safe package flag.
|
||||
# So we can search for then for 'all' packages, 'safe'
|
||||
# packages and 'unsafe' packages.
|
||||
|
||||
print "<td align='right'>\n";
|
||||
print " <span class='f5'><span class='blue'>".__("Status");
|
||||
print "</span></span><br />\n";
|
||||
|
||||
print " <select name='PaS'>\n";
|
||||
|
||||
# Flagged Safe
|
||||
print " <option value=all";
|
||||
$_REQUEST["PaS"] == "all" ? print " selected> " : print "> ";
|
||||
print __("All")."</option>\n";
|
||||
|
||||
# Flagged Safe
|
||||
print " <option value=fs";
|
||||
$_REQUEST["PaS"] == "fs" ? print " selected> " : print "> ";
|
||||
print __("Safe")."</option>\n";
|
||||
# Unflagged Safe
|
||||
print " <option value=us";
|
||||
$_REQUEST["PaS"] == "us" ? print " selected> " : print "> ";
|
||||
print __("Unsafe")."</option>\n";
|
||||
|
||||
print " </select>\n";
|
||||
print "</td>\n";
|
||||
|
||||
/* End of Package Status */
|
||||
|
||||
/* Sort by */
|
||||
|
||||
print "<td align='right'>\n";
|
||||
|
@ -957,29 +906,6 @@ function pkg_search_page($SID="") {
|
|||
}
|
||||
}
|
||||
|
||||
# Added the code below to handle the safe package flag.
|
||||
# So we can search for then for 'all' packages, 'safe'
|
||||
# packages and 'unsafe' packages.
|
||||
if ($_REQUEST["PaS"] <> "all") {
|
||||
# Flagged Safe
|
||||
if ($_REQUEST["PaS"] == "fs")
|
||||
if (!$has_where) {
|
||||
$q.= "WHERE Safe = 1 ";
|
||||
$has_where = 1;
|
||||
} else {
|
||||
$q.= "AND Safe = 1 ";
|
||||
}
|
||||
|
||||
# Unflagged Safe
|
||||
if ($_REQUEST["PaS"] == "us")
|
||||
if (!$has_where) {
|
||||
$q.= "WHERE Safe = 0 AND LocationID != 3 ";
|
||||
$has_where = 1;
|
||||
} else {
|
||||
$q.= "AND Safe = 0 AND LocationID != 3 ";
|
||||
}
|
||||
}
|
||||
|
||||
$order = $_REQUEST["SO"] == 'd' ? 'DESC' : 'ASC';
|
||||
|
||||
switch ($_REQUEST["SB"]) {
|
||||
|
@ -1158,13 +1084,7 @@ function pkg_search_page($SID="") {
|
|||
}
|
||||
reset($pkgsearch_vars);
|
||||
$url.= "'>";
|
||||
|
||||
if ($row["Safe"] == 1 || $locs[$row["LocationID"]] == "community") {
|
||||
$url.="<span class='green'>";
|
||||
}
|
||||
else {
|
||||
$url.="<span class='black'>";
|
||||
}
|
||||
$url.=$row["Name"];
|
||||
$url.= " ".$row["Version"]."</span></a>";
|
||||
print $url."</span></td>\n";
|
||||
|
@ -1243,7 +1163,6 @@ function pkg_search_page($SID="") {
|
|||
if ($SID) {
|
||||
print ' <span class="outofdate">'.__("Out of Date").' </span>'." ";
|
||||
}
|
||||
print ' <span class="green">'.__("Safe")."</span>\n";
|
||||
print " </span></td>\n";
|
||||
print " </tr>";
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue