* Fetch initial editing page content.
*
* @param $def_text string
- * @returns mixed string on success, $def_text for invalid sections
+ * @return mixed string on success, $def_text for invalid sections
* @private
*/
function getContent( $def_text = '' ) {
wfMsgNoTrans( 'undo-success' ) . '</div>', true, /* interface */true );
$firstrev = $oldrev->getNext();
# If we just undid one rev, use an autosummary
- if ( $firstrev->mId == $undo ) {
- $this->summary = wfMsgForContent( 'undo-summary', $undo, $undorev->getUserText() );
+ if ( $firstrev->getId() == $undo ) {
+ $undoSummary = wfMsgForContent( 'undo-summary', $undo, $undorev->getUserText() );
+ if ( $this->summary === '' ) {
+ $this->summary = $undoSummary;
+ } else {
+ $this->summary = $undoSummary . wfMsgForContent( 'colon-separator' ) . $this->summary;
+ }
$this->undidRev = $undo;
}
$this->formtype = 'diff';
$permErrors = $this->getEditPermissionErrors();
if ( $permErrors ) {
+ // Auto-block user's IP if the account was "hard" blocked
+ $wgUser->spreadAnyEditBlock();
+
wfDebug( __METHOD__ . ": User can't edit\n" );
$content = $this->getContent( null );
$content = $content === '' ? null : $content;
wfProfileOut( __METHOD__ );
return $status;
}
- if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section, $this->hookError, $this->summary ) ) {
+ if ( $wgFilterCallback && is_callable( $wgFilterCallback ) && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section, $this->hookError, $this->summary ) ) {
# Error messages or other handling should be performed by the filter function
$status->setResult( false, self::AS_FILTERING );
wfProfileOut( __METHOD__ . '-checks' );
}
if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) {
+ // Auto-block user's IP if the account was "hard" blocked
+ $wgUser->spreadAnyEditBlock();
# Check block state against master, thus 'false'.
$status->setResult( false, self::AS_BLOCKED_PAGE_FOR_USER );
wfProfileOut( __METHOD__ . '-checks' );
function setHeaders() {
global $wgOut;
$wgOut->setRobotPolicy( 'noindex,nofollow' );
- if ( $this->formtype == 'preview' ) {
- $wgOut->setPageTitleActionText( wfMsg( 'preview' ) );
- }
if ( $this->isConflict ) {
- $wgOut->setPageTitle( wfMsg( 'editconflict', $this->getContextTitle()->getPrefixedText() ) );
+ $wgOut->setPageTitle( wfMessage( 'editconflict', $this->getContextTitle()->getPrefixedText() ) );
} elseif ( $this->section != '' ) {
$msg = $this->section == 'new' ? 'editingcomment' : 'editingsection';
- $wgOut->setPageTitle( wfMsg( $msg, $this->getContextTitle()->getPrefixedText() ) );
+ $wgOut->setPageTitle( wfMessage( $msg, $this->getContextTitle()->getPrefixedText() ) );
} else {
# Use the title defined by DISPLAYTITLE magic word when present
if ( isset( $this->mParserOutput )
} else {
$title = $this->getContextTitle()->getPrefixedText();
}
- $wgOut->setPageTitle( wfMsg( 'editing', $title ) );
+ $wgOut->setPageTitle( wfMessage( 'editing', $title ) );
}
}
* 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>
if ( $this->isCssJsSubpage ) {
# Check the skin exists
if ( $this->isWrongCaseCssJsPage ) {
- $wgOut->wrapWikiMsg( "<div class='error' id='mw-userinvalidcssjstitle'>\n$1\n</div>", array( 'userinvalidcssjstitle', $this->getContextTitle()->getSkinFromCssJsSubpage() ) );
+ $wgOut->wrapWikiMsg( "<div class='error' id='mw-userinvalidcssjstitle'>\n$1\n</div>", array( 'userinvalidcssjstitle', $this->mTitle->getSkinFromCssJsSubpage() ) );
}
if ( $this->formtype !== 'preview' ) {
if ( $this->isCssSubpage )
global $wgOut, $wgUser;
$wikitext = $this->safeUnicodeOutput( $content );
- if ( $wikitext !== '' ) {
+ if ( strval($wikitext) !== '' ) {
// Ensure there's a newline at the end, otherwise adding lines
// is awkward.
// But don't add a newline if the ext is empty, or Firefox in XHTML
$de = new DifferenceEngine( $this->mTitle );
$de->setText( $this->textbox2, $this->textbox1 );
- $de->showDiff( wfMsg( "yourtext" ), wfMsg( "storedversion" ) );
+ $de->showDiff( wfMsgExt( 'yourtext', 'parseinline' ), wfMsg( 'storedversion' ) );
$wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourtext" );
$this->showTextbox2();
}
}
- 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
*/
array( 'returnto' => $this->getContextTitle()->getPrefixedText() )
);
- $wgOut->setPageTitle( wfMsg( 'whitelistedittitle' ) );
+ $wgOut->setPageTitle( wfMessage( 'whitelistedittitle' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->setArticleRelated( false );
function noSuchSectionPage() {
global $wgOut;
- $wgOut->setPageTitle( wfMsg( 'nosuchsectiontitle' ) );
+ $wgOut->setPageTitle( wfMessage( 'nosuchsectiontitle' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->setArticleRelated( false );
static function spamPage( $match = false ) {
global $wgOut, $wgTitle;
- $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) );
+ $wgOut->setPageTitle( wfMessage( 'spamprotectiontitle' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->setArticleRelated( false );
global $wgOut;
$this->textbox2 = $this->textbox1;
- $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) );
+ $wgOut->setPageTitle( wfMessage( 'spamprotectiontitle' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->setArticleRelated( false );
$wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourdiff" );
$de = new DifferenceEngine( $this->mTitle );
$de->setText( $this->getContent(), $this->textbox2 );
- $de->showDiff( wfMsg( "storedversion" ), wfMsg( "yourtext" ) );
+ $de->showDiff( wfMsg( "storedversion" ), wfMsgExt( 'yourtext', 'parseinline' ) );
$wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourtext" );
$this->showTextbox2();
function noCreatePermission() {
global $wgOut;
- $wgOut->setPageTitle( wfMsg( 'nocreatetitle' ) );
+ $wgOut->setPageTitle( wfMessage( 'nocreatetitle' ) );
$wgOut->addWikiMsg( 'nocreatetext' );
}
$wgOut->permissionRequired( 'upload' );
return false;
}
+ return false;
}
/**