From 71279a4da6d90bf506af4d5f7b524633c28ce4cb Mon Sep 17 00:00:00 2001 From: sakamocchi Date: Sun, 27 May 2012 12:26:54 +0900 Subject: [PATCH] =?utf8?q?FIX:=20<%editcomment%>=E3=82=BF=E3=82=B0?= =?utf8?q?=E3=81=8C=E3=83=91=E3=83=BC=E3=82=B9=E3=81=95=E3=82=8C=E3=82=8B?= =?utf8?q?=E5=BA=A6=E3=81=ABPrepareCommentForEdit=E3=82=A4=E3=83=99?= =?utf8?q?=E3=83=B3=E3=83=88=E3=81=8C=E7=99=BA=E7=94=9F=E3=81=99=E3=82=8B?= =?utf8?q?=E3=83=90=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit AdminActions::parse_editcomment()がPrepareCommentForEditイベントを発生させていたが、これだと<%editcomment%>タグがパースされる度にイベントが発生する。<%editcomment%>タグはcommenteditアクションページに複数含まれるため、イベントが重複して発生してしまう。 そのため、イベントはAdmin::action_commentedit()で発生するようにし、AdminActions::parse_editcomment()にはAdmin::$contentsで配列を渡すように変更した。 --- nucleus/libs/ADMIN.php | 4 ++++ nucleus/libs/AdminActions.php | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/nucleus/libs/ADMIN.php b/nucleus/libs/ADMIN.php index 8fa7310..51bd8e8 100644 --- a/nucleus/libs/ADMIN.php +++ b/nucleus/libs/ADMIN.php @@ -1232,6 +1232,10 @@ class Admin $member->canAlterComment($commentid) or self::disallow(); + $comment = COMMENT::getComment($commentid); + $manager->notify('PrepareCommentForEdit', array('comment' => &$comment)); + + Admin::$contents = $comment; self::$skin->parse('commentedit'); return; } diff --git a/nucleus/libs/AdminActions.php b/nucleus/libs/AdminActions.php index 3253f08..db3f323 100644 --- a/nucleus/libs/AdminActions.php +++ b/nucleus/libs/AdminActions.php @@ -2128,10 +2128,7 @@ class AdminActions extends BaseActions { global $manager; - $commentid = intRequestVar('commentid'); - $comment = COMMENT::getComment($commentid); - - $manager->notify('PrepareCommentForEdit', array('comment' => &$comment)); + $comment = Admin::$contents; switch ( $type ) { @@ -2163,7 +2160,10 @@ class AdminActions extends BaseActions echo $comment['userid']; break; default: - echo $comment[$type]; + if ( array_key_exists($type, $comment) && !empty($comment[$type]) ) + { + echo $comment[$type]; + } break; } return; -- 2.11.0