if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
$wgMessageCache->loadAllMessages();
# If this is a system message, get the default text.
- $text = wfMsgWeirdKey ( $this->mTitle->getText() ) ;
+ $text = wfMsgWeirdKey( $this->mTitle->getText() ) ;
} else {
# If requested, preload some text.
$text = $this->getPreloadedText( $preload );
wfDebug( __METHOD__.": enter\n" );
// this is not an article
- $wgOut->setArticleFlag(false);
+ $wgOut->setArticleFlag( false );
$this->importFormData( $wgRequest );
$this->firsttime = false;
wfProfileOut( __METHOD__ );
return;
}
-
- $wgOut->addScriptFile( 'edit.js' );
if( wfReadOnly() ) {
- $this->readOnlyPage( $this->getContent() );
- wfProfileOut( __METHOD__ );
- return;
+ if( $this->save ){
+ // Force preview
+ $this->save = false;
+ $this->preview = true;
+ } elseif( $this->preview || $this->diff ){
+ // A warning will be displayed instead
+ } else {
+ $this->readOnlyPage( $this->getContent() );
+ wfProfileOut( __METHOD__ );
+ return;
+ }
}
- $permErrors = $this->mTitle->getUserPermissionsErrors('edit', $wgUser);
+ $wgOut->addScriptFile( 'edit.js' );
+
+ $permErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser );
if( !$this->mTitle->exists() ) {
$permErrors = array_merge( $permErrors,
- wfArrayDiff2( $this->mTitle->getUserPermissionsErrors('create', $wgUser), $permErrors ) );
+ wfArrayDiff2( $this->mTitle->getUserPermissionsErrors( 'create', $wgUser ), $permErrors ) );
}
# Ignore some permissions errors.
// Don't worry about blocks when previewing/diffing
$remove[] = $error;
}
-
- if ($error[0] == 'readonlytext')
- {
- if ($this->edit) {
- $this->formtype = 'preview';
- } elseif ($this->save || $this->preview || $this->diff) {
- $remove[] = $error;
- }
- }
}
$permErrors = wfArrayDiff2( $permErrors, $remove );
} else {
if ( $this->save ) {
$this->formtype = 'save';
- } else if ( $this->preview ) {
+ } else if( $this->preview ) {
$this->formtype = 'preview';
} else if ( $this->diff ) {
$this->formtype = 'diff';
}
if( wfReadOnly() ) {
- $wgOut->addHTML( '<div id="mw-read-only-warning">'.wfMsgWikiHTML( 'readonlywarning' ).'</div>' );
+ $wgOut->wrapWikiMsg( "<div id=\"mw-read-only-warning\">\n$1\n</div>", array( 'readonlywarning', wfReadOnlyReason() ) );
} elseif( $wgUser->isAnon() && $this->formtype != 'preview' ) {
- $wgOut->addHTML( '<div id="mw-anon-edit-warning">'.wfMsgWikiHTML( 'anoneditwarning' ).'</div>' );
+ $wgOut->wrapWikiMsg( '<div id="mw-anon-edit-warning">$1</div>', 'anoneditwarning' );
} else {
if( $this->isCssJsSubpage && $this->formtype != 'preview' ) {
# Check the skin exists
'longpageerror' => '<strong>ERROR: The text you have submitted is $1 kilobytes long, which is longer than the maximum of $2 kilobytes.
It cannot be saved.</strong>',
'readonlywarning' => '<strong>WARNING: The database has been locked for maintenance, so you will not be able to save your edits right now.
-You may wish to cut-n-paste the text into a text file and save it for later.</strong>',
+You may wish to cut-n-paste the text into a text file and save it for later.</strong>
+
+The administrator who locked it offered this explanation: $1',
'protectedpagewarning' => '<strong>WARNING: This page has been locked so that only users with sysop privileges can edit it.</strong>',
'semiprotectedpagewarning' => "'''Note:''' This page has been locked so that only registered users can edit it.",
'cascadeprotectedwarning' => "'''Warning:''' This page has been locked so that only users with sysop privileges can edit it, because it is included in the following cascade-protected {{PLURAL:$1|page|pages}}:",