From 7aea55023baa76d9626d31362defbfd58a6fae93 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Wed, 18 Jan 2006 00:04:30 +0000 Subject: [PATCH] Revert to un-borked version, sorry Brion --- includes/SpecialLockdb.php | 24 ++++++++++++--------- includes/SpecialUnlockdb.php | 42 ++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/includes/SpecialLockdb.php b/includes/SpecialLockdb.php index 652549a6ca..a07c1d8d2b 100644 --- a/includes/SpecialLockdb.php +++ b/includes/SpecialLockdb.php @@ -10,18 +10,22 @@ */ function wfSpecialLockdb() { global $wgUser, $wgOut, $wgRequest; - if( $wgUser->isAllowed( 'siteadmin' ) ) { - $form = new DBLockForm(); - if( $action == 'success' ) { - $form->showSuccess(); - } else if( $action == 'submit' && wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { - $form->doSubmit(); - } else { - $form->showForm(); - } else { - $wgOut->permissionRequired( 'siteadmin' ); + + if ( ! $wgUser->isAllowed('siteadmin') ) { + $wgOut->developerRequired(); return; } + $action = $wgRequest->getVal( 'action' ); + $f = new DBLockForm(); + + if ( 'success' == $action ) { + $f->showSuccess(); + } else if ( 'submit' == $action && $wgRequest->wasPosted() && + $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { + $f->doSubmit(); + } else { + $f->showForm( '' ); + } } /** diff --git a/includes/SpecialUnlockdb.php b/includes/SpecialUnlockdb.php index 7050e0daf3..6ff28c7902 100644 --- a/includes/SpecialUnlockdb.php +++ b/includes/SpecialUnlockdb.php @@ -10,18 +10,22 @@ */ function wfSpecialUnlockdb() { global $wgUser, $wgOut, $wgRequest; - if( $wgUser->isAllowed( 'siteadmin' ) ) { - $form = new DBUnlockForm(); - if( $action == 'success' ) { - $form->showSuccess(); - } else if( $action == 'submit' && wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { - $form->doSubmit(); - } else { - $form->showForm(); - } else { - $wgOut->permissionRequired( 'siteadmin' ); + + if ( ! $wgUser->isAllowed('siteadmin') ) { + $wgOut->developerRequired(); 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( "" ); + } } /** @@ -30,17 +34,17 @@ function wfSpecialUnlockdb() { * @subpackage SpecialPage */ class DBUnlockForm { - - function showForm( $error = false ) { + function showForm( $err ) + { global $wgOut, $wgUser; - $wgOut->setPagetitle( wfMsg( 'unlockdb' ) ); - $wgOut->addWikiText( wfMsg( 'unlockdbtext' ) ); - - if( $error ) { - $wgOut->setSubtitle( wfMsg( 'formerror' ) ); - $wgOut->addHTML( '

' . htmlspecialchars( $error ) . "

\n" ); + + $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 = Title::makeTitle( NS_SPECIAL, "Unlockdb" ); -- 2.20.1