diff options
author | simo <simo> | 2005-05-06 03:58:26 +0000 |
---|---|---|
committer | simo <simo> | 2005-05-06 03:58:26 +0000 |
commit | ed17d0f69e3f8f88ed8f23ad12543022636fd87a (patch) | |
tree | 1d9b6eecf3f6694a116754178af3e7f60aa6a5af /web/lib | |
parent | 90eadf0252fcb7358b7e915bae8dc57e70c65750 (diff) | |
download | aurweb-ed17d0f69e3f8f88ed8f23ad12543022636fd87a.tar.xz |
Added vote button to detail page (bug#2638)
X's only show up if user can delete comment
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/pkgfuncs.inc | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index dd168da..b0e570f 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -246,7 +246,7 @@ function pkgvotes_from_sid($sid="") { # display package details # -function package_details($id=0) { +function package_details($id=0, $SID="") { global $_REQUEST; global $pkgsearch_vars; $q = "SELECT Packages.*,Location,Category "; @@ -392,10 +392,12 @@ function package_details($id=0) { print " <td valign='top' style='padding-right: 10' colspan='2'>"; print "<table class='boxSoft' width='100%'>"; print "<tr><td class='boxSoftTitle'><span class='f3'>"; - $durl = "<a href='/pkgedit.php?del_Comment=1"; - $durl.= "&comment_id=".$carr["ID"]."&ID=".$row["ID"]; - $durl.= "'><img src='/images/x.png' border='0'"; - $durl.= " alt=\"".__("Delete comment")."\"></a>"; + if (canDeleteComment($carr["ID"], account_from_sid($SID), $SID)) { + $durl = "<a href='/pkgedit.php?del_Comment=1"; + $durl.= "&comment_id=".$carr["ID"]."&ID=".$row["ID"]; + $durl.= "'><img src='/images/x.png' border='0'"; + $durl.= " alt=\"".__("Delete comment")."\"></a>"; + } print $durl . " "; print __("Comment by: %h%s%h on %h%s%h", array("<b>",$carr["UserName"],"</b>", @@ -423,6 +425,21 @@ function package_details($id=0) { print __("Add Comment")."\">"; print "</form>\n"; print " </td>"; + if ($SID) { + print "<td><form action='/packages.php' method='post'>\n"; + print "<input type='hidden' name='IDs[".$row["ID"]."]' value='1'>\n"; + print "<input type='hidden' name='ID' value='".$row["ID"]."'>\n"; + $q = "SELECT * FROM PackageVotes WHERE UsersID = ".uid_from_sid($SID); + $q.= " AND PackageID = ".$row["ID"]; + if (!mysql_num_rows(db_query($q, $dbh))) { + print "<input type='submit' class='button' name='do_Vote'"; + print " value='".__("Vote")."'>"; + } else { + print "<input type='submit' class='button' name='do_UnVote'"; + print " value='".__("Un-Vote")."'>"; + } + print "</form></td>\n"; + } print "</tr>\n"; print "</table>\n"; |