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 require_once('./global.php
');
21 $comment = $db->query_first("
22 SELECT comment.*, user.email, user.showemail, user.displayname
23 FROM " . TABLE_PREFIX . "comment AS comment
24 LEFT JOIN " . TABLE_PREFIX . "user AS user
25 ON (comment.userid = user.userid)
26 WHERE comment.commentid = " . intval($bugsys->in['commentid
'])
31 $message->error('alert
: bad comment
');
34 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $comment[bugid]");
36 if (!((can_perform('caneditown
') AND $bugsys->userinfo['userid
'] == $comment['userid
']) OR can_perform('caneditothers
')))
38 $message->error_permission();
41 if ($bug['hidden
'] AND !can_perform('canviewhidden
'))
43 $message->error_permissison();
46 // ###################################################################
48 if (empty($_REQUEST['do']))
50 $_REQUEST['do'] = 'edit
';
53 // ###################################################################
55 if ($_POST['do'] == 'update
')
57 if (!$bugsys->in['comment
'])
59 $message->error('you need to enter some text
');
62 $bugsys->in['comment_parsed
'] = $bugsys->in['comment
'];
64 if (!$bugsys->options['allowhtml
'])
66 $bugsys->in['comment_parsed
'] = $bugsys->sanitize($bugsys->in['comment_parsed
']);
70 UPDATE " . TABLE_PREFIX . "comment
71 SET comment = '" . $bugsys->in['comment'] . "',
72 comment_parsed = '" . nl2br($bugsys->in['comment_parsed']) . "',
73 hidden = " . intval($bugsys->in['hidden
']) . "
74 WHERE commentid = $comment[commentid]"
78 require_once('./includes
/class_history
.php
');
80 $log->bugid = $bug['bugid
'];
81 $log->language = 'log_update_comment
';
82 $log->arguments = array($comment['commentid
']);
84 $log->log($log->diff('hidden
', $comment['hidden
'], intval($bugsys->in['hidden
'])));
86 $lastgood = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug[bugid] AND !hidden ORDER BY dateline DESC");
88 UPDATE " . TABLE_PREFIX . "bug
89 SET hiddenlastposttime = $lastgood[dateline],
90 hiddenlastpostby = $lastgood[userid]
91 WHERE bugid = $bug[bugid]"
94 $message->redirect('comment saved
', "showreport.php?bugid=$bug[bugid]");
97 // ###################################################################
99 if ($_REQUEST['do'] == 'edit
')
101 $comment['posttime
'] = $datef->format($bugsys->options['dateformat
'], $comment['dateline
']);
102 $comment['postby
'] = construct_user_display($comment);
103 $comment['comment
'] = $bugsys->sanitize($comment['comment
']);
104 eval('$template->flush("' . $template->fetch('editcomment') . '");');
107 /*=====================================================================*\
108 || ###################################################################
111 || ###################################################################
112 \*=====================================================================*/