From 7fccb8b634118a2f4f92220b194dc74273b15957 Mon Sep 17 00:00:00 2001 From: eric Date: Sun, 20 Mar 2005 18:54:20 +0000 Subject: added comments/category editing, and closed #2280 --- web/lib/pkgfuncs.inc | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) (limited to 'web/lib/pkgfuncs.inc') diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 00831de8..a72b5f5a 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -6,6 +6,17 @@ include_once("pkgfuncs_po.inc"); $pkgsearch_vars = array("O", "L", "C", "K", "SB", "PP", "do_MyPackages"); +# print out the 'return to package details' link +# +function pkgdetails_link($id=0) { + $url_data = ""; + print __("Go back to %hpackage details view%h.", + array($url_data, "")); + print "\n
\n"; + return; +} + + # print out the 'return to search results' link # function pkgsearch_results_link() { @@ -28,6 +39,30 @@ function pkgsearch_results_link() { return; } +# Make sure this visitor can delete the requested package comment +# They can delete if they were the comment submitter, or if they are a TU/Dev +# +function canDeleteComment($comment_id=0, $atype="", $SID="") { + if ($atype == "Trusted User" || $atype == "Developer") { + # A TU/Dev can delete any comment + # + return TRUE; + } + $uid = uid_from_sid($SID); + $dbh = db_connect(); + $q = "SELECT COUNT(ID) AS CNT "; + $q.= "FROM PackageComments "; + $q.= "WHERE ID = " . intval($comment_id); + $q.= " AND UsersID = " . $uid; + $result = db_query($q, $dbh); + if ($result != NULL) { + $row = mysql_fetch_assoc($result); + if ($row['CNT'] > 0) { + return TRUE; + } + } + return FALSE; +} # see if this Users.ID can manage the package # @@ -154,7 +189,7 @@ function package_comments($pkgid=0) { $comments = array(); if ($pkgid) { $dbh = db_connect(); - $q = "SELECT UserName, Comments, CommentTS "; + $q = "SELECT PackageComments.ID, UserName, Comments, CommentTS "; $q.= "FROM PackageComments, Users "; $q.= "WHERE PackageComments.UsersID = Users.ID"; $q.= " AND PackageID = ".mysql_escape_string($pkgid); @@ -261,7 +296,11 @@ function package_details($id=0) { print "\n"; print "\n"; print " "; - print $row["Location"]." :: ".$row["Category"].""; + $edit_cat = "".$row["Category"].""; + $edit_cat .= "  ("; + $edit_cat .= __("change category").")"; + print $row["Location"]." :: ".$edit_cat.""; print "\n"; print "\n"; print " ".__("Maintainer").": "; @@ -344,10 +383,15 @@ function package_details($id=0) { print " "; print ""; print "\n"; + print ""; print "\n"; -- cgit v1.2.3-24-g4f1b
"; + $durl = ""; + print $durl . "  "; print __("Comment by: %h%s%h on %h%s%h", array("",$carr["UserName"],"", "",date("Ymd [H:i:s]",$carr["CommentTS"]),"")); - print "
"; print "
\n";
 					print str_replace('"',""", stripslashes($carr["Comments"]));
@@ -783,7 +827,7 @@ function pkg_search_page($SID="") {
 			} elseif (isset($tus[$row["MaintainerUID"]])) {
 				print $tus[$row["MaintainerUID"]]["Username"];
 			} else {
-				print "None";
+				print __("None");
 				$managed = 0;
 			}
 			print "