$text = '';
if( !$this->mTitle->exists() ) {
-
- # If requested, preload some text.
- $text = $this->getPreloadedText( $preload );
-
+ if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
+ # If this is a system message, get the default text.
+ $text = wfMsgWeirdKey ( $this->mTitle->getText() ) ;
+ } else {
+ # If requested, preload some text.
+ $text = $this->getPreloadedText( $preload );
+ }
# We used to put MediaWiki:Newarticletext here if
# $text was empty at this point.
# This is now shown above the edit box instead.
// fetch the page record from the high-priority server,
// which is needed to guarantee we don't pick up lagged
// information.
-
+
$text = $this->mArticle->getContent();
if ( $undo > 0 ) {
$text = $oldrev_text;
$result = true;
}
-
+
if( $result ) {
# Inform the user of our success and set an automatic edit summary
$this->editFormPageTop .= $wgOut->parse( wfMsgNoTrans( 'undo-success' ) );
$this->summary = wfMsgForContent( 'undo-summary', $undo, $undorev->getUserText() );
- $this->formtype = 'preview'; # Preview the result.
+ $this->formtype = 'diff';
} else {
# Warn the user that something went wrong
$this->editFormPageTop .= $wgOut->parse( wfMsgNoTrans( 'undo-failure' ) );
}
-
+
}
}
else if( $section != '' ) {
}
}
}
-
+
wfProfileOut( __METHOD__ );
return $text;
}
// Remember whether a save was requested, so we can indicate
// if we forced preview due to session failure.
$this->mTriedSave = !$this->preview;
-
+
if ( $this->tokenOk( $request ) ) {
# Some browsers will not report any submit button
# if the user hits enter in the comment box.
} else {
$this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' );
}
-
- $this->autoSumm = $request->getText( 'wpAutoSummary' );
+
+ $this->autoSumm = $request->getText( 'wpAutoSummary' );
} else {
# Not a posted form? Start with nothing.
wfDebug( "$fname: Not a posted form.\n" );
wfProfileOut( $fname );
return true;
}
-
+
if ( !$wgUser->isAllowed('edit') ) {
if ( $wgUser->isAnon() ) {
$this->userNotLoggedInPage();
$this->summary = '';
$this->textbox1 = $this->getContent();
if ( !$this->mArticle->exists() && $this->mArticle->mTitle->getNamespace() == NS_MEDIAWIKI )
- $this->textbox1 = wfMsgWeirdKey( $this->mArticle->mTitle->getText() ) ;
+ $this->textbox1 = wfMsgWeirdKey( $this->mArticle->mTitle->getText() );
wfProxyCheck();
}
if ( $this->missingComment ) {
$wgOut->addWikiText( wfMsg( 'missingcommenttext' ) );
}
-
+
if( $this->missingSummary && $this->section != 'new' ) {
$wgOut->addWikiText( wfMsg( 'missingsummary' ) );
}
if( $this->missingSummary && $this->section == 'new' ) {
$wgOut->addWikiText( wfMsg( 'missingcommentheader' ) );
}
-
+
if( !$this->hookError == '' ) {
$wgOut->addWikiText( $this->hookError );
}
}
}
}
-
+
if( $this->mTitle->isProtected( 'edit' ) ) {
+
+ $cascadeSources = $this->mTitle->getCascadeProtectionSources( );
+
# Is the protection due to the namespace, e.g. interface text?
if( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
# Yes; remind the user
if( wfEmptyMsg( 'semiprotectedpagewarning', $notice ) || $notice == '-' ) {
$notice = '';
}
+ } elseif ($cascadeSources && count($cascadeSources) > 0) {
+ # Cascaded protection: warn the user.
+ $titles = '';
+
+ foreach ( $cascadeSources as $title ) {
+ $titles .= '* [[:' . $title->getPrefixedText() . "]]\n";
+ }
+
+ $notice = wfMsg( 'cascadeprotectedwarning' ) . "\r\n$titles";
} else {
# No; regular protection
$notice = wfMsg( 'protectedpagewarning' );
# Already watched
$this->watchthis = true;
}
-
+
if( $wgUser->getOption( 'minordefault' ) ) $this->minoredit = true;
}
$minoredithtml =
"<input tabindex='3' type='checkbox' value='1' name='wpMinoredit'".($this->minoredit?" checked='checked'":"").
" accesskey='".wfMsg('accesskey-minoredit')."' id='wpMinoredit' />\n".
- "<label for='wpMinoredit' title='".wfMsg('tooltip-minoredit')."'>{$minor}</label>\n";
+ "<label for='wpMinoredit'".$sk->tooltipAndAccesskey('minoredit').">{$minor}</label>\n";
}
$watchhtml = '';
$watchhtml = "<input tabindex='4' type='checkbox' name='wpWatchthis'".
($this->watchthis?" checked='checked'":"").
" accesskey=\"".htmlspecialchars(wfMsg('accesskey-watch'))."\" id='wpWatchthis' />\n".
- "<label for='wpWatchthis' title=\"" .
- htmlspecialchars(wfMsg('tooltip-watch'))."\">{$watchthis}</label>\n";
+ "<label for='wpWatchthis'".$sk->tooltipAndAccesskey('watch').">{$watchthis}</label>\n";
}
$checkboxhtml = $minoredithtml . $watchhtml;
'tabindex' => '5',
'value' => wfMsg('savearticle'),
'accesskey' => wfMsg('accesskey-save'),
- 'title' => wfMsg('tooltip-save'),
+ 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
);
$buttons['save'] = wfElement('input', $temp, '');
$temp = array(
'tabindex' => '7',
'value' => wfMsg('showdiff'),
'accesskey' => wfMsg('accesskey-diff'),
- 'title' => wfMsg('tooltip-diff'),
+ 'title' => wfMsg( 'tooltip-diff' ).' ['.wfMsg( 'accesskey-diff' ).']',
);
$buttons['diff'] = wfElement('input', $temp, '');
'tabindex' => '6',
'value' => wfMsg('showpreview'),
'accesskey' => '',
- 'title' => wfMsg('tooltip-preview'),
+ 'title' => wfMsg( 'tooltip-preview' ).' ['.wfMsg( 'accesskey-preview' ).']',
'style' => 'display: none;',
);
$buttons['preview'] = wfElement('input', $temp, '');
'tabindex' => '6',
'value' => wfMsg('showpreview'),
'accesskey' => wfMsg('accesskey-preview'),
- 'title' => wfMsg('tooltip-preview'),
+ 'title' => wfMsg( 'tooltip-preview' ).' ['.wfMsg( 'accesskey-preview' ).']',
);
$buttons['preview'] = wfElement('input', $temp, '');
$buttons['live'] = '';
if( $this->missingSummary ) {
$wgOut->addHTML( "<input type=\"hidden\" name=\"wpIgnoreBlankSummary\" value=\"1\" />\n" );
}
-
+
# For a bit more sophisticated detection of blank summaries, hash the
# automatic one and pass that in a hidden field.
$autosumm = $this->autoSumm ? $this->autoSumm : md5( $this->summary );
} else {
$wgOut->addHTML( '<div id="wikiPreview"></div>' );
}
-
+
if ( $this->formtype == 'diff') {
$wgOut->addHTML( $this->getDiff() );
}
# don't parse user css/js, show message about preview
# XXX: stupid php bug won't let us use $wgTitle->isCssJsSubpage() here
-
+
if ( $this->isCssJsSubpage ) {
if(preg_match("/\\.css$/", $wgTitle->getText() ) ) {
$previewtext = wfMsg('usercsspreview');
function blockedPage() {
global $wgOut, $wgUser;
$wgOut->blockedPage( false ); # Standard block notice on the top, don't 'return'
-
+
# If the user made changes, preserve them when showing the markup
- # (This happens when a user is blocked during edit, for instance)
+ # (This happens when a user is blocked during edit, for instance)
$first = $this->firsttime || ( !$this->save && $this->textbox1 == '' );
if( $first ) {
$source = $this->mTitle->exists() ? $this->getContent() : false;
} else {
$source = $this->textbox1;
}
-
+
# Spit out the source or the user's modified version
if( $source !== false ) {
$rows = $wgUser->getOption( 'rows' );
function userNotLoggedInPage() {
global $wgUser, $wgOut;
$skin = $wgUser->getSkin();
-
+
$loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
$loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $this->mTitle->getPrefixedUrl() );
-
+
$wgOut->setPageTitle( wfMsg( 'whitelistedittitle' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->setArticleRelated( false );
-
+
$wgOut->addHtml( wfMsgWikiHtml( 'whitelistedittext', $loginLink ) );
$wgOut->returnToMain( false, $this->mTitle->getPrefixedUrl() );
}
$wgOut->setPageTitle( wfMsg( 'confirmedittitle' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->setArticleRelated( false );
-
+
$wgOut->addWikiText( wfMsg( 'confirmedittext' ) );
$wgOut->returnToMain( false );
}
$wgOut->addWikiText( wfMsg( 'spamprotectiontext' ) );
if ( $match )
$wgOut->addWikiText( wfMsg( 'spamprotectionmatch', "<nowiki>{$match}</nowiki>" ) );
-
+
$wgOut->returnToMain( false );
}