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 require_once('./global.php');
19 if (!can_perform('canpostcomments'))
21 $message->error_permission();
24 // ###################################################################
26 if (empty($_REQUEST['do']))
28 $_REQUEST['do'] = 'add';
31 // ###################################################################
33 if ($_POST['do'] == 'insert')
35 $bugsys->in
['comment_parsed'] = $bugsys->in
['comment'];
37 if (!$bugsys->options
['allowhtml'])
39 $bugsys->in
['comment_parsed'] = $bugsys->sanitize($bugsys->in
['comment_parsed']);
45 INSERT INTO " . TABLE_PREFIX
. "comment
46 (bugid, userid, dateline, comment, comment_parsed)
48 (" . intval($bugsys->in
['bugid']) . ", " . $bugsys->userinfo
['userid'] . ",
49 $time, '" . $bugsys->in
['comment'] . "',
50 '" . nl2br($bugsys->in
['comment_parsed']) . "'
54 $commentid = $db->insert_id();
57 UPDATE " . TABLE_PREFIX
. "bug
58 SET lastposttime = $time,
59 lastpostby = " . $bugsys->userinfo
['userid'] . ",
60 hiddenlastposttime = $time,
61 hiddenlastpostby = " . $bugsys->userinfo
['userid'] . "
62 WHERE bugid = " . intval($bugsys->in
['bugid'])
66 require_once('./includes/class_history.php');
68 $log->bugid
= $bugsys->in
['bugid'];
69 $log->language
= 'log_new_comment';
70 $log->arguments
= array($commentid);
73 $message->redirect('comment inesrted', "showreport.php?bugid=" . intval($bugsys->in
['bugid']));
76 // ###################################################################
78 if ($_REQUEST['do'] == 'add')
80 $bug = $db->query_first("SELECT bug.*, comment.comment FROM " . TABLE_PREFIX
. "bug AS bug LEFT JOIN " . TABLE_PREFIX
. "comment AS comment ON (bug.bugid = comment.bugid) WHERE bug.bugid = " . intval($bugsys->in
['bugid']));
83 $message->error('alert: bad bug');
86 eval('$template->flush("' . $template->fetch('newcomment') . '");');
89 /*=====================================================================*\
90 || ###################################################################
93 || ###################################################################
94 \*=====================================================================*/