5 * @subpackage SpecialPage
11 function wfSpecialUnlockdb() {
12 global $wgUser, $wgOut, $wgRequest;
14 if ( ! $wgUser->isAllowed('siteadmin') ) {
15 $wgOut->developerRequired();
18 $action = $wgRequest->getVal( 'action' );
19 $f = new DBUnlockForm();
21 if ( "success" == $action ) {
23 } else if ( "submit" == $action && $wgRequest->wasPosted() &&
24 $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
34 * @subpackage SpecialPage
37 function showForm( $err )
39 global $wgOut, $wgUser, $wgLang;
41 $wgOut->setPagetitle( wfMsg( "unlockdb" ) );
42 $wgOut->addWikiText( wfMsg( "unlockdbtext" ) );
45 $wgOut->setSubtitle( wfMsg( "formerror" ) );
46 $wgOut->addHTML( '<p class="error">' . htmlspecialchars( $err ) . "</p>\n" );
48 $lc = htmlspecialchars( wfMsg( "unlockconfirm" ) );
49 $lb = htmlspecialchars( wfMsg( "unlockbtn" ) );
50 $titleObj = Title
::makeTitle( NS_SPECIAL
, "Unlockdb" );
51 $action = $titleObj->escapeLocalURL( "action=submit" );
52 $token = htmlspecialchars( $wgUser->editToken() );
54 $wgOut->addHTML( <<<END
56 <form id="unlockdb" method="post" action="{$action}">
60 <input type="checkbox" name="wpLockConfirm" />
62 <td align="left">{$lc}</td>
67 <input type="submit" name="wpLock" value="{$lb}" />
71 <input type="hidden" name="wpEditToken" value="{$token}" />
79 global $wgOut, $wgUser, $wgLang;
80 global $wgRequest, $wgReadOnlyFile;
82 $wpLockConfirm = $wgRequest->getCheck( 'wpLockConfirm' );
83 if ( ! $wpLockConfirm ) {
84 $this->showForm( wfMsg( "locknoconfirm" ) );
87 if ( @! unlink( $wgReadOnlyFile ) ) {
88 $wgOut->fileDeleteError( $wgReadOnlyFile );
91 $titleObj = Title
::makeTitle( NS_SPECIAL
, "Unlockdb" );
92 $success = $titleObj->getFullURL( "action=success" );
93 $wgOut->redirect( $success );
96 function showSuccess() {
97 global $wgOut, $wgUser;
100 $wgOut->setPagetitle( wfMsg( "unlockdb" ) );
101 $wgOut->setSubtitle( wfMsg( "unlockdbsuccesssub" ) );
102 $wgOut->addWikiText( wfMsg( "unlockdbsuccesstext", $ip ) );