2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 $fetchtemplates = array(
17 define('SVN', '$Id$');
19 $focus['showreport'] = 'focus';
21 require_once('./global.php');
23 $comment = $db->query_first("
24 SELECT comment.*, user.email, user.showemail, user.displayname
25 FROM " . TABLE_PREFIX
. "comment AS comment
26 LEFT JOIN " . TABLE_PREFIX
. "user AS user
27 ON (comment.userid = user.userid)
28 WHERE comment.commentid = " . intval($bugsys->in
['commentid'])
33 $message->error('alert: bad comment');
36 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "bug WHERE bugid = $comment[bugid]");
38 if (!((can_perform('caneditown') AND $bugsys->userinfo
['userid'] == $comment['userid']) OR can_perform('caneditothers')))
40 $message->error_permission();
43 if ($bug['hidden'] AND !can_perform('canviewhidden'))
45 $message->error_permissison();
48 // ###################################################################
50 if (empty($_REQUEST['do']))
52 $_REQUEST['do'] = 'edit';
55 // ###################################################################
57 if ($_POST['do'] == 'update')
59 if (!$bugsys->in
['comment'])
61 $message->error('you need to enter some text');
64 $bugsys->in
['comment_parsed'] = $bugsys->in
['comment'];
66 if (!$bugsys->options
['allowhtml'])
68 $bugsys->in
['comment_parsed'] = $bugsys->sanitize($bugsys->in
['comment_parsed']);
72 UPDATE " . TABLE_PREFIX
. "comment
73 SET comment = '" . $bugsys->in
['comment'] . "',
74 comment_parsed = '" . nl2br($bugsys->in
['comment_parsed']) . "',
75 hidden = " . intval($bugsys->in
['hidden']) . "
76 WHERE commentid = $comment[commentid]"
80 require_once('./includes/class_history.php');
82 $log->bugid
= $bug['bugid'];
83 $log->language
= 'log_update_comment';
84 $log->arguments
= array($comment['commentid']);
86 $log->log($log->diff('hidden', $comment['hidden'], intval($bugsys->in
['hidden'])));
88 $lastgood = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "comment WHERE bugid = $bug[bugid] AND !hidden ORDER BY dateline DESC");
90 UPDATE " . TABLE_PREFIX
. "bug
91 SET hiddenlastposttime = $lastgood[dateline],
92 hiddenlastpostby = $lastgood[userid]
93 WHERE bugid = $bug[bugid]"
96 $message->redirect('comment saved', "showreport.php?bugid=$bug[bugid]");
99 // ###################################################################
101 if ($_REQUEST['do'] == 'edit')
103 $comment['posttime'] = $datef->format($bugsys->options
['dateformat'], $comment['dateline']);
104 $comment['postby'] = construct_user_display($comment);
105 $comment['comment'] = $bugsys->sanitize($comment['comment']);
106 eval('$template->flush("' . $template->fetch('editcomment') . '");');
109 /*=====================================================================*\
110 || ###################################################################
113 || ###################################################################
114 \*=====================================================================*/