* (bug 12553) Fixed invalid XHTML in edit conflict screen
[lhc/web/wiklou.git] / includes / SpecialUnlockdb.php
index 6ff28c7..52025e5 100644 (file)
@@ -1,8 +1,7 @@
 <?php
 /**
  *
- * @package MediaWiki
- * @subpackage SpecialPage
+ * @addtogroup SpecialPage
  */
 
 /**
 function wfSpecialUnlockdb() {
        global $wgUser, $wgOut, $wgRequest;
 
-       if ( ! $wgUser->isAllowed('siteadmin') ) {
-               $wgOut->developerRequired();
+       if( !$wgUser->isAllowed( 'siteadmin' ) ) {
+               $wgOut->permissionRequired( 'siteadmin' );
                return;
        }
+
        $action = $wgRequest->getVal( 'action' );
        $f = new DBUnlockForm();
 
@@ -30,14 +30,19 @@ function wfSpecialUnlockdb() {
 
 /**
  *
- * @package MediaWiki
- * @subpackage SpecialPage
+ * @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" ) );
 
@@ -47,7 +52,7 @@ class DBUnlockForm {
                }
                $lc = htmlspecialchars( wfMsg( "unlockconfirm" ) );
                $lb = htmlspecialchars( wfMsg( "unlockbtn" ) );
-               $titleObj = Title::makeTitle( NS_SPECIAL, "Unlockdb" );
+               $titleObj = SpecialPage::getTitleFor( "Unlockdb" );
                $action = $titleObj->escapeLocalURL( "action=submit" );
                $token = htmlspecialchars( $wgUser->editToken() );
 
@@ -76,7 +81,7 @@ END
        }
 
        function doSubmit() {
-               global $wgOut, $wgUser, $wgRequest, $wgReadOnlyFile;
+               global $wgOut, $wgRequest, $wgReadOnlyFile;
 
                $wpLockConfirm = $wgRequest->getCheck( 'wpLockConfirm' );
                if ( ! $wpLockConfirm ) {
@@ -84,16 +89,16 @@ END
                        return;
                }
                if ( @! unlink( $wgReadOnlyFile ) ) {
-                       $wgOut->fileDeleteError( $wgReadOnlyFile );
+                       $wgOut->showFileDeleteError( $wgReadOnlyFile );
                        return;
                }
-               $titleObj = Title::makeTitle( NS_SPECIAL, "Unlockdb" );
+               $titleObj = SpecialPage::getTitleFor( "Unlockdb" );
                $success = $titleObj->getFullURL( "action=success" );
                $wgOut->redirect( $success );
        }
 
        function showSuccess() {
-               global $wgOut, $wgUser;
+               global $wgOut;
                global $ip;
 
                $wgOut->setPagetitle( wfMsg( "unlockdb" ) );
@@ -102,4 +107,4 @@ END
        }
 }
 
-?>
+