From 4d29be001bd78bc5a1b3edd393e9ce2084d0d882 Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Thu, 12 Jun 2008 01:09:38 +0800 Subject: Split html and php in index.php No more prints, still all in same file Signed-off-by: Callan Barrett --- web/html/index.php | 337 ++++++++++++++++++++++++++++------------------------- 1 file changed, 177 insertions(+), 160 deletions(-) (limited to 'web') diff --git a/web/html/index.php b/web/html/index.php index 54d6004..d0001eb 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -2,84 +2,20 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR . '../lang'); -# include("index_po.inc"); -include("pkgfuncs_po.inc"); # Add to handle the i18n of My Packages +# Add to handle the i18n of My Packages +include("pkgfuncs_po.inc"); include("aur.inc"); + set_lang(); check_sid(); -html_header(__("Home")); - -# Big Top Level Table (Table 1) -echo "
\n"; -echo "
AUR ".__("Home")."
\n"; -echo "
\n"; -echo "\n"; - -# MAIN: Top -echo "\n"; -print ""; -print ""; - -# MAIN: Bottom Left -print ""; -print ""; -print ""; -print "\n"; -print "
"; -print "

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

"; -print "

".__("Remember to vote for your favourite packages!")."
"; -print __("The most popular packages will be provided as binary packages in [community].")."

"; -print "
"; - -#Hey, how about listing the newest pacakges? :D -$q = "SELECT * FROM Packages "; -$q.= "WHERE DummyPkg != 1 "; -$q.= "ORDER BY GREATEST(SubmittedTS,ModifiedTS) DESC "; -$q.= "LIMIT 0 , 10"; -$result = db_query($q,$dbh); -# Table 2 -print ''; -print ''; -print ''; -print ''; - -while ($row = mysql_fetch_assoc($result)) { - print ''; - print ''; - print ''; - print ''."\n"; -} -print ""; -print ""; -print "
'; -print ' '.__("Recent Updates").' '; -print '
'; - - print ''; - print $row["Name"]." ".$row["Version"].""; - - print ''; - - # figure out the mod string - $mod_int = intval($row["ModifiedTS"]); - $sub_int = intval($row["SubmittedTS"]); - if ($mod_int != 0) { - $modstring = gmdate("r", $mod_int); - } - elseif ($sub_int != 0) { - $modstring = ' '.gmdate("r", $sub_int); - } - else { - $mod_string = "(unknown)"; - } - print ''.$modstring.''; - print '
"; -# End Table 2 -# MAIN: Bottom Right -print "
"; +html_header( __("Home") ); -# AUR STATISTICS +# 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); @@ -106,8 +42,6 @@ $result = db_query($q, $dbh); $row = mysql_fetch_row($result); $update_count = $row[0]; -# Added the user statistcs. -# Added by: dsa $user = username_from_sid($_COOKIE["AURSID"]); if (!empty($user)) { @@ -121,22 +55,6 @@ if (!empty($user)) { $row = mysql_fetch_row($result); $flagged_outdated = $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"]); @@ -145,79 +63,178 @@ if (!empty($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 ""; - - print "
"; - print "".__("My 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 ""; - -print ""; -print ""; -print ""; - -print ""; -print ""; -print ""; -print ""; - -print ""; -print ""; -print ""; -print ""; - -print ""; -print ""; -print ""; -print ""; - -print ""; -print ""; -print ""; -print ""; - -print ""; -print ""; -print ""; -print ""; - -print "
"; -print "".__("Statistics").""; -print "
"; -print "".__("Packages in unsupported").""; -print "$unsupported_count
"; -print "".__("Packages in [community]").""; -print "$community_count
"; -print "".__("Packages added or updated in the past 7 days").""; -print "$update_count
"; -print "".__("Registered Users").""; -print "$user_count
"; -print "".__("Trusted Users").""; -print "$tu_count
"; - -# Close out the right column -print "
\n"; -# End Table 1 -echo "
".__("DISCLAIMER").""; -echo "
"; -echo "
"; +?> + +
+
+AUR +
+
+ + + + + + + +
+

+ +' + , '' + , '' + , '' + ); +?> + +
+ +must conform to the %hArch Packaging Standards%h otherwise they will be deleted!' + , '' + , '' + ); +?> + +

+

+ +
+ +

+
+ + + + + + + + + + + + + + + + +
+ +
+"> + + + + + ' . gmdate("r", $sub_int); +else: + $modstring = '(unknown)'; +endif; +?> + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+ + -- cgit v1.2.3-70-g09d2