isAllowed( 'siteadmin' ) ) { $wgOut->permissionRequired( 'siteadmin' ); return; } $action = $wgRequest->getVal( 'action' ); $f = new DBUnlockForm(); if ( "success" == $action ) { $f->showSuccess(); } else if ( "submit" == $action && $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { $f->doSubmit(); } else { $f->showForm( "" ); } } /** * * @addtogroup SpecialPage */ class DBUnlockForm { function showForm( $err ) { global $wgOut, $wgUser; global $wgReadOnlyFile; if( !file_exists( $wgReadOnlyFile ) ) { $wgOut->addWikiText( wfMsg( 'databasenotlocked' ) ); return; } $wgOut->setPagetitle( wfMsg( "unlockdb" ) ); $wgOut->addWikiText( wfMsg( "unlockdbtext" ) ); if ( "" != $err ) { $wgOut->setSubtitle( wfMsg( "formerror" ) ); $wgOut->addHTML( '
' . htmlspecialchars( $err ) . "
\n" ); } $lc = htmlspecialchars( wfMsg( "unlockconfirm" ) ); $lb = htmlspecialchars( wfMsg( "unlockbtn" ) ); $titleObj = SpecialPage::getTitleFor( "Unlockdb" ); $action = $titleObj->escapeLocalURL( "action=submit" ); $token = htmlspecialchars( $wgUser->editToken() ); $wgOut->addHTML( <<{$lc} | |