require_once('./includes/api_comment.php');
require_once('./includes/class_api_error.php');
-APIError(array(new API_Error_Handler($message), 'user_cumulative'));
$commentapi = new CommentAPI();
$commentapi->set('commentid', $input->in['commentid']);
-$commentapi->set_condition();
$commentapi->fetch();
-$comment =& $commentapi->record;
+$comment = &$commentapi->record;
$bug = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $comment[bugid]");
// get the last post (as in prior to deletion)
$lastpost = $db->queryFirst("SELECT commentid FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug[bugid] ORDER BY dateline DESC");
- $commentapi->delete();
+ $commentapi->remove();
// check to see if we need to rebuild the lastpost information
if ($lastpost['commentid'] == $comment['commentid'])
UPDATE " . TABLE_PREFIX . "bug
SET hiddenlastposttime = $lastgoodpublic[dateline],
hiddenlastpostby = $lastgoodpublic[userid],
- hiddenlastpostbyname = '" . $db->escape_string($lastgoodpublic['username']) . "',
+ hiddenlastpostbyname = '" . $db->escapeString($lastgoodpublic['username']) . "',
lastposttime = $lastgoodprivate[dateline],
lastpostby = $lastgoodprivate[userid],
- lastpostbyname = '" . $db->escape_string($lastgoodprivate['username']) . "'
+ lastpostbyname = '" . $db->escapeString($lastgoodprivate['username']) . "'
WHERE bugid = $bug[bugid]"
);
}
$message->errorPermission();
}
- $commentapi->set('comment', $input->in['comment']);
- $commentapi->set('parselinks', $input->in['parselinks']);
- $commentapi->set('hidden', $input->in['hidden']);
+ $commentapi->set('comment', $input->in['comment']);
+ $commentapi->set('parselinks', $input->in['parselinks']);
+ $commentapi->set('hidden', $input->in['hidden']);
if ($input->in['commentid'] == $bug['initialreport'] AND $input->in['hidden'])
{
UPDATE " . TABLE_PREFIX . "bug
SET hiddenlastposttime = $lastgood[dateline],
hiddenlastpostby = $lastgood[userid],
- hiddenlastpostbyname = '" . $db->escape_string($lastgood['username']) . "'
+ hiddenlastpostbyname = '" . $db->escapeString($lastgood['username']) . "'
WHERE bugid = $bug[bugid]"
);
{
$commenter = new UserAPI();
$commenter->set('userid', $comment['userid']);
- $commenter->set_condition();
$commenter->fetch();
$commenter = $commenter->record;
}
$comment['postby'] = construct_user_display($commenter);
- $comment['comment'] = $bugsys->sanitize($comment['comment']);
- $show['hide'] = ($bug['initialreport'] != $comment['commentid'] ? true : false);
- eval('$template->flush("' . $template->fetch('editcomment') . '");');
+ $comment['comment'] = $input->sanitize($comment['comment']);
+ $show['hide'] = ($bug['initialreport'] != $comment['commentid']);
+
+ $tpl = new BSTemplate('editcomment');
+ $tpl->vars = array(
+ 'comment' => $comment,
+ 'bug' => $bug
+ );
+ $tpl->evaluate()->flush();
}
/*=====================================================================*\
<head>
<%- $headinclude %>
<link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
- <title><lang 1="$comment[commentid]">{@"Edit Comment %1$s"}</lang> - $bug[summary]</title>
+ <title><%- sprintf(T('Edit Comment %1$s'), $comment['commentid']) %> - <%- $bug['summary'] %></title>
</head>
<body>
-$header
+<%- $header %>
<% if ($show['errors']): %>
<div class="error" style="text-align: <%- $stylevar['left'] %>">
<div class="box">
<div class="box-head" style="text-align: <%- $stylevar['left'] %>">
- <lang 1="$comment[commentid]" 2="$bug[bugid]" 3="$bug[summary]">{@"Comment #%1$s in bug #%2$s <em>%3$s</em>"}</lang>
+ <%- sprintf(T('Comment #%1$s in bug #%2$s <em>%3$s</em>'), $comment['commentid'], $bug['bugid'], $bug['summary']) %>
</div>
- <div class="box-foot box-margmod-bottom" style="text-align: <%- $stylevar['left'] %>"><lang 1="$comment[posttime]" 2="$comment[postby]">{@"Posted on %1$s by %2$s"}</lang></div>
+ <div class="box-foot box-margmod-bottom" style="text-align: <%- $stylevar['left'] %>"><%- sprintf(T('Posted on %1$s by %2$s'), $comment['posttime'], $comment['postby']) %></div>
<div class="box-mid" style="text-align: <%- $stylevar['left'] %>">
<% if ($show['hide']): %><div><strong<% if ($comment['hidden']): %> style="color: red"<% endif %>><%-T("Hidden")%>:</strong> <input type="checkbox" name="hidden" value="1"<% if ($comment['hidden']): %> checked="checked"<% endif %> /></div><% endif %>
<script type="text/javascript"> draw_cancel("showreport.php?bugid=<%- $bug['bugid'] %>"); </script>
</div>
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file