setHeaders(); if( !$wgUser->isAllowed( 'siteadmin' ) ) { $wgOut->permissionRequired( 'siteadmin' ); return; } $this->outputHeader(); # If the lock file isn't writable, we can do sweet bugger all global $wgReadOnlyFile; if( !is_writable( dirname( $wgReadOnlyFile ) ) ) { self::notWritable(); return; } $action = $wgRequest->getVal( 'action' ); $this->reason = $wgRequest->getVal( 'wpLockReason', '' ); if ( $action == 'success' ) { $this->showSuccess(); } else if ( $action == 'submit' && $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { $this->doSubmit(); } else { $this->showForm(); } } private function showForm( $err = '' ) { global $wgOut, $wgUser; $wgOut->addWikiMsg( 'lockdbtext' ); if ( $err != '' ) { $wgOut->setSubtitle( wfMsg( 'formerror' ) ); $wgOut->addHTML( '
' . htmlspecialchars( $err ) . "
\n" ); } $wgOut->addHTML( Html::openElement( 'form', array( 'id' => 'lockdb', 'method' => 'POST', 'action' => $this->getTitle()->getLocalURL( 'action=submit' ) ) ). "\n" . wfMsgHtml( 'enterlockreason' ) . ":\n" . Html::textarea( 'wpLockReason', $this->reason, array( 'rows' => 4 ) ). "" . Html::openElement( 'td', array( 'style' => 'text-align:left' ) ) . " " . Html::input( 'wpLock', wfMsg( 'lockbtn' ), 'submit' ) . " |
(by " . $wgUser->getName() . " at " . $wgContLang->timeanddate( wfTimestampNow() ) . ")
\n" ); fclose( $fp ); $wgOut->redirect( $this->getTitle()->getFullURL( 'action=success' ) ); } private function showSuccess() { global $wgOut; $wgOut->setPagetitle( wfMsg( 'lockdb' ) ); $wgOut->setSubtitle( wfMsg( 'lockdbsuccesssub' ) ); $wgOut->addWikiMsg( 'lockdbsuccesstext' ); } public static function notWritable() { global $wgOut; $wgOut->showErrorPage( 'lockdb', 'lockfilenotwritable' ); } }