From 77415796948f912f6d64dd6145a6c655aa099477 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 30 Apr 2006 02:13:48 +0000 Subject: [PATCH] r778: - HTML dealings are now working right - Created a pre_update() method so that comment_parsed() is run --- includes/api_comment.php | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/includes/api_comment.php b/includes/api_comment.php index ff70b9a..308f82a 100644 --- a/includes/api_comment.php +++ b/includes/api_comment.php @@ -30,7 +30,7 @@ $GLOBALS['isso:callback']->load('api', null); * @package Bugdar * */ -class CommentAPI +class CommentAPI extends API { /** * Fields @@ -38,13 +38,13 @@ class CommentAPI * @access private */ var $fields = array( - 'commentid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'bugid' => array(TYPE_UINT, REQ_YES, 'verify_nozero'), - 'userid' => array(TYPE_UINT, REQ_NO), - 'dateline' => array(TYPE_UINT, REQ_SET), - 'comment' => array(TYPE_STRUN, REQ_YES), - 'comment_parsed' => array(TYPE_STRUN, REQ_SET), - 'hidden' => array(TYPE_BOOL, REQ_NO) + 'commentid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), + 'bugid' => array(TYPE_UINT, REQ_YES, 'verify_nozero'), + 'userid' => array(TYPE_UINT, REQ_NO), + 'dateline' => array(TYPE_UINT, REQ_SET), + 'comment' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + 'comment_parsed' => array(TYPE_NONE, REQ_SET), + 'hidden' => array(TYPE_BOOL, REQ_NO) ); /** @@ -80,15 +80,26 @@ class CommentAPI */ function set_comment_parsed() { - if (!$this->registry->options['allowhtml']) + if ($this->registry->options['allowhtml']) { - $this->set('comment_parsed', $this->registry->sanitize($this->values['comment'])); + $this->set('comment_parsed', $this->registry->unsanitize($this->values['comment'])); } else { $this->set('comment_parsed', $this->values['comment']); } } + + // ################################################################### + /** + * Pre-update + * + * @access private + */ + function pre_update() + { + $this->set_comment_parsed(); + } } /*=====================================================================*\ -- 2.22.5