require_once('./global.php');
require_once('./includes/api_comment.php');
-$comment = $db->query_first("
- SELECT comment.*, user.email, user.showemail, user.displayname
- FROM " . TABLE_PREFIX . "comment AS comment
- LEFT JOIN " . TABLE_PREFIX . "user AS user
- ON (comment.userid = user.userid)
- WHERE comment.commentid = " . intval($bugsys->in['commentid'])
-);
+$commentapi = new CommentAPI($bugsys);
+$commentapi->set('commentid', $bugsys->in['commentid']);
+$commentapi->set_condition();
+$commentapi->fetch();
-if (!$comment)
-{
- $message->error($lang->getlex('error_invalid_id'));
-}
+$comment =& $commentapi->objdata;
$bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $comment[bugid]");
if ($_POST['do'] == 'update')
{
- $commentapi = new CommentAPI($bugsys);
- $commentapi->set('commentid', $bugsys->in['commentid']);
- $commentapi->set_condition();
$commentapi->set('comment', $bugsys->in['comment']);
$commentapi->set('hidden', $bugsys->in['hidden']);
if ($_REQUEST['do'] == 'edit')
{
$comment['posttime'] = $datef->format($bugsys->options['dateformat'], $comment['dateline']);
- $comment['postby'] = construct_user_display($comment);
+ $comment['postby'] = construct_user_display($commentapi->relations['userid']->objdata);
$comment['comment'] = $bugsys->sanitize($comment['comment']);
$show['hide'] = ($bug['initialreport'] != $comment['commentid'] ? true : false);
eval('$template->flush("' . $template->fetch('editcomment') . '");');