diff options
author | pjmattal <pjmattal> | 2006-08-10 01:42:35 +0000 |
---|---|---|
committer | pjmattal <pjmattal> | 2006-08-10 01:42:35 +0000 |
commit | f76a38ad7669e044205ab544016d953243d36b29 (patch) | |
tree | 91fd417548b4cf2671a49baada13654d05643aeb /web/html/index.php | |
parent | 1e9149b1708037bec8d371924550b5a55abb5f5b (diff) | |
download | aurweb-f76a38ad7669e044205ab544016d953243d36b29.tar.xz |
committed dsa's user stats and user links patch
this will require some translation updates
Diffstat (limited to 'web/html/index.php')
-rw-r--r-- | web/html/index.php | 72 |
1 files changed, 72 insertions, 0 deletions
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 <dsandrade@gmail.com> +$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 "<table class='boxSoft'>"; + + print "<tr>"; + print "<th colspan='2' class='boxSoftTitle' style='text-align: right'>"; + print "<span class='f3'>".__("User Statistics")."</span>"; + print "</th>"; + print "</tr>"; + + # Number of packages in unsupported + print "<tr>"; + print "<td class='boxSoft'>"; + print "<span class='f4'>".__("Packages in unsupported")."</span>"; + print "</td>"; + print "<td class='boxSoft'><span class='f4'>$maintainer_unsupported_count</span></td>"; + print "</tr>"; + + # 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 "<tr>"; + print "<td class='boxSoft'>"; + print "<span class='f4'>".__("Packages in [community]")."</span>"; + print "</td>"; + print "<td class='boxSoft'><span class='f4'>$maintainer_community_count</span></td>"; + print "</tr>"; + } + + # Number of outdated packages + print "<tr>"; + print "<td class='boxSoft'>"; + print "<span class='f4'>".__("Out-of-date")."</span>"; + print "</td>"; + print "<td class='boxSoft'><span class='f4'>$flagged_outdated</span></td>"; + print "</tr>"; + + # Number of safe packages + print "<tr>"; + print "<td class='boxSoft'>"; + print "<span class='f4'>".__("Safe")."</span>"; + print "</td>"; + print "<td class='boxSoft'><span class='f4'>$flagged_safe</span></td>"; + print "</tr>"; + + print "</table><br />"; +} + print "<table class='boxSoft'>"; print "<tr>"; |