2009-01-23 19:23:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class AbuseFilterViewTools extends AbuseFilterView {
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* Shows the page
|
|
|
|
*/
|
|
|
|
public function show() {
|
2011-11-16 05:34:24 +00:00
|
|
|
$out = $this->getOutput();
|
2018-03-10 03:21:04 +00:00
|
|
|
$out->enableOOUI();
|
2011-11-16 05:34:24 +00:00
|
|
|
$user = $this->getUser();
|
2018-02-04 18:50:43 +00:00
|
|
|
$request = $this->getRequest();
|
2009-01-23 19:23:19 +00:00
|
|
|
|
2017-07-29 16:15:50 +00:00
|
|
|
if ( !$user->isAllowed( 'abusefilter-modify' ) ) {
|
|
|
|
$out->addWikiMsg( 'abusefilter-mustbeeditor' );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-01-23 19:23:19 +00:00
|
|
|
// Header
|
2011-11-16 05:34:24 +00:00
|
|
|
$out->addWikiMsg( 'abusefilter-tools-text' );
|
2009-01-23 19:23:19 +00:00
|
|
|
|
|
|
|
// Expression evaluator
|
|
|
|
$eval = '';
|
2018-04-08 15:57:23 +00:00
|
|
|
$eval .= $this->buildEditBox( $request->getText( 'wpTestExpr' ), 'wpTestExpr' );
|
2009-10-07 13:57:06 +00:00
|
|
|
|
2018-03-10 03:21:04 +00:00
|
|
|
$eval .=
|
|
|
|
Xml::tags( 'p', null,
|
|
|
|
new OOUI\ButtonInputWidget( [
|
|
|
|
'label' => $this->msg( 'abusefilter-tools-submitexpr' )->text(),
|
|
|
|
'id' => 'mw-abusefilter-submitexpr'
|
|
|
|
] )
|
|
|
|
);
|
2017-07-29 16:15:50 +00:00
|
|
|
$eval .= Xml::element( 'p', [ 'id' => 'mw-abusefilter-expr-result' ], ' ' );
|
|
|
|
|
2012-09-02 11:07:02 +00:00
|
|
|
$eval = Xml::fieldset( $this->msg( 'abusefilter-tools-expr' )->text(), $eval );
|
2011-11-16 05:34:24 +00:00
|
|
|
$out->addHTML( $eval );
|
2009-01-23 19:23:19 +00:00
|
|
|
|
2011-11-16 05:34:24 +00:00
|
|
|
$out->addModules( 'ext.abuseFilter.tools' );
|
2009-01-23 19:23:19 +00:00
|
|
|
|
2017-07-29 16:15:50 +00:00
|
|
|
// Hacky little box to re-enable autoconfirmed if it got disabled
|
2018-03-10 03:21:04 +00:00
|
|
|
$formDescriptor = [
|
|
|
|
'RestoreAutoconfirmed' => [
|
|
|
|
'label-message' => 'abusefilter-tools-reautoconfirm-user',
|
|
|
|
'type' => 'user',
|
|
|
|
'name' => 'wpReAutoconfirmUser',
|
|
|
|
'id' => 'reautoconfirm-user',
|
|
|
|
'infusable' => true
|
|
|
|
],
|
|
|
|
];
|
|
|
|
$htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
|
|
|
|
$htmlForm->setWrapperLegendMsg( 'abusefilter-tools-reautoconfirm' )
|
|
|
|
->setSubmitTextMsg( 'abusefilter-tools-reautoconfirm-submit' )
|
|
|
|
->setSubmitName( 'wpReautoconfirmSubmit' )
|
|
|
|
->setSubmitId( 'mw-abusefilter-reautoconfirmsubmit' )
|
|
|
|
->prepareForm()
|
|
|
|
->displayForm( false );
|
2009-01-23 19:23:19 +00:00
|
|
|
}
|
2009-02-07 09:34:11 +00:00
|
|
|
}
|