diff options
author | eric <eric> | 2004-07-10 22:51:56 +0200 |
---|---|---|
committer | eric <eric> | 2004-07-10 22:51:56 +0200 |
commit | d17e406ac61094a0ad6d433c8e24be9b8b140959 (patch) | |
tree | 805443d8b20b0e8057b1f81df59c47382122dc06 | |
parent | ae26c9ce2a0bfe6ed0f5282f08cb672364de1c19 (diff) | |
download | aur-d17e406ac61094a0ad6d433c8e24be9b8b140959.tar.gz aur-d17e406ac61094a0ad6d433c8e24be9b8b140959.tar.xz |
pkgsearch is done (except for some serious debugging)
-rw-r--r-- | web/html/index.php | 4 | ||||
-rw-r--r-- | web/html/pkgsearch.php | 261 | ||||
-rw-r--r-- | web/lang/pkgfuncs_po.inc | 20 | ||||
-rw-r--r-- | web/lang/search_po.inc | 70 | ||||
-rw-r--r-- | web/lib/aur.inc | 1 | ||||
-rw-r--r-- | web/lib/pkgfuncs.inc | 86 |
6 files changed, 410 insertions, 32 deletions
diff --git a/web/html/index.php b/web/html/index.php index 64a1c2f7..7b2213ac 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -86,11 +86,11 @@ print " <td align='left' valign='top' nowrap>\n"; if (!isset($_COOKIE["AURSID"])) { # the user is not logged in, give them login widgets # - print "<form action='/index.php' method='post'>\n"; if ($login_error) { print "<span class='error'>" . $login_error . "</span><br />\n"; } print "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n"; + print "<form action='/index.php' method='post'>\n"; print "<tr>\n"; print "<td>".__("Username:")."</td>"; print "<td><input type='text' name='user' size='30' maxlength='64'></td>"; @@ -104,8 +104,8 @@ if (!isset($_COOKIE["AURSID"])) { print "<input type='submit' class='button'"; print " value='".__("Login")."'></td>"; print "</tr>\n"; - print "</table>\n"; print "</form>\n"; + print "</table>\n"; } else { print __("Logged-in as: %h%s%h", diff --git a/web/html/pkgsearch.php b/web/html/pkgsearch.php index 6524b51c..546ed2b5 100644 --- a/web/html/pkgsearch.php +++ b/web/html/pkgsearch.php @@ -6,11 +6,15 @@ set_lang(); # this sets up the visitor's language check_sid(); # see if they're still logged in html_header(); # print out the HTML header -# define variables used during pkgsearch +# enable debugging # -$pkgsearch_vars = array("O", "L", "C", "K", "SB", "PP", "do_MyPackages"); +$DBUG = 0; +if ($DBUG) { + print "<pre>\n"; + print_r($_REQUEST); + print "</pre>\n"; +} - # get login privileges # if (isset($_COOKIE["AURSID"])) { @@ -24,6 +28,9 @@ if (isset($_COOKIE["AURSID"])) { # grab the list of Package IDs to be operated on # isset($_REQUEST["IDs"]) ? $ids = $_REQUEST["IDs"] : $ids = array(); +#isset($_REQUEST["All_IDs"]) ? +# $all_ids = explode(":", $_REQUEST["All_IDs"]) : +# $all_ids = array(); # determine what button the visitor clicked @@ -34,15 +41,75 @@ if (isset($_REQUEST["do_Flag"])) { print "<br />\n"; } else { - # Flag the packages in $ids array, and unflag any other - # packages listed in $_REQUEST["All_IDs"] - # - print "flagging<br />\n"; + + if (!empty($ids)) { + $dbh = db_connect(); + + # Flag the packages in $ids array + # + $first = 1; + while (list($pid, $v) = each($ids)) { + if ($first) { + $first = 0; + $flag = $pid; + } else { + $flag .= ", ".$pid; + } + } + $q = "UPDATE Packages SET OutOfDate = 1 "; + $q.= "WHERE ID IN (" . $flag . ")"; + db_query($q, $dbh); + + print "<p>\n"; + print __("The selected packages have been flagged out-of-date."); + print "</p>\n"; + } else { + print "<p>\n"; + print __("You did not select any packages to flag."); + print "</p>\n"; + } pkgsearch_results_link(); } +} elseif (isset($_REQUEST["do_UnFlag"])) { + if (!$atype) { + print __("You must be logged in before you can unflag packages."); + print "<br />\n"; + + } else { + + if (!empty($ids)) { + $dbh = db_connect(); + + # Un-Flag the packages in $ids array + # + $first = 1; + while (list($pid, $v) = each($ids)) { + if ($first) { + $first = 0; + $unflag = $pid; + } else { + $unflag .= ", ".$pid; + } + } + $q = "UPDATE Packages SET OutOfDate = 0 "; + $q.= "WHERE ID IN (" . $unflag . ")"; + db_query($q, $dbh); + + print "<p>\n"; + print __("The selected packages have been unflagged."); + print "</p>\n"; + } else { + print "<p>\n"; + print __("You did not select any packages to unflag."); + print "</p>\n"; + } + + pkgsearch_results_link(); + + } } elseif (isset($_REQUEST["do_Disown"])) { if (!$atype) { @@ -52,7 +119,45 @@ if (isset($_REQUEST["do_Flag"])) { } else { # Disown the packages in $ids array # - print "disowning<br />\n"; + if (!empty($ids)) { + $dbh = db_connect(); + + # Disown the packages in $ids array + # + $first = 1; + while (list($pid, $v) = each($ids)) { + if ($first) { + $first = 0; + $disown = $pid; + } else { + $disown .= ", ".$pid; + } + } + $atype = account_from_sid($_COOKIE["AURSID"]); + if ($atype == "Trusted User" || $atype == "Developer") { + $field = "AURMaintainerUID"; + } elseif ($atype == "User") { + $field = "MaintainerUID"; + } else { + $field = ""; + } + + if ($field) { + $q = "UPDATE Packages "; + $q.= "SET ".$field." = 0 "; + $q.= "WHERE ID IN (" . $disown . ") "; + $q.= "AND ".$field." = ".uid_from_sid($_COOKIE["AURSID"]); + db_query($q, $dbh); + } + + print "<p>\n"; + print __("The selected packages have been disowned."); + print "</p>\n"; + } else { + print "<p>\n"; + print __("You did not select any packages to disowned."); + print "</p>\n"; + } pkgsearch_results_link(); @@ -67,7 +172,45 @@ if (isset($_REQUEST["do_Flag"])) { } else { # Adopt the packages in $ids array # - print "adopting<br />\n"; + if (!empty($ids)) { + $dbh = db_connect(); + + # Adopt the packages in $ids array + # + $first = 1; + while (list($pid, $v) = each($ids)) { + if ($first) { + $first = 0; + $adopt = $pid; + } else { + $adopt .= ", ".$pid; + } + } + $atype = account_from_sid($_COOKIE["AURSID"]); + if ($atype == "Trusted User" || $atype == "Developer") { + $field = "AURMaintainerUID"; + } elseif ($atype == "User") { + $field = "MaintainerUID"; + } else { + $field = ""; + } + + if ($field) { + $q = "UPDATE Packages "; + $q.= "SET ".$field." = ".uid_from_sid($_COOKIE["AURSID"])." "; + $q.= "WHERE ID IN (" . $adopt . ") "; + $q.= "AND ".$field." = 0"; + db_query($q, $dbh); + } + + print "<p>\n"; + print __("The selected packages have been adopted."); + print "</p>\n"; + } else { + print "<p>\n"; + print __("You did not select any packages to adopt."); + print "</p>\n"; + } pkgsearch_results_link(); @@ -80,10 +223,102 @@ if (isset($_REQUEST["do_Flag"])) { print "<br />\n"; } else { - # vote on the packages in $ids array. 'unvote' for any packages - # listed in the $_REQUEST["All_IDs"] array. + # vote on the packages in $ids array. + # + if (!empty($ids)) { + $dbh = db_connect(); + $my_votes = pkgvotes_from_sid($_COOKIE["AURSID"]); + $uid = uid_from_sid($_COOKIE["AURSID"]); + # $vote_ids will contain the string of Package.IDs that + # the visitor hasn't voted for already + # + $first = 1; + while (list($pid, $v) = each($ids)) { + if (!isset($my_votes[$pid])) { + # cast a vote for this package + # + if ($first) { + $first = 0; + $vote_ids = $pid; + $vote_clauses = "(".$uid.", ".$pid.")"; + } else { + $vote_ids .= ", ".$pid; + $vote_clauses .= ", (".$uid.", ".$pid.")"; + } + } + } + # only vote for packages the user hasn't already voted for + # + $q = "UPDATE Packages SET NumVotes = NumVotes + 1 "; + $q.= "WHERE ID IN (".$vote_ids.")"; + db_query($q, $dbh); + + $q = "INSERT INTO PackageVotes (UsersID, PackageID) VALUES "; + $q.= $vote_clauses; + db_query($q, $dbh); + + print "<p>\n"; + print __("Your votes have been cast for the selected packages."); + print "</p>\n"; + + } else { + print "<p>\n"; + print __("You did not select any packages to vote for."); + print "</p>\n"; + } + + pkgsearch_results_link(); + + } + + +} elseif (isset($_REQUEST["do_UnVote"])) { + if (!$atype) { + print __("You must be logged in before you can un-vote for packages."); + print "<br />\n"; + + } else { + # un-vote on the packages in $ids array. # - print "voting<br />\n"; + if (!empty($ids)) { + $dbh = db_connect(); + $my_votes = pkgvotes_from_sid($_COOKIE["AURSID"]); + $uid = uid_from_sid($_COOKIE["AURSID"]); + # $unvote_ids will contain the string of Package.IDs that + # the visitor has voted for and wants to unvote. + # + $first = 1; + while (list($pid, $v) = each($ids)) { + if (isset($my_votes[$pid])) { + # cast a un-vote for this package + # + if ($first) { + $first = 0; + $unvote_ids = $pid; + } else { + $unvote_ids .= ", ".$pid; + } + } + } + # only un-vote for packages the user has already voted for + # + $q = "UPDATE Packages SET NumVotes = NumVotes - 1 "; + $q.= "WHERE ID IN (".$unvote_ids.")"; + db_query($q, $dbh); + + $q = "DELETE FROM PackageVotes WHERE UsersID = ".$uid." "; + $q.= "AND PackageID IN (".$unvote_ids.")"; + db_query($q, $dbh); + + print "<p>\n"; + print __("Your votes have been removed from the selected packages."); + print "</p>\n"; + + } else { + print "<p>\n"; + print __("You did not select any packages to un-vote for."); + print "</p>\n"; + } pkgsearch_results_link(); @@ -101,8 +336,6 @@ if (isset($_REQUEST["do_Flag"])) { print "<br />\n"; pkgsearch_results_link(); - print "</center>\n"; - print "<br />\n"; } else { diff --git a/web/lang/pkgfuncs_po.inc b/web/lang/pkgfuncs_po.inc index 72a239b8..054ad917 100644 --- a/web/lang/pkgfuncs_po.inc +++ b/web/lang/pkgfuncs_po.inc @@ -141,4 +141,24 @@ $_t["en"]["Manage"] = "Manage"; # $_t["fr"]["Manage"] = "--> Traduction française ici. <--"; # $_t["de"]["Manage"] = "--> Deutsche Übersetzung hier. <--"; +$_t["en"]["Un-flag Out-of-date"] = "Un-flag Out-of-date"; +# $_t["es"]["Un-flag Out-of-date"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Un-flag Out-of-date"] = "--> Traduction française ici. <--"; +# $_t["de"]["Un-flag Out-of-date"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Unflag Out-of-date"] = "Unflag Out-of-date"; +# $_t["es"]["Unflag Out-of-date"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Unflag Out-of-date"] = "--> Traduction française ici. <--"; +# $_t["de"]["Unflag Out-of-date"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Un-Vote"] = "Un-Vote"; +# $_t["es"]["Un-Vote"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Un-Vote"] = "--> Traduction française ici. <--"; +# $_t["de"]["Un-Vote"] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Yes"] = "Yes"; +# $_t["es"]["Yes"] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Yes"] = "--> Traduction française ici. <--"; +# $_t["de"]["Yes"] = "--> Deutsche Übersetzung hier. <--"; + ?>
\ No newline at end of file diff --git a/web/lang/search_po.inc b/web/lang/search_po.inc index 6714b85a..4e3c5284 100644 --- a/web/lang/search_po.inc +++ b/web/lang/search_po.inc @@ -51,4 +51,74 @@ $_t["en"]["You must be logged in before you can adopt packages."] = "You must be # $_t["fr"]["You must be logged in before you can adopt packages."] = "--> Traduction française ici. <--"; # $_t["de"]["You must be logged in before you can adopt packages."] = "--> Deutsche Übersetzung hier. <--"; +$_t["en"]["The selected packages have been flagged out-of-date."] = "The selected packages have been flagged out-of-date."; +# $_t["es"]["The selected packages have been flagged out-of-date."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["The selected packages have been flagged out-of-date."] = "--> Traduction française ici. <--"; +# $_t["de"]["The selected packages have been flagged out-of-date."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["You did not select any packages to flag."] = "You did not select any packages to flag."; +# $_t["es"]["You did not select any packages to flag."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You did not select any packages to flag."] = "--> Traduction française ici. <--"; +# $_t["de"]["You did not select any packages to flag."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["The selected packages have been unflagged."] = "The selected packages have been unflagged."; +# $_t["es"]["The selected packages have been unflagged."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["The selected packages have been unflagged."] = "--> Traduction française ici. <--"; +# $_t["de"]["The selected packages have been unflagged."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["You must be logged in before you can unflag packages."] = "You must be logged in before you can unflag packages."; +# $_t["es"]["You must be logged in before you can unflag packages."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You must be logged in before you can unflag packages."] = "--> Traduction française ici. <--"; +# $_t["de"]["You must be logged in before you can unflag packages."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["You did not select any packages to unflag."] = "You did not select any packages to unflag."; +# $_t["es"]["You did not select any packages to unflag."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You did not select any packages to unflag."] = "--> Traduction française ici. <--"; +# $_t["de"]["You did not select any packages to unflag."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["You did not select any packages to adopt."] = "You did not select any packages to adopt."; +# $_t["es"]["You did not select any packages to adopt."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You did not select any packages to adopt."] = "--> Traduction française ici. <--"; +# $_t["de"]["You did not select any packages to adopt."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["You did not select any packages to disowned."] = "You did not select any packages to disowned."; +# $_t["es"]["You did not select any packages to disowned."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You did not select any packages to disowned."] = "--> Traduction française ici. <--"; +# $_t["de"]["You did not select any packages to disowned."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["The selected packages have been adopted."] = "The selected packages have been adopted."; +# $_t["es"]["The selected packages have been adopted."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["The selected packages have been adopted."] = "--> Traduction française ici. <--"; +# $_t["de"]["The selected packages have been adopted."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["The selected packages have been disowned."] = "The selected packages have been disowned."; +# $_t["es"]["The selected packages have been disowned."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["The selected packages have been disowned."] = "--> Traduction française ici. <--"; +# $_t["de"]["The selected packages have been disowned."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["You must be logged in before you can un-vote for packages."] = "You must be logged in before you can un-vote for packages."; +# $_t["es"]["You must be logged in before you can un-vote for packages."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You must be logged in before you can un-vote for packages."] = "--> Traduction française ici. <--"; +# $_t["de"]["You must be logged in before you can un-vote for packages."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Your votes have been removed from the selected packages."] = "Your votes have been removed from the selected packages."; +# $_t["es"]["Your votes have been removed from the selected packages."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Your votes have been removed from the selected packages."] = "--> Traduction française ici. <--"; +# $_t["de"]["Your votes have been removed from the selected packages."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["You did not select any packages to vote for."] = "You did not select any packages to vote for."; +# $_t["es"]["You did not select any packages to vote for."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You did not select any packages to vote for."] = "--> Traduction française ici. <--"; +# $_t["de"]["You did not select any packages to vote for."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["You did not select any packages to un-vote for."] = "You did not select any packages to un-vote for."; +# $_t["es"]["You did not select any packages to un-vote for."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["You did not select any packages to un-vote for."] = "--> Traduction française ici. <--"; +# $_t["de"]["You did not select any packages to un-vote for."] = "--> Deutsche Übersetzung hier. <--"; + +$_t["en"]["Your votes have been cast for the selected packages."] = "Your votes have been cast for the selected packages."; +# $_t["es"]["Your votes have been cast for the selected packages."] = "--> Traducción española aquí. <--"; +# $_t["fr"]["Your votes have been cast for the selected packages."] = "--> Traduction française ici. <--"; +# $_t["de"]["Your votes have been cast for the selected packages."] = "--> Deutsche Übersetzung hier. <--"; + ?>
\ No newline at end of file diff --git a/web/lib/aur.inc b/web/lib/aur.inc index 26e538ad..005c5642 100644 --- a/web/lib/aur.inc +++ b/web/lib/aur.inc @@ -423,6 +423,7 @@ function html_header() { # function html_footer($ver="") { print "\n\n<!-- End of main content -->\n"; + print " <br />\n"; print " </td>\n"; print " </tr>\n"; print "</table>\n"; diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index ae306577..0b7a0003 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -1,14 +1,20 @@ <? include_once("pkgfuncs_po.inc"); +# define variables used during pkgsearch +# +$pkgsearch_vars = array("O", "L", "C", "K", "SB", "PP", "do_MyPackages"); + + # print out the 'return to search results' link # function pkgsearch_results_link() { + global $_REQUEST; global $pkgsearch_vars; $url_data = "<a href='/pkgsearch.php?do_Search=1"; while (list($k, $var) = each($pkgsearch_vars)) { - if ($var == "do_MyPackages") { + if ($var == "do_MyPackages" && $_REQUEST[$var]) { $url_data.="&".$var."=1"; } else { $url_data.="&".$var."=".rawurlencode(stripslashes($_REQUEST[$var])); @@ -17,6 +23,7 @@ function pkgsearch_results_link() { $url_data .= "'>"; print __("Go back to %hsearch results%h.", array($url_data, "</a>")); + print "\n<br />\n"; return; } @@ -113,9 +120,32 @@ function package_sources($pkgid=0) { return $sources; } + +# grab array of Package.IDs that I've voted for: $pkgs[1234] = 1, ... +# +function pkgvotes_from_sid($sid="") { + $pkgs = array(); + if (!$sid) {return $pkgs;} + $dbh = db_connect(); + $q = "SELECT PackageID "; + $q.= "FROM PackageVotes, Users, Sessions "; + $q.= "WHERE Users.ID = Sessions.UsersID "; + $q.= "AND Users.ID = PackageVotes.UsersID "; + $q.= "AND Sessions.SessionID = '".mysql_escape_string($sid)."'"; + $result = db_query($q, $dbh); + if ($result) { + while ($row = mysql_fetch_row($result)) { + $pkgs[$row[0]] = 1; + } + } + return $pkgs; +} + + # display package details # function package_details($id=0) { + global $_REQUEST; global $pkgsearch_vars; $q = "SELECT *,Location,Category "; $q.= "FROM Packages,PackageLocations,PackageCategories "; @@ -190,7 +220,11 @@ function package_details($id=0) { while (list($k, $darr) = each($deps)) { $url = "<a href='/pkgsearch.php?do_Details=1&ID=".$darr[0]; while(list($k, $var) = each($pkgsearch_vars)) { - $url .= "&".$var."=".rawurlencode(stripslashes($_REQUEST[$var])); + if ($var == "do_MyPackages" && $_REQUEST[$var]) { + $url .= "&".$var."=1"; + } else { + $url .= "&".$var."=".rawurlencode(stripslashes($_REQUEST[$var])); + } } reset($pkgsearch_vars); print $url."'>".$darr[1]."</a><br />\n"; @@ -252,12 +286,13 @@ function pkg_search_page($SID="") { if ($O < 0) { $O = 0; } - if ($_REQUEST["do_Search"]) { - # reset the offset to zero if they hit Go/My Packages + if ($_REQUEST["do_Search"] && $_REQUEST["do_Search"] != 1) { + # reset the offset to zero if they hit Go # $_REQUEST["do_MyPackages"] = 0; $O = 0; } + $_REQUEST["O"] = $O; # so that pkg_search_results() works # grab info for user if they're logged in @@ -265,6 +300,7 @@ function pkg_search_page($SID="") { if ($SID) { $myuid = uid_from_sid($SID); $acct = account_from_sid($SID); + $my_votes = pkgvotes_from_sid($SID); } # The search form @@ -438,10 +474,6 @@ function pkg_search_page($SID="") { break; } $q.= "LIMIT ".$O.", ".$PP; - print $q."<br />\n"; - print "<pre>\n"; - print_r($_REQUEST); - print "</pre>\n"; $result = db_query($q, $dbh); if (!$result) { @@ -470,6 +502,9 @@ function pkg_search_page($SID="") { print "<input type='submit' class='button' name='do_Flag'"; print " value='".__("Flag Out-of-date")."'></td>\n"; print " <td align='center'>"; + print "<input type='submit' class='button' name='do_UnFlag'"; + print " value='".__("Unflag Out-of-date")."'></td>\n"; + print " <td align='center'>"; print "<input type='submit' class='button' name='do_Adopt'"; print " value='".__("Adopt Packages")."'></td>\n"; print " <td align='center'>"; @@ -478,6 +513,9 @@ function pkg_search_page($SID="") { print " <td align='center'>"; print "<input type='submit' class='button' name='do_Vote'"; print " value='".__("Vote")."'></td>\n"; + print " <td align='center'>"; + print "<input type='submit' class='button' name='do_UnVote'"; + print " value='".__("Un-Vote")."'></td>\n"; print "</tr>\n"; print "</table>\n"; print " </td>\n"; @@ -512,6 +550,10 @@ function pkg_search_page($SID="") { print " bottom'><span class='f2'>".__("Name")."</span></th>\n"; print " <th style='border-bottom: #666 1px solid; vertical-align:"; print " bottom'><span class='f2'>".__("Votes")."</span></th>\n"; + if ($SID) { + print " <th style='border-bottom: #666 1px solid; vertical-align:"; + print " bottom'><span class='f2'>".__("Vote")."</span></th>\n"; + } print " <th style='border-bottom: #666 1px solid; vertical-align:"; print " bottom'><span class='f2'>".__("Description")."</span></th>\n"; print " <th style='border-bottom: #666 1px solid; vertical-align:"; @@ -530,12 +572,12 @@ function pkg_search_page($SID="") { if ($row["OutOfDate"]) { print "<span style='background-color: red'>"; } - print "<input type='checkbox' name='IDs[]' value='".$row["ID"]."'>"; - if ($i == 0) { - $all_ids = $row["ID"]; - } else { - $all_ids .= ":".$row["ID"]; - } + print "<input type='checkbox' name='IDs[".$row["ID"]."]' value='1'>"; +# if ($i == 0) { +# $all_ids = $row["ID"]; +# } else { +# $all_ids .= ":".$row["ID"]; +# } if ($row["OutOfDate"]) { print "</span>"; } @@ -554,7 +596,11 @@ function pkg_search_page($SID="") { # php.net recommends htmlentities(urlencode(data)), but that # doesn't work! # - $url .= "&".$var."=".rawurlencode(stripslashes($_REQUEST[$var])); + if ($var == "do_MyPackages" && $_REQUEST[$var]) { + $url .= "&".$var."=1"; + } else { + $url .= "&".$var."=".rawurlencode(stripslashes($_REQUEST[$var])); + } } reset($pkgsearch_vars); $url.= "'><span class='black'>".$row["Name"]; @@ -562,6 +608,14 @@ function pkg_search_page($SID="") { print $url."</span></td>\n"; print " <td class='".$c."'><span class='f5'><span class='blue'>"; print " ".$row["NumVotes"]."</span></span></td>\n"; + if ($SID) { + print " <td class='".$c."'><span class='f5'><span class='blue'>"; + if (isset($my_votes[$row["ID"]])) { + print " ".__("Yes")."</span></td>\n"; + } else { + print " </span></td>\n"; + } + } print " <td class='".$c."'><span class='f4'><span class='blue'>"; print $row["Description"]."</span></span></td>\n"; print " <td class='".$c."'><span class='f5'><span class='blue'>"; @@ -598,7 +652,7 @@ function pkg_search_page($SID="") { print " </td>\n"; print "</tr>\n"; print "</table>\n"; - print "<input type='hidden' name='All_IDs' value='".$all_ids."'>\n"; +# print "<input type='hidden' name='All_IDs' value='".$all_ids."'>\n"; if ($_REQUEST["do_MyPackages"]) { print "<input type='hidden' name='do_MyPackages' value='1'>\n"; } |