From 183851b06bd6c52f3cae5375f433da720d410447 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 11 Oct 2006 18:12:39 +0000 Subject: MediaWiki 1.7.1 wiederhergestellt --- includes/SpecialLockdb.php | 118 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 includes/SpecialLockdb.php (limited to 'includes/SpecialLockdb.php') diff --git a/includes/SpecialLockdb.php b/includes/SpecialLockdb.php new file mode 100644 index 00000000..38d715be --- /dev/null +++ b/includes/SpecialLockdb.php @@ -0,0 +1,118 @@ +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( '' ); + } +} + +/** + * + * @package MediaWiki + * @subpackage SpecialPage + */ +class DBLockForm { + var $reason = ''; + + function DBLockForm() { + global $wgRequest; + $this->reason = $wgRequest->getText( 'wpLockReason' ); + } + + function showForm( $err ) { + global $wgOut, $wgUser; + + $wgOut->setPagetitle( wfMsg( 'lockdb' ) ); + $wgOut->addWikiText( wfMsg( 'lockdbtext' ) ); + + if ( "" != $err ) { + $wgOut->setSubtitle( wfMsg( 'formerror' ) ); + $wgOut->addHTML( '

' . htmlspecialchars( $err ) . "

\n" ); + } + $lc = htmlspecialchars( wfMsg( 'lockconfirm' ) ); + $lb = htmlspecialchars( wfMsg( 'lockbtn' ) ); + $elr = htmlspecialchars( wfMsg( 'enterlockreason' ) ); + $titleObj = Title::makeTitle( NS_SPECIAL, 'Lockdb' ); + $action = $titleObj->escapeLocalURL( 'action=submit' ); + $token = htmlspecialchars( $wgUser->editToken() ); + + $wgOut->addHTML( << +{$elr}: + + + + + + + + + + +
+ + {$lc}
  + +
+ + +END +); + + } + + function doSubmit() { + global $wgOut, $wgUser, $wgLang, $wgRequest; + global $wgReadOnlyFile; + + if ( ! $wgRequest->getCheck( 'wpLockConfirm' ) ) { + $this->showForm( wfMsg( 'locknoconfirm' ) ); + return; + } + $fp = fopen( $wgReadOnlyFile, 'w' ); + + if ( false === $fp ) { + $wgOut->showFileNotFoundError( $wgReadOnlyFile ); + return; + } + fwrite( $fp, $this->reason ); + fwrite( $fp, "\n

(by " . $wgUser->getName() . " at " . + $wgLang->timeanddate( wfTimestampNow() ) . ")\n" ); + fclose( $fp ); + + $titleObj = Title::makeTitle( NS_SPECIAL, 'Lockdb' ); + $wgOut->redirect( $titleObj->getFullURL( 'action=success' ) ); + } + + function showSuccess() { + global $wgOut; + + $wgOut->setPagetitle( wfMsg( 'lockdb' ) ); + $wgOut->setSubtitle( wfMsg( 'lockdbsuccesssub' ) ); + $wgOut->addWikiText( wfMsg( 'lockdbsuccesstext' ) ); + } +} + +?> -- cgit v1.2.2