mediawiki-extensions-AbuseF.../Views/AbuseFilterViewTools.php

64 lines
1.7 KiB
PHP
Raw Normal View History

<?php
if ( !defined( 'MEDIAWIKI' ) )
die();
class AbuseFilterViewTools extends AbuseFilterView {
function show() {
global $wgRequest, $wgOut, $wgUser;
// Header
$wgOut->setSubTitle( wfMsg( 'abusefilter-tools-subtitle' ) );
$wgOut->addWikiMsg( 'abusefilter-tools-text' );
// Expression evaluator
$eval = '';
2009-01-23 22:49:13 +00:00
$eval .= AbuseFilter::buildEditBox( '', 'wpTestExpr' );
// Only let users with permission actually test it
if ( $wgUser->isAllowed( 'abusefilter-modify' ) ) {
$eval .= Xml::tags( 'p', null,
Xml::element( 'input',
array(
'type' => 'button',
'id' => 'mw-abusefilter-submitexpr',
'onclick' => 'doExprSubmit();',
'value' => wfMsg( 'abusefilter-tools-submitexpr' ) )
)
);
$eval .= Xml::element( 'p', array( 'id' => 'mw-abusefilter-expr-result' ), ' ' );
}
$eval = Xml::fieldset( wfMsg( 'abusefilter-tools-expr' ), $eval );
$wgOut->addHTML( $eval );
// Associated script
2009-01-23 22:49:13 +00:00
$exprScript = file_get_contents( dirname( __FILE__ ) . '/tools.js' );
$wgOut->addInlineScript( $exprScript );
global $wgUser;
if ( $wgUser->isAllowed( 'abusefilter-modify' ) ) {
// Hacky little box to re-enable autoconfirmed if it got disabled
$rac = '';
$rac .= Xml::inputLabel(
wfMsg( 'abusefilter-tools-reautoconfirm-user' ),
'wpReAutoconfirmUser',
'reautoconfirm-user',
45
);
Remove most named character references from output Recommit of r66254 to trunk. This was just find extensions phase3 -iname '*.php' \! -iname '*.i18n.php' \! -iname 'Messages*.php' \! -iname '*_Messages.php' -exec sed -i 's/&nbsp;/\&#160;/g;s/&mdash;/―/g;s/&bull;/•/g;s/&aacute;/á/g;s/&acute;/´/g;s/&agrave;/à/g;s/&alpha;/α/g;s/&auml;/ä/g;s/&ccedil;/ç/g;s/&copy;/©/g;s/&darr;/↓/g;s/&deg;/°/g;s/&eacute;/é/g;s/&ecirc;/ê/g;s/&euml;/ë/g;s/&egrave;/è/g;s/&euro;/€/g;s/&harr;//g;s/&hellip;/…/g;s/&iacute;/í/g;s/&igrave;/ì/g;s/&larr;/←/g;s/&ldquo;/“/g;s/&middot;/·/g;s/&minus;/−/g;s/&ndash;/–/g;s/&oacute;/ó/g;s/&ocirc;/ô/g;s/&oelig;/œ/g;s/&ograve;/ò/g;s/&otilde;/õ/g;s/&ouml;/ö/g;s/&pound;/£/g;s/&prime;/′/g;s/&Prime;/″/g;s/&raquo;/»/g;s/&rarr;/→/g;s/&rdquo;/”/g;s/&Sigma;/Σ/g;s/&times;/×/g;s/&uacute;/ú/g;s/&uarr;/↑/g;s/&uuml;/ü/g;s/&yen;/¥/g' {} + followed by reading over every single line of the resulting diff and fixing a whole bunch of false positives. The reason for this change is given in <http://lists.wikimedia.org/pipermail/wikitech-l/2010-April/047617.html>. I cleared it with Tim and Brion on IRC before committing. It might cause a few problems, but I tried to be careful; please report any issues. I skipped all messages files. I plan to make a follow-up commit that alters wfMsgExt() with 'escapenoentities' to sanitize all the entities. That way, the only messages that will be problems will be ones that output raw HTML, and we want to get rid of those anyway. This should get rid of all named entities everywhere except messages. I skipped a few things like &nbsp that I noticed in manual inspection, because they weren't well-formed XML anyway. Also, to everyone who uses non-breaking spaces when they could use a normal space, or nothing at all, or CSS padding: I still hate you. Die.
2010-05-30 17:33:59 +00:00
$rac .= '&#160;';
$rac .= Xml::element(
'input',
array(
'type' => 'button',
'id' => 'mw-abusefilter-reautoconfirmsubmit',
'onclick' => 'doReautoSubmit();',
'value' => wfMsg( 'abusefilter-tools-reautoconfirm-submit' )
)
);
$rac = Xml::fieldset( wfMsg( 'abusefilter-tools-reautoconfirm' ), $rac );
$wgOut->addHTML( $rac );
}
}
}