From a8999a691777a96ea07f53a479a154b743712a46 Mon Sep 17 00:00:00 2001 From: pjmattal Date: Fri, 29 Jul 2005 12:29:23 +0000 Subject: added swiergot's checking patch as well as modifying it to also list package name in green on the package list page (with legend) --- web/html/css/fonts.css | 232 +++++++++++++++++++++++--------------------- web/html/packages.php | 48 +++++++++ web/html/pkgsubmit.php | 1 + web/lang/en/pkgfuncs_po.inc | 14 +++ web/lang/en/search_po.inc | 8 ++ web/lang/pl/pkgfuncs_po.inc | 14 ++- web/lang/pl/search_po.inc | 10 +- web/lib/pkgfuncs.inc | 38 +++++++- 8 files changed, 252 insertions(+), 113 deletions(-) diff --git a/web/html/css/fonts.css b/web/html/css/fonts.css index fcf4644..562c62e 100644 --- a/web/html/css/fonts.css +++ b/web/html/css/fonts.css @@ -1,108 +1,124 @@ -/* Standard Fonts */ - span /* Applicable by default in all fonts */ - { - color: #666; - font-family: verdana, trebuchet ms, tahoma, luxi sans; - } - span.f1 /* Important */ - { - font-family: verdana; - font-size: 20px; - letter-spacing: 1px; - } - span.f2 /* Title */ - { - font-size: 14px; - color: rgb(108, 131, 176); - font-weight: bold; - } - span.f3 /* Sub Title */ - { - color: #888; - font-size: 14px; - font-weight: bold; - } - span.f4 /* Content Text */ - { - color: #444; - font-family: verdana; - font-size: 12px; - } - span.f5 /* Content Small */ - { - color: #333; - font-family: trebuchet ms, tahoma, verdana; - font-size: 11px; - } - span.fix /* Monospace fixed-font */ - { - color: #000; - font-family: monospace, fixed, terminal; - font-size: 12px; - } - span.error /* Content Text */ - { - color: #900; - font-family: verdana; - font-size: 12px; - } - -/* Font Attribute Change (#6c83b0)*/ - span.blue - { - color: rgb( 108, 131, 176 ); - } - span.white - { - color: white; - } - span.black - { - color: black; - } - span.link - { - color: rgb( 108, 131, 176 ); - font-weight: bold; - } - -/* Misc (c9d1e2) */ - span.preHeader - { - color: rgb( 201, 209, 226 ); - font-weight: bold; - font-size: 11px; - font-family: tahoma, trebuchet ms, verdana; - padding-right: 8px; - word-spacing: 8px; - } - span.sideBarSmallHeader - { - color: #fff; - font-weight: bold; - font-size: 11px; - font-family: tahoma, trebuchet ms, verdana; - padding-right: 8px; - } - -a:visited { - color: rgb(108,131,176); - text-decoration: none; - font-weight: bold; -} - -a:link { - color: rgb(108,131,176); - text-decoration: none; - font-weight: bold; -} - -a:hover { - color: #990000; - text-decoration: none; - font-weight: bold; -} - -h1,h2,h3,h4 { - font-size: 16pt; -} +/* Standard Fonts */ + span /* Applicable by default in all fonts */ + { + color: #666; + font-family: verdana, trebuchet ms, tahoma, luxi sans; + } + span.f1 /* Important */ + { + font-family: verdana; + font-size: 20px; + letter-spacing: 1px; + } + span.f2 /* Title */ + { + font-size: 14px; + color: rgb(108, 131, 176); + font-weight: bold; + } + span.f3 /* Sub Title */ + { + color: #888; + font-size: 14px; + font-weight: bold; + } + span.f4 /* Content Text */ + { + color: #444; + font-family: verdana; + font-size: 12px; + } + span.f5 /* Content Small */ + { + color: #333; + font-family: trebuchet ms, tahoma, verdana; + font-size: 11px; + } + span.f6 /* Red Message */ + { + color: #b06d6e; + font-size: 14px; + font-weight: bold; + } + span.f7 /* Green Message */ + { + color: #6db06d; + font-size: 14px; + font-weight: bold; + } + span.fix /* Monospace fixed-font */ + { + color: #000; + font-family: monospace, fixed, terminal; + font-size: 12px; + } + span.error /* Content Text */ + { + color: #900; + font-family: verdana; + font-size: 12px; + } + +/* Font Attribute Change (#6c83b0)*/ + span.blue + { + color: rgb( 108, 131, 176 ); + } + span.white + { + color: white; + } + span.black + { + color: black; + } + span.green + { + color: #6db06d; + } + span.link + { + color: rgb( 108, 131, 176 ); + font-weight: bold; + } + +/* Misc (c9d1e2) */ + span.preHeader + { + color: rgb( 201, 209, 226 ); + font-weight: bold; + font-size: 11px; + font-family: tahoma, trebuchet ms, verdana; + padding-right: 8px; + word-spacing: 8px; + } + span.sideBarSmallHeader + { + color: #fff; + font-weight: bold; + font-size: 11px; + font-family: tahoma, trebuchet ms, verdana; + padding-right: 8px; + } + +a:visited { + color: rgb(108,131,176); + text-decoration: none; + font-weight: bold; +} + +a:link { + color: rgb(108,131,176); + text-decoration: none; + font-weight: bold; +} + +a:hover { + color: #990000; + text-decoration: none; + font-weight: bold; +} + +h1,h2,h3,h4 { + font-size: 16pt; +} diff --git a/web/html/packages.php b/web/html/packages.php index 4191440..d544e62 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -462,6 +462,54 @@ if (isset($_REQUEST["do_Flag"])) { pkgsearch_results_link(); +} elseif (isset($_REQUEST["do_FlagSafe"])) { + if (!$atype) { + print __("You must be logged in before you can flag packages."); + print "
\n"; + } else { + if (!empty($ids) || $atype == "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 '

'; + print __("The selected packages have been flagged safe."); + print '

'; + pkgdetails_link($pid); + } + } else { + print '

'; + print __("Couldn't flag package safe."); + print '

'; + } + } + +} elseif (isset($_REQUEST["do_UnFlagSafe"])) { + if (!$atype) { + print __("You must be logged in before you can unflag packages."); + print "
\n"; + } else { + if (!empty($ids) || $atype == "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 '

'; + print __("The selected packages have been unflagged safe."); + print '

'; + pkgdetails_link($pid); + } + } else { + print '

'; + print __("Couldn't unflag package safe."); + print '

'; + } + } + } 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 diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index e56335d..c71ad47 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -376,6 +376,7 @@ if ($_COOKIE["AURSID"]) { $q.="Description='".mysql_escape_string($new_pkgbuild['pkgdesc'])."', "; $q.="URL='".mysql_escape_string($new_pkgbuild['url'])."', "; $q.="LocationID=2, "; + $q.="Safe=0, "; $fspath=$INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"]; $q.="FSPath='".mysql_escape_string($fspath)."', "; $urlpath=$URL_DIR.$pkg_name."/".$_FILES["pfile"]["name"]; diff --git a/web/lang/en/pkgfuncs_po.inc b/web/lang/en/pkgfuncs_po.inc index 2cc4b6f..3a62eb1 100644 --- a/web/lang/en/pkgfuncs_po.inc +++ b/web/lang/en/pkgfuncs_po.inc @@ -109,4 +109,18 @@ $_t["en"]["New Comment Notification"] = "New Comment Notification"; $_t["en"]["Comments"] = "Comments"; +$_t["en"]["The above files have been verified (by %s) and are safe to use."] = "The above files have been verified (by %s) and are safe to use."; + +$_t["en"]["Be careful! The above files may contain malicious code that can damage your system."] = "Be careful! The above files may contain malicious code that can damage your system."; + +$_t["en"]["Flag Safe"] = "Flag Safe"; + +$_t["en"]["Flag Package Safe To Use"] = "Flag Package Safe To Use"; + +$_t["en"]["Unflag Safe"] = "Unflag Safe"; + +$_t["en"]["Unflag Package Safe To Use"] = "Unflag Package Safe To Use"; + +$_t["en"]["Safe"] = "Safe"; + ?> \ No newline at end of file diff --git a/web/lang/en/search_po.inc b/web/lang/en/search_po.inc index f915bfd..e4753aa 100644 --- a/web/lang/en/search_po.inc +++ b/web/lang/en/search_po.inc @@ -67,4 +67,12 @@ $_t["en"]["The selected packages have been disowned."] = "The selected packages $_t["en"]["Couldn't remove from notification list."] = "Couldn't remove from notification list."; +$_t["en"]["The selected packages have been flagged safe."] = "The selected packages have been flagged safe."; + +$_t["en"]["Couldn't flag package safe."] = "Couldn't flag package safe."; + +$_t["en"]["The selected packages have been unflagged safe."] = "The selected packages have been unflagged safe."; + +$_t["en"]["Couldn't unflag package safe."] = "Couldn't unflag package safe."; + ?> \ No newline at end of file diff --git a/web/lang/pl/pkgfuncs_po.inc b/web/lang/pl/pkgfuncs_po.inc index a708d44..4fd3e2c 100644 --- a/web/lang/pl/pkgfuncs_po.inc +++ b/web/lang/pl/pkgfuncs_po.inc @@ -65,4 +65,16 @@ $_t["pl"]["Notify"] = "Włącz powiadamianie"; $_t["pl"]["New Comment Notification"] = "Powiadomienie o nowym komentarzu."; -?> \ No newline at end of file +$_t["pl"]["The above files have been verified (by %s) and are safe to use."] = "Powyższe pliki zostały sprawdzone (przez: %s) i możesz ich bezpiecznie uzywać."; + +$_t["pl"]["Be careful! The above files may contain malicious code that can damage your system."] = "Zachowaj ostrożność! Powyższe pliki mogą zawierać szkodliwy kod zagrażający twojemu systemowi."; + +$_t["pl"]["Flag Safe"] = "Zaznacz jako bezpieczny"; + +$_t["pl"]["Flag Package Safe To Use"] = "Zaznacz pakiet jako bezpieczny w użyciu"; + +$_t["pl"]["Unflag Safe"] = "Usuń flagę bezpieczeństwa"; + +$_t["pl"]["Unflag Package Safe To Use"] = "Usuń flagę oznaczającą pakiet jako bezpieczny w użyciu"; + +?> diff --git a/web/lang/pl/search_po.inc b/web/lang/pl/search_po.inc index 8de975d..dbfa370 100644 --- a/web/lang/pl/search_po.inc +++ b/web/lang/pl/search_po.inc @@ -48,4 +48,12 @@ $_t["pl"]["Couldn't add to notification list."] = "Dodanie do listy powiadamiani $_t["pl"]["Couldn't remove from notification list."] = "Usunięcie z listy powiadamiania nie powiodło się."; -?> \ No newline at end of file +$_t["pl"]["The selected packages have been flagged safe."] = "Wybrane pakiety zostały zaznaczone jako bezpieczne."; + +$_t["pl"]["Couldn't flag package safe."] = "Zaznaczenie pakietu jako bezpiecznego nie powiodło się."; + +$_t["pl"]["The selected packages have been unflagged safe."] = "Wybrane pakiety zostały odznaczone jako bezpieczne."; + +$_t["pl"]["Couldn't unflag package safe."] = "Odznaczenie pakietu jako bezpiecznego nie powiodło się."; + +?> diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 2eb47d4..ca25125 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -334,6 +334,15 @@ function package_details($id=0, $SID="") { print "CVS"; } print "\n"; + if ($row["LocationID"] == 2) { + print "\n"; + print " "; + if ($row["Safe"]) { + print "".__("The above files have been verified (by %s) and are safe to use.", array(username_from_id($row["VerifiedBy"]))).""; + } else { + print "".__("Be careful! The above files may contain malicious code that can damage your system.").""; + } + } print "\n"; print " "; print "\n"; @@ -429,6 +438,21 @@ function package_details($id=0, $SID="") { print ""; } + # Flag Safe Button + # + if ($row["LocationID"] == 2 && (account_from_sid($SID) == "Trusted User" || account_from_sid($SID) == "Developer")) + { + if ($row["Safe"] == 0) + { + print ""; + } + else + { + print ""; + } + } print "\n"; print "
\n"; } @@ -857,7 +881,7 @@ function pkg_search_page($SID="") { } if ($row["MaintainerUID"]==0 && $row["AURMaintainerUID"]==0) { print ""; - } + } print ""; # if ($i == 0) { # $all_ids = $row["ID"]; @@ -889,7 +913,14 @@ function pkg_search_page($SID="") { } } reset($pkgsearch_vars); - $url.= "'>".$row["Name"]; + $url.= "'>"; + if ($row["Safe"] == 1) { + $url.=""; + } + else { + $url.=""; + } + $url.=$row["Name"]; $url.= " ".$row["Version"]."
"; print $url."\n"; print " "; @@ -961,7 +992,8 @@ function pkg_search_page($SID="") { if ($SID) { print " \n"; print " ".__("O%hrphan", array(''))."    \n"; - print " ".__("O%hut-of-Date", array(''))."\n"; + print " ".__("O%hut-of-Date", array(''))."    "; + print ' '.__("Safe")."\n"; print " \n"; } print " "; -- cgit v1.2.3-54-g00ecf