mediawiki-extensions-AbuseF.../Views/AbuseFilterViewTools.php
Siebrand Mazeland 176227e721 Maintenance for AbuseFilter extension.
* Replace deprecated methods.
* Remove no longer needed function fnmatch().
* Remove superfluous newlines.
* Remove unused and redundant local variables and globals.
* Deglobalization.
* Update documentation.
* Fix incorrect return values or add FIXMEs when in doubt.
* Escape output in a few places where needed.
* Remove unneeded MEDIAWIKI constant checks.
* Fix various JSHint/JSLint issues.

Patch Set 11: Merged https://gerrit.wikimedia.org/r/24701 into
this one per Siebrand's request

Change-Id: I02ba4ce31b6aca5b7324114093f8ece143abc295
2012-10-09 22:26:45 +02:00

55 lines
1.5 KiB
PHP

<?php
class AbuseFilterViewTools extends AbuseFilterView {
function show() {
$out = $this->getOutput();
$user = $this->getUser();
// Header
$out->addWikiMsg( 'abusefilter-tools-text' );
// Expression evaluator
$eval = '';
$eval .= AbuseFilter::buildEditBox( '', 'wpTestExpr' );
// Only let users with permission actually test it
if ( $user->isAllowed( 'abusefilter-modify' ) ) {
$eval .= Xml::tags( 'p', null,
Xml::element( 'input',
array(
'type' => 'button',
'id' => 'mw-abusefilter-submitexpr',
'value' => $this->msg( 'abusefilter-tools-submitexpr' )->text() )
)
);
$eval .= Xml::element( 'p', array( 'id' => 'mw-abusefilter-expr-result' ), ' ' );
}
$eval = Xml::fieldset( $this->msg( 'abusefilter-tools-expr' )->text(), $eval );
$out->addHTML( $eval );
$out->addModules( 'ext.abuseFilter.tools' );
if ( $user->isAllowed( 'abusefilter-modify' ) ) {
// Hacky little box to re-enable autoconfirmed if it got disabled
$rac = '';
$rac .= Xml::inputLabel(
$this->msg( 'abusefilter-tools-reautoconfirm-user' )->text(),
'wpReAutoconfirmUser',
'reautoconfirm-user',
45
);
$rac .= '&#160;';
$rac .= Xml::element(
'input',
array(
'type' => 'button',
'id' => 'mw-abusefilter-reautoconfirmsubmit',
'value' => $this->msg( 'abusefilter-tools-reautoconfirm-submit' )->text()
)
);
$rac = Xml::fieldset( $this->msg( 'abusefilter-tools-reautoconfirm' )->text(), $rac );
$out->addHTML( $rac );
}
}
}