From f76a38ad7669e044205ab544016d953243d36b29 Mon Sep 17 00:00:00 2001 From: pjmattal Date: Thu, 10 Aug 2006 01:42:35 +0000 Subject: committed dsa's user stats and user links patch this will require some translation updates --- web/html/index.php | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'web/html/index.php') diff --git a/web/html/index.php b/web/html/index.php index 65fa564..462d3bb 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -218,6 +218,78 @@ $result = db_query($q, $dbh); $row = mysql_fetch_row($result); $safe_count = $row[0]; +# Added the user statistcs. +# Added by: dsa +$user = username_from_sid($_COOKIE["AURSID"]); + +if (!empty($user)) { + $q = "SELECT count(*) FROM Packages,PackageLocations,Users WHERE Packages.MaintainerUID = Users.ID AND Packages.LocationID = PackageLocations.ID AND PackageLocations.Location = 'unsupported' AND Users.Username='$user'"; + $result = db_query($q, $dbh); + $row = mysql_fetch_row($result); + $maintainer_unsupported_count = $row[0]; + + $q = "SELECT count(*) FROM Packages,Users WHERE Packages.OutOfDate = 1 AND Packages.MaintainerUID = Users.ID AND Users.Username='$user'"; + $result = db_query($q, $dbh); + $row = mysql_fetch_row($result); + $flagged_outdated = $row[0]; + + $q = "SELECT count(*) FROM Packages,Users WHERE Packages.Safe = 1 AND Packages.MaintainerUID = Users.ID AND Users.Username='$user'"; + $result = db_query($q, $dbh); + $row = mysql_fetch_row($result); + $flagged_safe = $row[0]; + + print ""; + + print ""; + print ""; + print ""; + + # Number of packages in unsupported + print ""; + print ""; + print ""; + print ""; + + # If the user is a TU calculate the number of the packages + $atype = account_from_sid($_COOKIE["AURSID"]); + + if ($atype == 'Trusted User') { + $q = "SELECT count(*) FROM Packages,PackageLocations,Users WHERE Packages.MaintainerUID = Users.ID AND Packages.LocationID = PackageLocations.ID AND PackageLocations.Location = 'community' AND Users.Username='$user'"; + $result = db_query($q, $dbh); + $row = mysql_fetch_row($result); + $maintainer_community_count = $row[0]; + + print ""; + print ""; + print ""; + print ""; + } + + # Number of outdated packages + print ""; + print ""; + print ""; + print ""; + + # Number of safe packages + print ""; + print ""; + print ""; + print ""; + + print "
"; + print "".__("User Statistics").""; + print "
"; + print "".__("Packages in unsupported").""; + print "$maintainer_unsupported_count
"; + print "".__("Packages in [community]").""; + print "$maintainer_community_count
"; + print "".__("Out-of-date").""; + print "$flagged_outdated
"; + print "".__("Safe").""; + print "$flagged_safe

"; +} + print ""; print ""; -- cgit v1.2.3-70-g09d2