From bf5c1f5813f7f17843a93baafde80c13d0cbd9fe Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 23 Aug 2008 11:11:50 -0400 Subject: [PATCH] Updating editcomment.php --- editcomment.php | 31 +++++++++++++++++-------------- templates/editcomment.tpl | 10 +++++----- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/editcomment.php b/editcomment.php index 527e56e..efdf329 100644 --- a/editcomment.php +++ b/editcomment.php @@ -31,14 +31,12 @@ require_once('./global.php'); 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]"); @@ -66,7 +64,7 @@ if ($_POST['do'] == 'kill') // 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']) @@ -91,10 +89,10 @@ if ($_POST['do'] == 'kill') 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]" ); } @@ -128,9 +126,9 @@ if ($_POST['do'] == 'update') $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']) { @@ -162,7 +160,7 @@ if ($_POST['do'] == 'update') 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]" ); @@ -193,14 +191,19 @@ if ($_REQUEST['do'] == 'edit') { $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(); } /*=====================================================================*\ diff --git a/templates/editcomment.tpl b/templates/editcomment.tpl index 91cf782..1eaa36d 100644 --- a/templates/editcomment.tpl +++ b/templates/editcomment.tpl @@ -3,12 +3,12 @@ <%- $headinclude %> - <lang 1="$comment[commentid]">{@"Edit Comment %1$s"}</lang> - $bug[summary] + <%- sprintf(T('Edit Comment %1$s'), $comment['commentid']) %> - <%- $bug['summary'] %> -$header +<%- $header %> <% if ($show['errors']): %>
@@ -23,10 +23,10 @@ $header
- {@"Comment #%1$s in bug #%2$s %3$s"} + <%- sprintf(T('Comment #%1$s in bug #%2$s %3$s'), $comment['commentid'], $bug['bugid'], $bug['summary']) %>
-
{@"Posted on %1$s by %2$s"}
+
<%- sprintf(T('Posted on %1$s by %2$s'), $comment['posttime'], $comment['postby']) %>
<% if ($show['hide']): %>
style="color: red"<% endif %>><%-T("Hidden")%>: checked="checked"<% endif %> />
<% endif %> @@ -43,4 +43,4 @@ $header
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file -- 2.43.5