From 36ee5561035af335bc3c900ded7aa89066421226 Mon Sep 17 00:00:00 2001 From: Loui Chang Date: Tue, 24 Jun 2008 02:53:16 -0400 Subject: Move code out of index.php Move database queries to functions and html to templates. Signed-off-by: Loui Chang --- web/html/index.php | 182 +++-------------------------------------------------- 1 file changed, 10 insertions(+), 172 deletions(-) (limited to 'web/html/index.php') diff --git a/web/html/index.php b/web/html/index.php index 7a95abfc..ce5e0091 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -5,66 +5,13 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR # Add to handle the i18n of My Packages include("pkgfuncs_po.inc"); include("aur.inc"); +include('stats.inc'); set_lang(); check_sid(); html_header( __("Home") ); - -# Newest packages -$q = "SELECT * FROM Packages WHERE DummyPkg != 1 ORDER BY GREATEST(SubmittedTS,ModifiedTS) DESC LIMIT 0 , 10"; -$newest_packages = db_query($q, $dbh); - -# AUR statistics -$q = "SELECT count(*) FROM Packages,PackageLocations WHERE Packages.LocationID = PackageLocations.ID AND PackageLocations.Location = 'unsupported'"; -$result = db_query($q, $dbh); -$row = mysql_fetch_row($result); -$unsupported_count = $row[0]; - -$q = "SELECT count(*) FROM Packages,PackageLocations WHERE Packages.LocationID = PackageLocations.ID AND PackageLocations.Location = 'community'"; -$result = db_query($q, $dbh); -$row = mysql_fetch_row($result); -$community_count = $row[0]; - -$q = "SELECT count(*) from Users"; -$result = db_query($q, $dbh); -$row = mysql_fetch_row($result); -$user_count = $row[0]; - -$q = "SELECT count(*) from Users,AccountTypes WHERE Users.AccountTypeID = AccountTypes.ID AND AccountTypes.AccountType = 'Trusted User'"; -$result = db_query($q, $dbh); -$row = mysql_fetch_row($result); -$tu_count = $row[0]; - -$targstamp = intval(strtotime("-7 days")); -$q = "SELECT count(*) from Packages WHERE (Packages.SubmittedTS >= $targstamp OR Packages.ModifiedTS >= $targstamp)"; -$result = db_query($q, $dbh); -$row = mysql_fetch_row($result); -$update_count = $row[0]; - -$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='".mysql_real_escape_string($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='".mysql_real_escape_string($user)."'"; - $result = db_query($q, $dbh); - $row = mysql_fetch_row($result); - $flagged_outdated = $row[0]; - - # 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='".mysql_real_escape_string($user)."'"; - $result = db_query($q, $dbh); - $row = mysql_fetch_row($result); - $maintainer_community_count = $row[0]; - } -} +$dbh = db_connect(); ?> @@ -106,127 +53,19 @@ print __( 'Contributed PKGBUILDs must conform to the %hArch Packaging Sta - - - - - - - - - - - - - - - - -
- -
-"> - - + - + '; +} -if ($mod_int != 0): - $modstring = gmdate("r", $mod_int); -elseif ($sub_int != 0): - $modstring = ' ' . gmdate("r", $sub_int); -else: - $modstring = '(unknown)'; -endif; +general_stats_table($dbh); ?> - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - -
- - - -
- - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- -
- -
- -
- -
@@ -236,4 +75,3 @@ endif; -- cgit v1.2.3-24-g4f1b From 6bae84f34a571da9da0f7c2237be3cc544ecb365 Mon Sep 17 00:00:00 2001 From: Loui Chang Date: Wed, 9 Jul 2008 14:56:15 -0400 Subject: Change some of the index page notices. Signed-off-by: Loui Chang --- web/html/index.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'web/html/index.php') diff --git a/web/html/index.php b/web/html/index.php index ce5e0091..f5e10eeb 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -46,8 +46,8 @@ print __( 'Contributed PKGBUILDs must conform to the %hArch Packaging Sta

-
- +
+

@@ -69,7 +69,12 @@ general_stats_table($dbh); -
+ +
'; +echo __('Unsupported PKGBUILDs are user produced content. Any use of files is at your own risk.'); +?>
+ -- cgit v1.2.3-24-g4f1b From b81e3c2f6814e73973b4d42e66b1d0e58c2943d2 Mon Sep 17 00:00:00 2001 From: Loui Chang Date: Wed, 23 Jul 2008 10:07:53 -0400 Subject: Tweak index.php and update translations. Signed-off-by: Loui Chang --- web/html/index.php | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'web/html/index.php') diff --git a/web/html/index.php b/web/html/index.php index f5e10eeb..c7847f25 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -20,37 +20,36 @@ $dbh = db_connect(); AUR
- - - - +

' - , '' - , '' - , '' +echo __( + 'Welcome to the AUR! Please read the %hAUR User Guidelines%h and %hAUR TU Guidelines%h for more information.', + '', + '', + '', + '' ); ?> -
+
must conform to the %hArch Packaging Standards%h otherwise they will be deleted!' - , '' - , '' +echo __( + 'Contributed PKGBUILDs %hmust%h conform to the %hArch Packaging Standards%h otherwise they will be deleted!', + '', '', + '', + '' ); ?>

- +

-
@@ -70,6 +69,7 @@ general_stats_table($dbh);
+
'; echo __('Unsupported PKGBUILDs are user produced content. Any use of files is at your own risk.'); @@ -80,3 +80,4 @@ echo __('Unsupported PKGBUILDs are user produced content. Any use of files is at