2009-01-23 19:23:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
if (!defined( 'MEDIAWIKI' ))
|
|
|
|
die();
|
|
|
|
|
|
|
|
class AbuseFilterViewTools extends AbuseFilterView {
|
|
|
|
function show( ) {
|
2009-04-01 04:34:21 +00:00
|
|
|
global $wgRequest,$wgOut,$wgUser;
|
2009-01-23 19:23:19 +00:00
|
|
|
|
|
|
|
// 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' );
|
2009-04-01 04:34:21 +00:00
|
|
|
|
|
|
|
// 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' ), ' ' );
|
|
|
|
}
|
2009-01-23 19:23:19 +00:00
|
|
|
$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' );
|
2009-01-23 19:23:19 +00:00
|
|
|
|
|
|
|
$wgOut->addInlineScript( $exprScript );
|
|
|
|
|
|
|
|
global $wgUser;
|
|
|
|
|
|
|
|
if ($wgUser->isAllowed( 'abusefilter-modify' )) {
|
|
|
|
// Hacky little box to re-enable autoconfirmed if it got disabled
|
|
|
|
$rac = '';
|
2009-02-07 09:34:11 +00:00
|
|
|
$rac .= Xml::inputLabel(
|
|
|
|
wfMsg( 'abusefilter-tools-reautoconfirm-user' ),
|
|
|
|
'wpReAutoconfirmUser',
|
|
|
|
'reautoconfirm-user',
|
|
|
|
45 );
|
2009-01-23 22:49:13 +00:00
|
|
|
$rac .= ' ';
|
2009-02-07 09:34:11 +00:00
|
|
|
$rac .= Xml::element(
|
|
|
|
'input',
|
|
|
|
array(
|
|
|
|
'type' => 'button',
|
|
|
|
'id' => 'mw-abusefilter-reautoconfirmsubmit',
|
|
|
|
'onclick' => 'doReautoSubmit();',
|
|
|
|
'value' => wfMsg( 'abusefilter-tools-reautoconfirm-submit' )
|
|
|
|
)
|
|
|
|
);
|
2009-01-23 19:23:19 +00:00
|
|
|
$rac = Xml::fieldset( wfMsg( 'abusefilter-tools-reautoconfirm' ), $rac );
|
|
|
|
$wgOut->addHTML( $rac );
|
|
|
|
}
|
|
|
|
}
|
2009-02-07 09:34:11 +00:00
|
|
|
}
|