summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/html/account.php6
-rw-r--r--web/html/index.php4
-rw-r--r--web/html/logout.php2
-rw-r--r--web/html/pkgmgmnt.php2
-rw-r--r--web/html/pkgsearch.php2
-rw-r--r--web/html/pkgsubmit.php2
-rw-r--r--web/html/pkgvote.php2
-rw-r--r--web/html/template.php2
-rw-r--r--web/html/testpo.php4
-rw-r--r--web/lib/acctfuncs.inc2
-rw-r--r--web/lib/aur.inc52
-rw-r--r--web/lib/pkgs.inc114
12 files changed, 161 insertions, 33 deletions
diff --git a/web/html/account.php b/web/html/account.php
index a00a5e5..0975ab7 100644
--- a/web/html/account.php
+++ b/web/html/account.php
@@ -29,7 +29,7 @@ if (isset($_COOKIE["AURSID"])) {
} else {
# a non-privileged user is trying to access the search page
#
- print __("You are not allowed to access this area.")."<br/>\n";
+ print __("You are not allowed to access this area.")."<br />\n";
}
} elseif ($_REQUEST["Action"] == "DisplayAccount") {
@@ -73,7 +73,7 @@ if (isset($_COOKIE["AURSID"])) {
if ($atype == "Trusted User" || $atype == "Developer") {
# display the search page if they're a TU/dev
#
- print __("Use this form to search existing accounts.")."<br/>\n";
+ print __("Use this form to search existing accounts.")."<br />\n";
search_accounts_form();
} else {
@@ -96,7 +96,7 @@ if (isset($_COOKIE["AURSID"])) {
# normal user editing themselves.
#
print __("Use this form to update your account.");
- print "<br/>";
+ print "<br />";
print __("Leave the password fields blank to keep your same password.");
display_account_form($atype, "UpdateAccount", $row["Username"],
$row["AccountType"], $row["Suspended"], $row["Email"],
diff --git a/web/html/index.php b/web/html/index.php
index 09e87cc..67ff657 100644
--- a/web/html/index.php
+++ b/web/html/index.php
@@ -85,7 +85,7 @@ if (!isset($_COOKIE["AURSID"])) {
#
print "<form action='/index.php' method='post'>\n";
if ($login_error) {
- print "<span class='error'>" . $login_error . "</span><br/>\n";
+ print "<span class='error'>" . $login_error . "</span><br />\n";
}
print "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
print "<tr>\n";
@@ -97,7 +97,7 @@ if (!isset($_COOKIE["AURSID"])) {
print "<td><input type='password' name='pass' size='30' maxlength='32'></td>";
print "</tr>\n";
print "<tr>\n";
- print "<td colspan='2' align='right'>&nbsp;<br/>";
+ print "<td colspan='2' align='right'>&nbsp;<br />";
print "<input type='submit' class='button'";
print " value='".__("Login")."'></td>";
print "</tr>\n";
diff --git a/web/html/logout.php b/web/html/logout.php
index a81c645..a25da7c 100644
--- a/web/html/logout.php
+++ b/web/html/logout.php
@@ -15,7 +15,7 @@ if (isset($_COOKIE["AURSID"])) {
}
html_header(); # print out the HTML header
-print __("You have been successfully logged out.")."<br/>\n";
+print __("You have been successfully logged out.")."<br />\n";
html_footer("\$Id$");
diff --git a/web/html/pkgmgmnt.php b/web/html/pkgmgmnt.php
index b1768db..5544016 100644
--- a/web/html/pkgmgmnt.php
+++ b/web/html/pkgmgmnt.php
@@ -9,7 +9,7 @@ html_header(); # print out the HTML header
# Any text you print out to the visitor, use the __() function
# for i18n support. See 'testpo.php' for more details.
#
-print __("Under construction...")."<br/>\n";
+print __("Under construction...")."<br />\n";
html_footer("\$Id$");
diff --git a/web/html/pkgsearch.php b/web/html/pkgsearch.php
index b47ee95..6b23265 100644
--- a/web/html/pkgsearch.php
+++ b/web/html/pkgsearch.php
@@ -38,7 +38,7 @@ if ($atype && $_REQUEST["Action"] == "Something") {
#
pkg_search_page();
}
-print __("Under construction...")."<br/>\n";
+print __("Under construction...")."<br />\n";
html_footer("\$Id$");
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index c9465a1..60b6dc5 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -9,7 +9,7 @@ html_header(); # print out the HTML header
# Any text you print out to the visitor, use the __() function
# for i18n support. See 'testpo.php' for more details.
#
-print __("Under construction...")."<br/>\n";
+print __("Under construction...")."<br />\n";
html_footer("\$Id$");
diff --git a/web/html/pkgvote.php b/web/html/pkgvote.php
index 594ec16..eed4a35 100644
--- a/web/html/pkgvote.php
+++ b/web/html/pkgvote.php
@@ -9,7 +9,7 @@ html_header(); # print out the HTML header
# Any text you print out to the visitor, use the __() function
# for i18n support. See 'testpo.php' for more details.
#
-print __("Under construction...")."<br/>\n";
+print __("Under construction...")."<br />\n";
html_footer("\$Id$");
diff --git a/web/html/template.php b/web/html/template.php
index 9ae001e..2a870ec 100644
--- a/web/html/template.php
+++ b/web/html/template.php
@@ -9,7 +9,7 @@ html_header(); # print out the HTML header
# Any text you print out to the visitor, use the __() function
# for i18n support. See 'testpo.php' for more details.
#
-print __("Hi, this is worth reading!")."<br/>\n";
+print __("Hi, this is worth reading!")."<br />\n";
html_footer("\$Id$"); # Use the $Id$ keyword
diff --git a/web/html/testpo.php b/web/html/testpo.php
index 7f2f1d9..64c4b3e 100644
--- a/web/html/testpo.php
+++ b/web/html/testpo.php
@@ -34,8 +34,8 @@ print __("My current language tag is: '%s'.", array($LANG));
print "</p>\n";
print "<ul>\n";
-print __("Hello, world!")."<br/>\n";
-print __("Hello, again!")."<br/>\n";
+print __("Hello, world!")."<br />\n";
+print __("Hello, again!")."<br />\n";
print "</ul>\n";
print "</body>\n</html>";
diff --git a/web/lib/acctfuncs.inc b/web/lib/acctfuncs.inc
index a7c6da5..9cd7fab 100644
--- a/web/lib/acctfuncs.inc
+++ b/web/lib/acctfuncs.inc
@@ -139,7 +139,7 @@ function display_account_form($UTYPE,$A,$U="",$T="",$S="",
print "<input type='submit' class='button'";
print " value='".__("Create")."'> &nbsp; ";
}
- print "<input type='reset' value='".__("Reset")."'>";
+ print "<input type='reset' class='button' value='".__("Reset")."'>";
print "</td>";
print "</tr>\n";
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index ce3b7d9..39c5c92 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -22,6 +22,40 @@ $SUPPORTED_LANGS = array( # what languages we have translations for
$QBUG = 1; # toggle query logging to /tmp/aurq.log
$DBUG = 1; # use dbug($msg) to log to /tmp/aurd.log
+
+# return an array of info for each Trusted user
+#
+function getTrustedUsers() {
+ $tus = array();
+ $dbh = db_connect();
+ $q = "SELECT * FROM Users WHERE AccountTypeID = 2 ";
+ $q.= "ORDER BY Username ASC";
+ $result = db_query($q, $dbh);
+ if ($result) {
+ while ($row = mysql_fetch_assoc($result)) {
+ $tus[] = $row;
+ }
+ }
+ return $tus;
+}
+
+
+# return an array of info for each Developer
+#
+function getDevelopers() {
+ $devs = array();
+ $dbh = db_connect();
+ $q = "SELECT * FROM Users WHERE AccountTypeID = 3 ";
+ $q.= "ORDER BY Username ASC";
+ $result = db_query($q, $dbh);
+ if ($result) {
+ while ($row = mysql_fetch_assoc($result)) {
+ $devs[] = $row;
+ }
+ }
+ return $devs;
+}
+
# see if the visitor is already logged in
#
function check_sid() {
@@ -261,15 +295,19 @@ function set_lang() {
#
function html_header() {
global $_COOKIE;
+ global $LANG;
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
- print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
- print "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">";
+ print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"";
+ print " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
+ print "<html xmlns=\"http://www.w3.org/1999/xhtml\"";
+ print " xml:lang=\"".$LANG."\" lang=\"".$LANG."\">\n";
print "<head>\n";
- print "<title>AUR</title>\n";
+ print "<title>AUR (".$LANG.")</title>\n";
print "<link rel='stylesheet' type='text/css' href='/css/fonts.css'/>\n";
print "<link rel='stylesheet' type='text/css' href='/css/containers.css'/>\n";
print "<link rel='shortcut icon' href='/images/favicon.ico'/>\n";
- print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n";
+ print "<meta http-equiv=\"Content-Type\"";
+ print " content=\"text/html; charset=UTF-8\" />\n";
print "</head>\n";
print "<body bgcolor='white'>\n";
print "<table cellspacing='0' ";
@@ -287,9 +325,9 @@ function html_header() {
# XXX Can I scale a PNG like this?
#
- print "<img src='/images/AUR-logo-80.png' width='85' height='45' border='0'></a></td>\n";
+ print "<img src='/images/AUR-logo-80.png' width='85' height='45' border='0' /></a></td>\n";
print " <td class='headerDisplay' valign='top' align='right'>";
- print "<span class='preHeader'>ArchLinux User-community Repository</span><br/>";
+ print "<span class='preHeader'>ArchLinux User-community Repository</span><br />";
# XXX CSS help - a:link, a:visited, etc are defined, but I don't want to
# use the defaults. Is this the way to override them?
@@ -333,7 +371,7 @@ function html_header() {
print " </tr>";
print " <tr>\n";
print " <td class='contentDisplay'>\n";
- print " &nbsp;<br/>\n";
+ print " &nbsp;<br />\n";
print "<!-- Start of main content -->\n\n";
return;
diff --git a/web/lib/pkgs.inc b/web/lib/pkgs.inc
index e26d455..bd63ee2 100644
--- a/web/lib/pkgs.inc
+++ b/web/lib/pkgs.inc
@@ -35,14 +35,18 @@ function pkgLocations() {
# display the search form in a boxSoft style
#
-function pkg_search_page($L="",$C="",$K="",$SB="",$PP="") {
+function pkg_search_page($L="",$C="",$K="",$SB="",$O=0,$PP=25) {
# L: PackageLocations.ID
# C: PackageCategories.ID
# K: Keywords
# SB: Sort by
+ # O: Row offset
# PP: Per page
$locs = pkgLocations();
$cats = pkgCategories();
+ $devs = getDevelopers();
+ $tus = getTrustedUsers();
+ $dbh = db_connect();
print "<center>\n";
print "<table cellspacing='3' class='boxSoft'>\n";
@@ -60,7 +64,7 @@ function pkg_search_page($L="",$C="",$K="",$SB="",$PP="") {
print "<tr>\n";
print "<td align='right'>\n";
print " <span class='f5'><span class='blue'>".__("Location");
- print "</span></span><br>\n";
+ print "</span></span><br />\n";
print " <select name='L'>\n";
print " <option value=0> ".__("Any")."\n";
while (list($id, $loc) = each($locs)) {
@@ -75,7 +79,7 @@ function pkg_search_page($L="",$C="",$K="",$SB="",$PP="") {
print "<td align='right'>\n";
print " <span class='f5'><span class='blue'>".__("Category");
- print "</span></span><br>\n";
+ print "</span></span><br />\n";
print " <select name='C'>\n";
print " <option value=0> ".__("Any")."\n";
while (list($id, $cat) = each($cats)) {
@@ -90,27 +94,24 @@ function pkg_search_page($L="",$C="",$K="",$SB="",$PP="") {
print "<td align='right'>\n";
print " <span class='f5'><span class='blue'>".__("Keywords");
- print "</span></span><br>\n";
+ print "</span></span><br />\n";
print " <input type='text' name='K' size='35'";
print " value='".$K."' maxlength='35'>\n";
print "</td>\n";
print "<td align='right'>\n";
print " <span class='f5'><span class='blue'>".__("Sort by");
- print "</span></span><br>\n";
+ print "</span></span><br />\n";
print " <select name='SB'>\n";
+ print " <option value=n";
+ $SB == "n" ? print "selected> " : print "> ";
+ print __("Name")."\n";
print " <option value=c";
$SB == "c" ? print "selected> " : print "> ";
print __("Category")."\n";
print " <option value=l";
$SB == "l" ? print "selected> " : print "> ";
print __("Location")."\n";
- print " <option value=m";
- $SB == "m" ? print "selected> " : print "> ";
- print __("Maintainer")."\n";
- print " <option value=n";
- $SB == "n" ? print "selected> " : print "> ";
- print __("Name")."\n";
print " <option value=p";
$SB == "p" ? print "selected> " : print "> ";
print __("Popularity")."\n";
@@ -119,7 +120,7 @@ function pkg_search_page($L="",$C="",$K="",$SB="",$PP="") {
print "<td align='right'>\n";
print " <span class='f5'><span class='blue'>".__("Per page");
- print "</span></span><br>\n";
+ print "</span></span><br />\n";
print " <select name='PP'>\n";
print " <option value=25";
$PP == 25 ? print "selected> 25\n" : print "> 25\n";
@@ -138,11 +139,100 @@ function pkg_search_page($L="",$C="",$K="",$SB="",$PP="") {
print "</tr>\n";
print "</table>\n";
+
print "</form>\n";
print " </td>\n";
print "</tr>\n";
print "</table>\n";
print "</center>\n";
+ print "<br />\n";
+
+ print "<center>\n";
+ print "<table cellspacing='3' class='boxSoft'>\n";
+ print "<tr>\n";
+ print " <td class='boxSoftTitle' align='right'>\n";
+ print " <span class='f3'Package Listing</span>\n";
+ print " </td>\n";
+ print " <td class='boxSoft'>\n";
+
+ # query to pull out package info
+ #
+ $q = "SELECT Packages.*, IF(ISNULL(PackageID), 0, COUNT(*)) AS Popularity ";
+ $q.= "FROM Packages LEFT JOIN PackageVotes ";
+ $q.= "ON Packages.ID = PackageVotes.PackageID ";
+ $has_where = 0;
+ if ($L) {
+ $q.= "WHERE LocationID = ".intval($L)." ";
+ $has_where = 1;
+ }
+ if ($C) {
+ if (!$has_where) {
+ $q.= "WHERE CategoryID = ".intval($C)." ";
+ $has_where = 1;
+ } else {
+ $q.= "AND CategoryID = ".intval($C)." ";
+ }
+ }
+ if ($K) {
+ if (!$has_where) {
+ $q.= "WHERE (Name LIKE '".mysql_escape_string($K)."%' OR ";
+ $q.= "Description LIKE '%".mysql_escape_string($K)."%') ";
+ $has_where = 1;
+ } else {
+ $q.= "AND (Name LIKE '".mysql_escape_string($K)."%' OR ";
+ $q.= "Description LIKE '%".mysql_escape_string($K)."%') ";
+ }
+ }
+
+ $q.= "GROUP BY PackageID ";
+ switch ($SB) {
+ case 'c':
+ $q.= "ORDER BY CategoryID ASC, Name ASC, LocationID ASC ";
+ break;
+ case 'l':
+ $q.= "ORDER BY LocationID ASC, Name ASC, CategoryID ASC ";
+ break;
+ default:
+ $q.= "ORDER BY Name ASC, LocationID ASC, CategoryID ASC ";
+ break;
+ }
+ $q.= "LIMIT ".intval($O).", ".intval($PP);
+ $result = db_query($q, $dbh);
+ if (!$result) {
+ print $q."<br />\n";
+ print __("No packages matched your search criteria.");
+ } else {
+
+ # print out package search results
+ #
+ print "<center>\n";
+ print "<table cellspacing='3' class='boxSoft'>\n";
+ print "<tr>\n";
+ print " <td class='boxSoftTitle' align='right'>\n";
+ print " <span class='f3'Package Listing</span>\n";
+ print " </td>\n";
+ print " <td class='boxSoft'>\n";
+
+# for ($i=0; $row = mysql_fetch_assoc($result); $i++) {
+# (($i % 2) == 0) ? $c = "data1" : $c = "data2";
+# print "<tr>\n";
+# print "<td ";
+# print "</tr>\n";
+#
+# }
+ print "Yippie! You found some packages!";
+
+ print " </td>\n";
+ print "</tr>\n";
+ print "</table>\n";
+ print "</center>\n";
+ }
+
+
+ print " </td>\n";
+ print "</tr>\n";
+ print "</table>\n";
+ print "</center>\n";
return;
}