// Older revisions may have been removed since the link
// was created, or we may simply have got bogus input.
$this->editFormPageTop .= $wgOut->parse( '<div class="error mw-undo-norev">' .
- wfMsgNoTrans( 'undo-norev' ) . '</div>'true, /* interface */true );
+ wfMsgNoTrans( 'undo-norev' ) . '</div>', true, /* interface */true );
}
} elseif ( $section != '' ) {
if ( $section == 'new' ) {
$wgOut->addWikiText( $editnotice_base_msg->plain() );
}
}
+ } else {
+ # Even if there are no subpages in namespace, we still don't want / in MW ns.
+ $editnoticeText = $editnotice_ns . '-' . str_replace( '/', '-', $this->mTitle->getDBkey() );
+ $editnoticeMsg = wfMessage( $editnoticeText )->inContentLanguage();
+ if ( $editnoticeMsg->exists() ) {
+ $wgOut->addWikiText( $editnoticeMsg->plain() );
+ }
}
# Attempt submission here. This will check for edit conflicts,
LogEventsList::showLogExtract(
$wgOut,
'block',
- $user->getUserPage()->getPrefixedText(),
+ $user->getUserPage(),
'',
array(
'lim' => 1,
}
# Give a notice if the user is editing a deleted/moved page...
if ( !$this->mTitle->exists() ) {
- LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(),
+ LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle,
'', array( 'lim' => 10,
'conds' => array( "log_action != 'revision'" ),
'showIfEmpty' => false,
function internalAttemptSave( &$result, $bot = false ) {
global $wgFilterCallback, $wgUser, $wgRequest, $wgParser;
global $wgMaxArticleSize;
-
+
$status = Status::newGood();
wfProfileIn( __METHOD__ );
$status->setResult( false, $code );
wfProfileOut( __METHOD__ . '-checks' );
-
wfProfileOut( __METHOD__ );
return $status;
wfProfileOut( __METHOD__ );
return $status;
}
+
if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) {
# Check block state against master, thus 'false'.
$status->setResult( false, self::AS_BLOCKED_PAGE_FOR_USER );
wfProfileOut( __METHOD__ );
return $status;
}
+
$this->kblength = (int)( strlen( $this->textbox1 ) / 1024 );
if ( $this->kblength > $wgMaxArticleSize ) {
// Error will be displayed by showEditForm()
{
if ( md5( $this->summary ) == $this->autoSumm ) {
$this->missingSummary = true;
+ $status->fatal( 'missingsummary' );
+ $status->value = self::AS_SUMMARY_NEEDED;
wfProfileOut( __METHOD__ );
- return self::AS_SUMMARY_NEEDED;
+ return $status;
}
}
* during form output near the top, for captchas and the like.
*/
function showEditForm( $formCallback = null ) {
- global $wgOut, $wgUser, $wgEnableInterwikiTranscluding, $wgEnableInterwikiTemplatesTracking;
+ global $wgOut, $wgUser;
wfProfileIn( __METHOD__ );
$toolbar = '';
}
+
$wgOut->addHTML( $this->editFormPageTop );
if ( $wgUser->getOption( 'previewontop' ) ) {
$templates = $this->getTemplates();
$formattedtemplates = Linker::formatTemplates( $templates, $this->preview, $this->section != '');
- $distantTemplates = $this->getDistantTemplates();
- $formattedDistantTemplates = Linker::formatDistantTemplates( $distantTemplates, $this->preview, $this->section != '' );
-
$hiddencats = $this->mArticle->getHiddenCategories();
$formattedhiddencats = Linker::formatHiddenCategories( $hiddencats );
<div class='templatesUsed'>
{$formattedtemplates}
</div>
-HTML
-);
-
- if ( $wgEnableInterwikiTranscluding && $wgEnableInterwikiTemplatesTracking ) {
- $wgOut->addHTML( <<<HTML
-{$this->editFormTextAfterTools}
-<div class='distantTemplatesUsed'>
-{$formattedDistantTemplates}
-</div>
-HTML
-);
- }
-
- $wgOut->addHTML( <<<HTML
-{$this->editFormTextAfterTools}
<div class='hiddencats'>
{$formattedhiddencats}
</div>
# Then it must be protected based on static groups (regular)
$noticeMsg = 'protectedpagewarning';
}
- LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
+ LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle, '',
array( 'lim' => 1, 'msgKey' => array( $noticeMsg ) ) );
}
if ( $this->mTitle->isCascadeProtected() ) {
$wgOut->wrapWikiMsg( $notice, array( 'cascadeprotectedwarning', $cascadeSourcesCount ) );
}
if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) {
- LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
+ LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle, '',
array( 'lim' => 1,
'showIfEmpty' => false,
'msgKey' => array( 'titleprotectedwarning' ),
}
}
- function getDistantTemplates() {
- global $wgEnableInterwikiTemplatesTracking;
- if ( !$wgEnableInterwikiTemplatesTracking ) {
- return array( );
- }
- if ( $this->preview || $this->section != '' ) {
- $templates = array();
- if ( !isset( $this->mParserOutput ) ) return $templates;
- $templatesList = $this->mParserOutput->getDistantTemplates();
- foreach( $templatesList as $prefix => $templatesbyns ) {
- foreach( $templatesbyns as $ns => $template ) {
- foreach( array_keys( $template ) as $dbk ) {
- $templates[] = Title::makeTitle( $ns, $dbk, null, $prefix );
- }
- }
- }
- return $templates;
- } else {
- return $this->mArticle->getUsedDistantTemplates();
- }
- }
-
/**
* Call the stock "user is blocked" page
*/
'key' => 'R'
)
);
- $toolbar = "<div id='toolbar'>\n";
$script = '';
foreach ( $toolarray as $tool ) {
$cssId = $tool['id'],
);
- $paramList = implode( ',',
- array_map( array( 'Xml', 'encodeJsVar' ), $params ) );
- $script .= "mw.toolbar.addButton($paramList);\n";
+ $script .= Xml::encodeJsCall( 'mw.toolbar.addButton', $params );
}
- $wgOut->addScript( Html::inlineScript(
- "if ( window.mediaWiki ) {{$script}}"
- ) );
+ $wgOut->addScript( Html::inlineScript( ResourceLoader::makeLoaderConditionalScript( $script ) ) );
- $toolbar .= "\n</div>";
+ $toolbar = '<div id="toolbar"></div>';
wfRunHooks( 'EditPageBeforeEditToolbar', array( &$toolbar ) );