// ###################################################################
-if (empty($_REQUEST['do']))
-{
- $_REQUEST['do'] = 'edit';
-}
-
-// ###################################################################
-
if ($_POST['do'] == 'update')
{
$pcv = parse_pcv_select($bugsys->in['pcv_select'], true);
// -------------------------------------------------------------------
// process comment stuff
- /*
- if (!$bugsys->in['firstcomment'])
- {
- $message->error('you need to enter some text in the first comment');
- }
- $bugsys->in['comment_parsed'] = $bugsys->in['firstcomment'];
-
- if (!$bugsys->options['allowhtml'])
- {
- $bugsys->in['comment_parsed'] = $bugsys->sanitize($bugsys->in['comment_parsed']);
- }
-
- // we could pass this as a GET param, but that's unsafe
- $firstcomment = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug[bugid] ORDER BY dateline ASC LIMIT 1");
-
- $db->query("
- UPDATE " . TABLE_PREFIX . "comment
- SET comment = '" . $bugsys->in['firstcomment'] . "',
- comment_parsed = '" . nl2br($bugsys->in['comment_parsed']) . "'
- WHERE commentid = $firstcomment[commentid]"
- );
- */
- // -------------------------------------------------------------------
- // auto action comment
+ $hascomment = (!empty($bugsys->in['comment'])) ? true : false;
- if ($autoaction['comment'])
+ if ($hascomment OR $autoaction['comment'])
{
- $comment = $autoaction['comment'];
+ if ($hascomment AND $autoaction['comment'])
+ {
+ $bugsys->in['comment'] .= "\n\n--------------- AUTOMATIC RESPONSE ---------------\n" . $autoaction['comment'];
+ }
+ else if (!$hascomment AND $autoaction['comment'])
+ {
+ $bugsys->in['comment'] = $autoaction['comment'];
+ }
+
+ $bugsys->in['comment_parsed'] = $bugsys->in['comment'];
+
if (!$bugsys->options['allowhtml'])
{
- $comment_parsed = $bugsys->sanitize($comment);
+ $bugsys->in['comment_parsed'] = $bugsys->sanitize($bugsys->in['comment_parsed']);
}
+ $time = TIMENOW;
+
$db->query("
- INSERT INTO comment
+ INSERT INTO " . TABLE_PREFIX . "comment
(bugid, userid, dateline, comment, comment_parsed)
VALUES
- ($bug[bugid], " . $bugsys->userinfo['userid'] . ", " . LOG_TIME . ",
- '" . $bugsys->escape($comment) . "',
- '" . $bugsys->escape($comment_parsed) . "'
+ (" . intval($bugsys->in['bugid']) . ", " . $bugsys->userinfo['userid'] . ",
+ $time, '" . $bugsys->in['comment'] . "',
+ '" . nl2br($bugsys->in['comment_parsed']) . "'
)"
);
+ $commentid = $db->insert_id();
+
$db->query("
UPDATE " . TABLE_PREFIX . "bug
- SET lastposttime = " . LOG_TIME . ",
+ SET lastposttime = $time,
lastpostby = " . $bugsys->userinfo['userid'] . ",
- hiddenlastposttime = " . LOG_TIME . ",
+ hiddenlastposttime = $time,
hiddenlastpostby = " . $bugsys->userinfo['userid'] . "
- WHERE bugid = $bug[bugid]"
+ WHERE bugid = " . intval($bugsys->in['bugid'])
);
+
+ if ($hascomment)
+ {
+ $log->language = 'log_new_comment';
+ $log->arguments = array($commentid);
+ $log->log();
+ }
}
-
+
$message->redirect('done with update bug', "showreport.php?bugid=$bug[bugid]");
}
|| ################################################################### ||
\*=====================================================================*/
-$fetchtemplates = array(
- 'newcomment'
-);
-
define('SVN', '$Id$');
require_once('./global.php');
// ###################################################################
-if (empty($_REQUEST['do']))
-{
- $_REQUEST['do'] = 'add';
-}
-
-// ###################################################################
-
if ($_POST['do'] == 'insert')
{
$bugsys->in['comment_parsed'] = $bugsys->in['comment'];
$message->redirect('comment inesrted', "showreport.php?bugid=" . intval($bugsys->in['bugid']));
}
-// ###################################################################
-
-if ($_REQUEST['do'] == 'add')
-{
- $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']));
- if (!$bug)
- {
- $message->error('alert: bad bug');
- }
-
- eval('$template->flush("' . $template->fetch('newcomment') . '");');
-}
-
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
$assigninfo = $bugsys->datastore['assignto']["$bug[assignedto]"];
$bug['assigninfo'] = ((is_array($assigninfo)) ? construct_user_display($assigninfo) : '');
-
- $show['editreport'] = ((((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo')) ? true : false);
-
+
$duplicateof = $db->query_first("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[duplicateof]");
$duplicates = $db->query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE duplicateof = $bug[bugid]");
+++ /dev/null
-$doctype
-$headinclude
-$header
-
-<div><strong>New comment for:</strong> <em>$bug[summary]</em></div>
-
-<form name="newcomment" method="post" action="newcomment.php">
-<input type="hidden" name="do" value="insert" />
-<input type="hidden" name="bugid" value="$bug[bugid]" />
-<div><strong>Comment:</strong></div>
-<textarea name="comment" cols="100" rows="35"></textarea>
-<div><input type="submit" name="submit" value="Add Comment" /></div>
-</form>
-
-<br />
-<br />
-
-<table border="1" cellspacing="2" cellpadding="4" width="100%">
-<tr style="background-color:#EEEEEE">
- <td><strong>Summary Report:</strong>$bug[summary]</td>
-</tr>
-<tr>
- <td>$bug[comment]</td>
-</tr>
-</table>
-
-$footer
\ No newline at end of file
$headinclude
$header
-<form name="bugreport" action="editreport.php" method="post">
-<input type="hidden" name="do" value="update" />
-<input type="hidden" name="bugid" value="$bug[bugid]" />
+<if condition="$show['edit']">
+ <form name="bugreport" action="editreport.php" method="post">
+ <input type="hidden" name="do" value="update" />
+ <input type="hidden" name="bugid" value="$bug[bugid]" />
+</if>
<if condition="$show['edit']">
<div><strong<if condition="$bug['hidden']"> style="color: red"</if>>Hidden:</strong> <input type="checkbox" name="hidden" value="1"<if condition="$bug['hidden']"> checked="checked"</if> /></div>
</div>
$customfields
+
+ <if condition="$show['newreply']">
+ <div><strong>Comment:</strong></div>
+ <textarea name="comment" cols="100" rows="35"></textarea>
+ </if>
<else />
<div><strong>Product:</strong> $bug[product] <if condition="$bug['componentid']">/ <strong>Component:</strong> $bug[component]</if> / <strong>Version:</strong> $bug[version]</div>
<div><strong>Title / summary:</strong> $bug[summary]</div>
<if condition="$dupelist"><div><strong>Bugs marked as duplicates of this:</strong> $dupelist</div></if>
<if condition="$dependencies"><div><strong>Dependencies:</strong> $dependencies</div></if>
$customfields
+
+ <if condition="$show['newreply']">
+ <form name="newcomment" method="post" action="newcomment.php">
+ <input type="hidden" name="do" value="insert" />
+ <input type="hidden" name="bugid" value="$bug[bugid]" />
+ <div><strong>Comment:</strong></div>
+ <textarea name="comment" cols="100" rows="35"></textarea>
+ <div><input type="submit" name="submit" value="Add Comment" /></div>
+ </form>
+ </if>
</if>
<div><input type="submit" name="submit" value="Save Changes" /></div>