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 $error->throw_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();
56 $db->query("UPDATE " . TABLE_PREFIX
. "bug SET lastposttime = $time, lastpostby = " . $bugsys->userinfo
['userid'] . " WHERE bugid = " . intval($bugsys->in
['bugid']));
59 require_once('./includes/class_history.php');
61 $log->bugid
= $bugsys->in
['bugid'];
62 $log->language
= 'log_new_comment';
63 $log->arguments
= array($commentid);
66 echo "<a href=\"showreport.php?bugid=" . intval($bugsys->in
['bugid']) . "\">comment inserted</a>";
69 // ###################################################################
71 if ($_REQUEST['do'] == 'add')
73 $bug = $db->query_first("SELECT bug.*, comment.comment FROM " . TABLE_PREFIX
. "bug LEFT JOIN " . TABLE_PREFIX
. "comment AS comment ON (bug.bugid = comment.bugid) WHERE bug.bugid = " . intval($bugsys->in
['bugid']));
76 $error->throw('alert: bad bug');
79 eval('$template->flush("' . $template->fetch('newcomment') . '");');
82 /*=====================================================================*\
83 || ###################################################################
86 || ###################################################################
87 \*=====================================================================*/