Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -645,6 +645,18 @@ |
646 | 646 | return $parserOutput->getText(); |
647 | 647 | } |
648 | 648 | |
| 649 | + /** Parse wikitext, strip paragraphs, and return the HTML. */ |
| 650 | + public function parseInline( $text, $linestart = true, $interface = false ) { |
| 651 | + $parsed = $this->parse( $text, $linestart, $interface ); |
| 652 | + |
| 653 | + $m = array(); |
| 654 | + if ( preg_match( '/^<p>(.*)\n?<\/p>\n?/sU', $parsed, $m ) ) { |
| 655 | + $parsed = $m[1]; |
| 656 | + } |
| 657 | + |
| 658 | + return $parsed; |
| 659 | + } |
| 660 | + |
649 | 661 | /** |
650 | 662 | * @param Article $article |
651 | 663 | * @param User $user |
Index: trunk/extensions/AbuseFilter/SpecialAbuseLog.php |
— | — | @@ -180,13 +180,16 @@ |
181 | 181 | } |
182 | 182 | $actions_taken = implode( ', ', $displayActions ); |
183 | 183 | } |
| 184 | + |
| 185 | + global $wgOut; |
| 186 | + $parsed_comments = $wgOut->parseInline( $row->af_public_comments ); |
184 | 187 | |
185 | 188 | if ($this->canSeeDetails()) { |
186 | 189 | $detailsLink = $sk->makeKnownLinkObj( $this->getTitle( ), wfMsg( 'abusefilter-log-detailslink' ), 'details='.$row->afl_id ); |
187 | 190 | |
188 | | - $description = wfMsgExt( 'abusefilter-log-detailedentry', array( 'parseinline', 'replaceafter' ), array( $timestamp, $user, $row->afl_filter, $row->afl_action, $sk->makeKnownLinkObj( $title ), $actions_taken, $row->af_public_comments, $detailsLink ) ); |
| 191 | + $description = wfMsgExt( 'abusefilter-log-detailedentry', array( 'parseinline', 'replaceafter' ), array( $timestamp, $user, $row->afl_filter, $row->afl_action, $sk->makeKnownLinkObj( $title ), $actions_taken, $parsed_comments, $detailsLink ) ); |
189 | 192 | } else { |
190 | | - $description = wfMsgExt( 'abusefilter-log-entry', array( 'parseinline', 'replaceafter' ), array( $timestamp, $user, $row->afl_action, $sk->makeKnownLinkObj( $title ), $actions_taken, $row->af_public_comments ) ); |
| 193 | + $description = wfMsgExt( 'abusefilter-log-entry', array( 'parseinline', 'replaceafter' ), array( $timestamp, $user, $row->afl_action, $sk->makeKnownLinkObj( $title ), $actions_taken, $parsed_comments ) ); |
191 | 194 | } |
192 | 195 | |
193 | 196 | return $li ? Xml::tags( 'li', null, $description ) : $description; |
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewList.php |
— | — | @@ -168,7 +168,7 @@ |
169 | 169 | case 'af_id': |
170 | 170 | return $sk->link( SpecialPage::getTitleFor( 'AbuseFilter', intval($value) ), intval($value) ); |
171 | 171 | case 'af_public_comments': |
172 | | - return $sk->link( SpecialPage::getTitleFor( 'AbuseFilter', intval($row->af_id) ), $wgOut->parse( $value ) ); |
| 172 | + return $sk->link( SpecialPage::getTitleFor( 'AbuseFilter', intval($row->af_id) ), $wgOut->parseInline( $value ) ); |
173 | 173 | case 'af_actions': |
174 | 174 | $actions = explode(',', $value); |
175 | 175 | $displayActions = array(); |
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php |
— | — | @@ -253,6 +253,8 @@ |
254 | 254 | |
255 | 255 | foreach( $actionsByFilter as $filter => $actions ) { |
256 | 256 | // Special-case handling for warnings. |
| 257 | + global $wgOut; |
| 258 | + $parsed_public_comments = $wgOut->parseInline( self::$filters[$filter]->af_public_comments ); |
257 | 259 | |
258 | 260 | if ( !empty( $actions['throttle'] ) ) { |
259 | 261 | $parameters = $actions['throttle']['parameters']; |
— | — | @@ -281,7 +283,7 @@ |
282 | 284 | |
283 | 285 | // Threaten them a little bit |
284 | 286 | $msg = ( !empty($parameters[0]) && strlen($parameters[0]) ) ? $parameters[0] : 'abusefilter-warning'; |
285 | | - $messages[] = wfMsgNoTrans( $msg, self::$filters[$filter]->af_public_comments ) . "<br />\n"; |
| 287 | + $messages[] = wfMsgExt( $msg, 'parseinline', array( $parsed_public_comments) ) . "<br />\n"; |
286 | 288 | |
287 | 289 | $actionsTaken[$filter][] = 'warn'; |
288 | 290 | |
— | — | @@ -300,7 +302,7 @@ |
301 | 303 | |
302 | 304 | // Do the rest of the actions |
303 | 305 | foreach( $actions as $action => $info ) { |
304 | | - $newMsg = self::takeConsequenceAction( $action, $info['parameters'], $title, $vars, self::$filters[$filter]->af_public_comments ); |
| 306 | + $newMsg = self::takeConsequenceAction( $action, $info['parameters'], $title, $vars, self::$filters[$filter]->af_public_comments); |
305 | 307 | |
306 | 308 | if ($newMsg) |
307 | 309 | $messages[] = $newMsg; |
— | — | @@ -365,10 +367,10 @@ |
366 | 368 | switch ($action) { |
367 | 369 | case 'disallow': |
368 | 370 | if (strlen($parameters[0])) { |
369 | | - $display .= wfMsgNoTrans( $parameters[0], $rule_desc ) . "\n"; |
| 371 | + $display .= wfMsgExt( $parameters[0], 'parseinline', array($rule_desc) ) . "\n"; |
370 | 372 | } else { |
371 | 373 | // Generic message. |
372 | | - $display .= wfMsgNoTrans( 'abusefilter-disallowed', $rule_desc ) ."<br />\n"; |
| 374 | + $display .= wfMsgExt( 'abusefilter-disallowed', 'parseinline', array($rule_desc) ) ."<br />\n"; |
373 | 375 | } |
374 | 376 | break; |
375 | 377 | |
— | — | @@ -400,7 +402,7 @@ |
401 | 403 | $log->addEntry( 'block', Title::makeTitle( NS_USER, $wgUser->getName() ), |
402 | 404 | wfMsgForContent( 'abusefilter-blockreason', $rule_desc ), $logParams, self::getFilterUser() ); |
403 | 405 | |
404 | | - $display .= wfMsgNoTrans( 'abusefilter-blocked-display', $rule_desc ) ."<br />\n"; |
| 406 | + $display .= wfMsgExt( 'abusefilter-blocked-display', 'parseinline', array($rule_desc) ) ."<br />\n"; |
405 | 407 | break; |
406 | 408 | case 'rangeblock': |
407 | 409 | global $wgUser; |
— | — | @@ -436,7 +438,7 @@ |
437 | 439 | $log->addEntry( 'block', Title::makeTitle( NS_USER, $range ), |
438 | 440 | wfMsgForContent( 'abusefilter-blockreason', $rule_desc ), $logParams, self::getFilterUser() ); |
439 | 441 | |
440 | | - $display .= wfMsgNoTrans( 'abusefilter-blocked-display', $rule_desc ) ."<br />\n"; |
| 442 | + $display .= wfMsgExt( 'abusefilter-blocked-display', 'parseinline', $rule_desc ) ."<br />\n"; |
441 | 443 | break; |
442 | 444 | case 'degroup': |
443 | 445 | global $wgUser; |
— | — | @@ -448,7 +450,7 @@ |
449 | 451 | $wgUser->removeGroup( $group ); |
450 | 452 | } |
451 | 453 | |
452 | | - $display .= wfMsgNoTrans( 'abusefilter-degrouped', $rule_desc ) ."<br />\n"; |
| 454 | + $display .= wfMsgExt( 'abusefilter-degrouped', 'parseinline', array($rule_desc) ) ."<br />\n"; |
453 | 455 | |
454 | 456 | // Don't log it if there aren't any groups being removed! |
455 | 457 | if (!count($groups)) { |
— | — | @@ -475,7 +477,7 @@ |
476 | 478 | $blockPeriod = (int)mt_rand( 3*86400, 7*86400 ); // Block for 3-7 days. |
477 | 479 | $wgMemc->set( self::autoPromoteBlockKey( $wgUser ), true, $blockPeriod ); |
478 | 480 | |
479 | | - $display .= wfMsgNoTrans( 'abusefilter-autopromote-blocked', $rule_desc ) ."<br />\n"; |
| 481 | + $display .= wfMsgExt( 'abusefilter-autopromote-blocked', 'parseinline', array($rule_desc) ) ."<br />\n"; |
480 | 482 | } |
481 | 483 | break; |
482 | 484 | |
Index: trunk/extensions/AbuseFilter/AbuseFilter.hooks.php |
— | — | @@ -26,7 +26,10 @@ |
27 | 27 | $filter_result = AbuseFilter::filterAction( $vars, $editor->mTitle, $oldLinks ); |
28 | 28 | |
29 | 29 | if( $filter_result !== true ){ |
30 | | - $error = $filter_result; |
| 30 | + global $wgOut; |
| 31 | + $wgOut->addHTML( $filter_result ); |
| 32 | + $editor->showEditForm(); |
| 33 | + return false; |
31 | 34 | } |
32 | 35 | return true; |
33 | 36 | } |