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();
|
2018-02-04 18:50:43 +00:00
|
|
|
$request = $this->getRequest();
|
2009-01-23 19:23:19 +00:00
|
|
|
|
2019-08-27 09:40:01 +00:00
|
|
|
if ( !AbuseFilter::canViewPrivate( $this->getUser() ) ) {
|
2018-05-04 19:56:45 +00:00
|
|
|
$out->addWikiMsg( 'abusefilter-mustviewprivateoredit' );
|
2017-07-29 16:15:50 +00:00
|
|
|
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-05-04 19:56:45 +00:00
|
|
|
$eval .= $this->buildEditBox(
|
2019-08-17 16:53:13 +00:00
|
|
|
$request->getText( 'wpFilterRules' ),
|
2018-05-04 19:56:45 +00:00
|
|
|
true,
|
|
|
|
false,
|
|
|
|
false
|
|
|
|
);
|
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(),
|
2020-08-19 15:08:35 +00:00
|
|
|
'id' => 'mw-abusefilter-submitexpr',
|
|
|
|
'flags' => [ 'primary', 'progressive' ]
|
2018-03-10 03:21:04 +00:00
|
|
|
] )
|
|
|
|
);
|
2018-03-26 18:41:20 +00:00
|
|
|
$eval .= Xml::element( 'pre', [ 'id' => 'mw-abusefilter-expr-result' ], ' ' );
|
2017-07-29 16:15:50 +00:00
|
|
|
|
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
|
|
|
|
2019-09-13 18:31:17 +00:00
|
|
|
if ( AbuseFilter::canEdit( $this->getUser() ) ) {
|
|
|
|
// Hacky little box to re-enable autoconfirmed if it got disabled
|
|
|
|
$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
|
|
|
}
|