Index: trunk/extensions/Postcomment/Postcomment.php |
— | — | @@ -26,6 +26,7 @@ |
27 | 27 | $dir = dirname(__FILE__) . '/'; |
28 | 28 | $wgExtensionMessagesFiles['PostComment'] = $dir . 'Postcomment.i18n.php'; |
29 | 29 | |
| 30 | +$wgHooks['SkinAfterContent'][] = 'wfPostcommentForm'; |
30 | 31 | $wgSpecialPages['Postcomment'] = 'SpecialPostcomment'; |
31 | 32 | |
32 | 33 | class SpecialPostcomment extends UnlistedSpecialPage { |
— | — | @@ -122,23 +123,22 @@ |
123 | 124 | } |
124 | 125 | } |
125 | 126 | |
126 | | -function wfPostcommentForm() { |
127 | | - global $wgUser, $wgTitle, $wgRequest; |
| 127 | +function wfPostcommentForm( &$data, $sk ) { |
| 128 | + global $wgUser, $wgRequest; |
128 | 129 | |
129 | 130 | $action = $wgRequest->getVal( 'action', 'view' ); |
| 131 | + $title = $sk->getTitle(); |
130 | 132 | |
131 | 133 | // just for talk pages |
132 | | - if ( !$wgTitle->isTalkPage() || $action != 'view' ) { |
133 | | - return; |
| 134 | + if ( !$title->isTalkPage() || $action != 'view' ) { |
| 135 | + return true; |
134 | 136 | } |
135 | 137 | |
136 | | - if ( !$wgTitle->userCan( 'edit', true ) ) { |
137 | | - echo wfMsg( 'postcomment_discussionprotected' ); |
138 | | - return; |
| 138 | + if ( !$title->userCan( 'edit', true ) ) { |
| 139 | + $data .= wfMsgHtml( 'postcomment_discussionprotected' ); |
| 140 | + return true; |
139 | 141 | } |
140 | 142 | |
141 | | - $sk = $wgUser->getSkin(); |
142 | | - |
143 | 143 | $user_str = ''; |
144 | 144 | if ($wgUser->getID() == 0) { |
145 | 145 | $user_str = wfMsg( 'postcomment_notloggedin' ); |
— | — | @@ -148,15 +148,15 @@ |
149 | 149 | } |
150 | 150 | |
151 | 151 | $pc = SpecialPage::getTitleFor( 'Postcomment' ); |
152 | | - if ( $wgTitle->getNamespace() == NS_USER_TALK ) { |
153 | | - $msg = wfMsg( 'postcomment_leavemessagefor', $wgTitle->getText() ); |
| 152 | + if ( $title->getNamespace() == NS_USER_TALK ) { |
| 153 | + $msg = wfMsg( 'postcomment_leavemessagefor', $title->getText() ); |
154 | 154 | } else { |
155 | 155 | $msg = wfMsg( 'postcomment_addcommentdiscussionpage' ); |
156 | 156 | } |
157 | 157 | |
158 | | - echo "<br /><br /> |
| 158 | + $data .= "<hr /><br /> |
159 | 159 | <form name=\"commentForm\" method=\"POST\" action=\"{$pc->getFullURL()}\"> |
160 | | -<input name=\"target\" type=\"hidden\" value=\"" . htmlspecialchars( $wgTitle->getPrefixedDBkey() ) . "\"/> |
| 160 | +<input name=\"target\" type=\"hidden\" value=\"" . htmlspecialchars( $title->getPrefixedDBkey() ) . "\"/> |
161 | 161 | <table> |
162 | 162 | <tr> |
163 | 163 | <td colspan=\"2\" valign=\"top\"> |
— | — | @@ -185,4 +185,5 @@ |
186 | 186 | </tr> |
187 | 187 | </table> |
188 | 188 | </form>"; |
| 189 | + return true; |
189 | 190 | } |