From 65fe687684209127a7a07b5e84b9958f773be1ba Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 30 Apr 2006 08:04:43 +0000 Subject: [PATCH] r784: Globalize the $commentapi variable so that it can be used for both do branches --- editcomment.php | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/editcomment.php b/editcomment.php index db38514..3ab4f44 100644 --- a/editcomment.php +++ b/editcomment.php @@ -30,18 +30,12 @@ $focus['showreport'] = 'focus'; 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]"); @@ -66,9 +60,6 @@ if (empty($_REQUEST['do'])) 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']); @@ -114,7 +105,7 @@ if ($_POST['do'] == 'update') 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') . '");'); -- 2.22.5