From 6010f4db02bf2521ad4436aa0ae3786c0657807e Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 29 May 2005 21:08:33 +0000 Subject: [PATCH] r209: Allow comments to be hidden --- docs/schema_changes.sql | 4 +++- editcomment.php | 4 +++- showreport.php | 3 ++- templates/default/editcomment.tpl | 1 + templates/default/showreport_comment.tpl | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/schema_changes.sql b/docs/schema_changes.sql index 90efbcb..ab76e7a 100644 --- a/docs/schema_changes.sql +++ b/docs/schema_changes.sql @@ -50,4 +50,6 @@ CREATE TABLE `bugvaluefill` ( PRIMARY KEY (`bugid`) ); -ALTER TABLE `bug` ADD `hidden` INT(2) UNSIGNED NOT NULL AFTER `assignedto`; \ No newline at end of file +ALTER TABLE `bug` ADD `hidden` INT(2) UNSIGNED NOT NULL AFTER `assignedto`; + +ALTER TABLE `comment` ADD `hidden` INT(2) UNSIGNED NOT NULL; \ No newline at end of file diff --git a/editcomment.php b/editcomment.php index 97ea40c..76573b1 100644 --- a/editcomment.php +++ b/editcomment.php @@ -82,7 +82,8 @@ if ($_POST['do'] == 'update') $db->query(" UPDATE " . TABLE_PREFIX . "comment SET comment = '" . $bugsys->in['comment'] . "', - comment_parsed = '" . nl2br($bugsys->in['comment_parsed']) . "' + comment_parsed = '" . nl2br($bugsys->in['comment_parsed']) . "', + hidden = " . intval($bugsys->in['hidden']) . " WHERE commentid = $comment[commentid]" ); @@ -93,6 +94,7 @@ if ($_POST['do'] == 'update') $log->language = 'log_update_comment'; $log->arguments = array($comment['commentid']); $log->log(); + $log->log($log->diff('hidden', $comment['hidden'], intval($bugsys->in['hidden']))); $message->redirect('comment saved', "showreport.php?bugid=$bug[bugid]"); } diff --git a/showreport.php b/showreport.php index 6072e1e..a93a24c 100644 --- a/showreport.php +++ b/showreport.php @@ -144,7 +144,8 @@ $comments_fetch = $db->query(" FROM " . TABLE_PREFIX . "comment AS comment LEFT JOIN " . TABLE_PREFIX . "user AS user ON (comment.userid = user.userid) - WHERE comment.bugid = $bug[bugid] + WHERE comment.bugid = $bug[bugid]" . ((!can_perform('canviewhidden')) ? " + AND !hidden" : '') . " ORDER BY comment.dateline ASC" ); while ($comment = $db->fetch_array($comments_fetch)) diff --git a/templates/default/editcomment.tpl b/templates/default/editcomment.tpl index c29e4f7..11e7e5c 100644 --- a/templates/default/editcomment.tpl +++ b/templates/default/editcomment.tpl @@ -5,6 +5,7 @@
+
style="color: red">Hidden: checked="checked" />
Comment:
diff --git a/templates/default/showreport_comment.tpl b/templates/default/showreport_comment.tpl index feb811b..bc068e3 100644 --- a/templates/default/showreport_comment.tpl +++ b/templates/default/showreport_comment.tpl @@ -2,6 +2,7 @@ $comment[posttime] + Hidden $comment[postby] -- 2.43.5