2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 $fetchtemplates = array(
26 define('SVN', '$Id$');
28 $focus['showreport'] = 'focus';
30 require_once('./global.php');
31 require_once('./includes/api_comment.php');
33 $comment = $db->query_first("
34 SELECT comment.*, user.email, user.showemail, user.displayname
35 FROM " . TABLE_PREFIX
. "comment AS comment
36 LEFT JOIN " . TABLE_PREFIX
. "user AS user
37 ON (comment.userid = user.userid)
38 WHERE comment.commentid = " . intval($bugsys->in
['commentid'])
43 $message->error($lang->getlex('error_invalid_id'));
46 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "bug WHERE bugid = $comment[bugid]");
48 if (!((can_perform('caneditownreply', $bug['productid']) AND $bugsys->userinfo
['userid'] == $comment['userid']) OR (can_perform('caneditotherreply', $bug['productid']) AND $bugsys->userinfo
['userid'] != $comment['userid'])))
50 $message->error_permission();
53 if ($bug['hidden'] AND !can_perform('canviewhidden', $bug['productid']))
55 $message->error_permissison();
58 // ###################################################################
60 if (empty($_REQUEST['do']))
62 $_REQUEST['do'] = 'edit';
65 // ###################################################################
67 if ($_POST['do'] == 'update')
69 $commentapi = new CommentAPI($bugsys);
70 $commentapi->set('commentid', $bugsys->in
['commentid']);
71 $commentapi->set_condition();
72 $commentapi->set('comment', $bugsys->in
['comment']);
73 $commentapi->set('hidden', $bugsys->in
['hidden']);
75 if ($bugsys->in
['commentid'] == $bug['initialreport'] AND $bugsys->in
['hidden'])
77 $message->items
[] = $lang->string('You cannot hide the first comment/initial report of a bug. Instead, hide the entire bug.');
82 $commentapi->update();
85 require_once('./includes/class_history.php');
87 $log->bugid
= $bug['bugid'];
88 $log->commentid
= $comment['commentid'];
89 $log->log($log->diff('comment ' . $comment['commentid'] . ' text', $comment['comment_parsed'], nl2br($bugsys->in
['comment_parsed'])));
90 $log->log($log->diff('comment ' . $comment['commentid'] . ' hidden', $comment['hidden'], intval($bugsys->in
['hidden'])));
92 $lastgood = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "comment WHERE bugid = $bug[bugid] AND !hidden ORDER BY dateline DESC");
94 UPDATE " . TABLE_PREFIX
. "bug
95 SET hiddenlastposttime = $lastgood[dateline],
96 hiddenlastpostby = $lastgood[userid]
97 WHERE bugid = $bug[bugid]"
100 $message->redirect($lang->string('The comment was modified successfully.'), "showreport.php?bugid=$bug[bugid]");
104 $show['errors'] = true
;
105 $_REQUEST['do'] = 'edit';
106 $message->error_list_process();
107 $comment['comment'] = $bugsys->in
['comment'];
108 $comment['hidden'] = $bugsys->in
['hidden'];
112 // ###################################################################
114 if ($_REQUEST['do'] == 'edit')
116 $comment['posttime'] = $datef->format($bugsys->options
['dateformat'], $comment['dateline']);
117 $comment['postby'] = construct_user_display($comment);
118 $comment['comment'] = $bugsys->sanitize($comment['comment']);
119 $show['hide'] = ($bug['initialreport'] != $comment['commentid'] ? true
: false
);
120 eval('$template->flush("' . $template->fetch('editcomment') . '");');
123 /*=====================================================================*\
124 || ###################################################################
127 || ###################################################################
128 \*=====================================================================*/