diff options
Diffstat (limited to 'web/lib/stats.inc.php')
-rw-r--r-- | web/lib/stats.inc.php | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/web/lib/stats.inc.php b/web/lib/stats.inc.php index 8f0f770..2828dc9 100644 --- a/web/lib/stats.inc.php +++ b/web/lib/stats.inc.php @@ -2,8 +2,7 @@ include_once('aur.inc.php'); -function updates_table($dbh) -{ +function updates_table($dbh) { $key = 'recent_updates'; if(!($newest_packages = get_cache_value($key))) { $q = 'SELECT * FROM Packages ORDER BY ModifiedTS DESC LIMIT 10'; @@ -18,18 +17,16 @@ function updates_table($dbh) include('stats/updates_table.php'); } -function user_table($user, $dbh) -{ - $escuser = db_escape_string($user); - $base_q = "SELECT count(*) FROM Packages,Users WHERE Packages.MaintainerUID = Users.ID AND Users.Username='" . $escuser . "'"; +function user_table($userid, $dbh) { + $base_q = "SELECT count(*) FROM Packages WHERE Packages.MaintainerUID = " . $userid; $maintainer_unsupported_count = db_cache_value($base_q, $dbh, - 'user_unsupported_count:' . $escuser); + 'user_unsupported_count:' . $userid); - $q = "SELECT count(*) FROM Packages,Users WHERE Packages.OutOfDateTS IS NOT NULL AND Packages.MaintainerUID = Users.ID AND Users.Username='" . $escuser . "'"; + $q = "SELECT count(*) FROM Packages WHERE Packages.OutOfDateTS IS NOT NULL AND Packages.MaintainerUID = " . $userid; $flagged_outdated = db_cache_value($q, $dbh, - 'user_flagged_outdated:' . $escuser); + 'user_flagged_outdated:' . $userid); # If the user is a TU calculate the number of the packages $atype = account_from_sid($_COOKIE["AURSID"]); @@ -37,8 +34,7 @@ function user_table($user, $dbh) include('stats/user_table.php'); } -function general_stats_table($dbh) -{ +function general_stats_table($dbh) { # AUR statistics $q = "SELECT count(*) FROM Packages"; $unsupported_count = db_cache_value($q, $dbh, 'unsupported_count'); |