userCanExecute( $wgUser ) ){
$this->displayRestrictionError();
return;
}
$this->setHeaders();
$this->outputHeader();
$target = $wgRequest->getText( 'target', $par );
// Normalise name
if ( $target !== '' ) {
$user = User::newFromName( $target );
if ( $user ) $target = $user->getName();
}
$reason = $wgRequest->getText( 'wpReason',
wfMsgForContent( 'nuke-defaultreason', $target ) );
$posted = $wgRequest->wasPosted() &&
$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) );
if( $posted ) {
$pages = $wgRequest->getArray( 'pages' );
if( $pages ) {
return $this->doDelete( $pages, $reason );
}
}
if( $target != '' ) {
$this->listForm( $target, $reason );
} else {
$this->promptForm();
}
}
function promptForm() {
global $wgOut;
$input = Xml::input( 'target', 40 );
$submit = Xml::submitButton( wfMsg( 'nuke-submit-user' ) );
$wgOut->addWikiMsg( 'nuke-tools' );
$wgOut->addHTML(
Xml::openElement( 'form', array(
'action' => $this->getTitle()->getLocalURL( 'action=submit' ),
'method' => 'post' )
) . "$input\n$submit\n"
);
$wgOut->addHTML( "" );
}
function listForm( $username, $reason ) {
global $wgUser, $wgOut, $wgLang;
$pages = $this->getNewPages( $username );
if( count( $pages ) == 0 ) {
$wgOut->addWikiMsg( 'nuke-nopages', $username );
return $this->promptForm();
}
$wgOut->addWikiMsg( 'nuke-list', $username );
$nuke = $this->getTitle();
$submit = Xml::submitButton( wfMsg( 'nuke-submit-delete' ) );
$wgOut->addHTML(
Xml::openElement( 'form', array(
'action' => $nuke->getLocalURL( 'action=delete' ),
'method' => 'post' )
) .
Xml::hidden( 'wpEditToken', $wgUser->editToken() ) .
Xml::inputLabel(
wfMsg( 'deletecomment' ), 'wpReason', 'wpReason', 60, $reason
) . '
' .
Xml::submitButton( wfMsg( 'nuke-submit-delete' ) )
);
$wgOut->addHTML( '