From a9fb0b27c1f7137b2d3e909fadff451b71eb9d31 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 5 May 2006 23:08:20 +0000 Subject: [PATCH] r801: Update the first comment editing bit --- editreport.php | 56 +++++++++++++++++++------------------------------- 1 file changed, 21 insertions(+), 35 deletions(-) diff --git a/editreport.php b/editreport.php index 27f08b7..e317fd3 100644 --- a/editreport.php +++ b/editreport.php @@ -64,44 +64,30 @@ if ($_POST['do'] == 'update') { // ------------------------------------------------------------------- // process comment stuff - if (!((can_perform('caneditown', $bug['productid']) AND $bugsys->userinfo['userid'] == $bug['userid']) OR (can_perform('caneditother', $bug['productid']) AND $bugsys->userinfo['userid'] != $bug['userid']))) + if ($bugsys->in['comment'] AND !((can_perform('caneditown', $bug['productid']) AND $bugsys->userinfo['userid'] == $bug['userid']) OR (can_perform('caneditother', $bug['productid']) AND $bugsys->userinfo['userid'] != $bug['userid']))) { - $hascomment = (!empty($bugsys->in['comment'])) ? true : false; + $comment = new CommentAPI($bugsys); + $comment->set('bugid', $bugsys->in['bugid']); + $comment->set('userid', $bugsys->userinfo['userid']); + $comment->set('comment', $_POST['comment']); + $comment->insert(); + + $time = $comment->values['dateline']; + $commentid = $comment->insertid; + + $db->query(" + UPDATE " . TABLE_PREFIX . "bug + SET lastposttime = $time, + lastpostby = " . $bugsys->userinfo['userid'] . ", + hiddenlastposttime = $time, + hiddenlastpostby = " . $bugsys->userinfo['userid'] . " + WHERE bugid = " . intval($bugsys->in['bugid']) + ); - if ($hascomment OR $autoaction['comment']) + if ($hascomment) { - if ($hascomment AND $autoaction['comment']) - { - $bugsys->in['comment'] .= "\n\n" . $lang->string('--------------- AUTOMATIC RESPONSE ---------------') . "\n" . $autoaction['comment']; - } - else if (!$hascomment AND $autoaction['comment']) - { - $bugsys->in['comment'] = $autoaction['comment']; - } - - $comment = new CommentAPI($bugsys); - $comment->set('bugid', $bugsys->in['bugid']); - $comment->set('userid', $bugsys->userinfo['userid']); - $comment->set('comment', $_POST['comment']); - $comment->insert(); - - $time = $comment->values['dateline']; - $commentid = $comment->insertid; - - $db->query(" - UPDATE " . TABLE_PREFIX . "bug - SET lastposttime = $time, - lastpostby = " . $bugsys->userinfo['userid'] . ", - hiddenlastposttime = $time, - hiddenlastpostby = " . $bugsys->userinfo['userid'] . " - WHERE bugid = " . intval($bugsys->in['bugid']) - ); - - if ($hascomment) - { - $log->arguments = array($commentid); - $log->log(); - } + $log->arguments = array($commentid); + $log->log(); } $message->redirect($lang->string('Your reply has been added to the comment list.'), "showreport.php?bugid=$bug[bugid]"); -- 2.22.5