10 function wfSpecialUnlockdb() {
11 global $wgUser, $wgOut, $wgRequest;
13 if( !$wgUser->isAllowed( 'siteadmin' ) ) {
14 $wgOut->permissionRequired( 'siteadmin' );
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' ) ) ) {
32 * @ingroup SpecialPage
35 function showForm( $err )
37 global $wgOut, $wgUser;
39 global $wgReadOnlyFile;
40 if( !file_exists( $wgReadOnlyFile ) ) {
41 $wgOut->addWikiMsg( 'databasenotlocked' );
45 $wgOut->setPagetitle( wfMsg( "unlockdb" ) );
46 $wgOut->addWikiMsg( "unlockdbtext" );
49 $wgOut->setSubtitle( wfMsg( "formerror" ) );
50 $wgOut->addHTML( '<p class="error">' . htmlspecialchars( $err ) . "</p>\n" );
52 $lc = htmlspecialchars( wfMsg( "unlockconfirm" ) );
53 $lb = htmlspecialchars( wfMsg( "unlockbtn" ) );
54 $titleObj = SpecialPage
::getTitleFor( "Unlockdb" );
55 $action = $titleObj->escapeLocalURL( "action=submit" );
56 $token = htmlspecialchars( $wgUser->editToken() );
58 $wgOut->addHTML( <<<END
60 <form id="unlockdb" method="post" action="{$action}">
64 <input type="checkbox" name="wpLockConfirm" />
66 <td align="left">{$lc}</td>
71 <input type="submit" name="wpLock" value="{$lb}" />
75 <input type="hidden" name="wpEditToken" value="{$token}" />
83 global $wgOut, $wgRequest, $wgReadOnlyFile;
85 $wpLockConfirm = $wgRequest->getCheck( 'wpLockConfirm' );
86 if ( ! $wpLockConfirm ) {
87 $this->showForm( wfMsg( "locknoconfirm" ) );
90 if ( @! unlink( $wgReadOnlyFile ) ) {
91 $wgOut->showFileDeleteError( $wgReadOnlyFile );
94 $titleObj = SpecialPage
::getTitleFor( "Unlockdb" );
95 $success = $titleObj->getFullURL( "action=success" );
96 $wgOut->redirect( $success );
99 function showSuccess() {
103 $wgOut->setPagetitle( wfMsg( "unlockdb" ) );
104 $wgOut->setSubtitle( wfMsg( "unlockdbsuccesssub" ) );
105 $wgOut->addWikiMsg( "unlockdbsuccesstext", $ip );