From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/specials/SpecialLockdb.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'includes/specials/SpecialLockdb.php') diff --git a/includes/specials/SpecialLockdb.php b/includes/specials/SpecialLockdb.php index aad3cea4..5c861b31 100644 --- a/includes/specials/SpecialLockdb.php +++ b/includes/specials/SpecialLockdb.php @@ -34,12 +34,13 @@ class SpecialLockdb extends SpecialPage { } public function execute( $par ) { - global $wgUser, $wgOut, $wgRequest; + global $wgUser, $wgRequest; $this->setHeaders(); - if( !$wgUser->isAllowed( 'siteadmin' ) ) { - $wgOut->permissionRequired( 'siteadmin' ); + # Permission check + if( !$this->userCanExecute( $wgUser ) ) { + $this->displayRestrictionError(); return; } @@ -57,7 +58,7 @@ class SpecialLockdb extends SpecialPage { if ( $action == 'success' ) { $this->showSuccess(); - } else if ( $action == 'submit' && $wgRequest->wasPosted() && + } elseif ( $action == 'submit' && $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { $this->doSubmit(); } else { @@ -109,7 +110,10 @@ class SpecialLockdb extends SpecialPage { $this->showForm( wfMsg( 'locknoconfirm' ) ); return; } - $fp = @fopen( $wgReadOnlyFile, 'w' ); + + wfSuppressWarnings(); + $fp = fopen( $wgReadOnlyFile, 'w' ); + wfRestoreWarnings(); if ( false === $fp ) { # This used to show a file not found error, but the likeliest reason for fopen() @@ -119,8 +123,14 @@ class SpecialLockdb extends SpecialPage { return; } fwrite( $fp, $this->reason ); - fwrite( $fp, "\n

(by " . $wgUser->getName() . " at " . - $wgContLang->timeanddate( wfTimestampNow() ) . ")

\n" ); + $timestamp = wfTimestampNow(); + fwrite( $fp, "\n

" . wfMsgExt( + 'lockedbyandtime', + array( 'content', 'parsemag' ), + $wgUser->getName(), + $wgContLang->date( $timestamp ), + $wgContLang->time( $timestamp ) + ) . "

\n" ); fclose( $fp ); $wgOut->redirect( $this->getTitle()->getFullURL( 'action=success' ) ); -- cgit v1.2.3-54-g00ecf