X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FEditPage.php;h=1696b26a6afcc548723fddc093184c59d86fb14a;hb=e0afa3b22c8e4367d2e0ffe18a7ee8388248a799;hp=d8f913ffd634f896cde90efbec44699413650ba4;hpb=32327650c5e7e73e392ae3b3a97d97650d4fb0af;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index d8f913ffd6..1696b26a6a 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -169,7 +169,7 @@ class EditPage { * 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 = '' ) { @@ -237,8 +237,13 @@ class EditPage { wfMsgNoTrans( 'undo-success' ) . '', 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'; @@ -405,6 +410,9 @@ class EditPage { $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; @@ -920,7 +928,7 @@ class EditPage { 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' ); @@ -944,6 +952,8 @@ class EditPage { } 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' ); @@ -1350,14 +1360,11 @@ class EditPage { 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 ) @@ -1366,7 +1373,7 @@ class EditPage { } else { $title = $this->getContextTitle()->getPrefixedText(); } - $wgOut->setPageTitle( wfMsg( 'editing', $title ) ); + $wgOut->setPageTitle( wfMessage( 'editing', $title ) ); } } @@ -1376,7 +1383,7 @@ class EditPage { * 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__ ); @@ -1410,6 +1417,7 @@ class EditPage { $toolbar = ''; } + $wgOut->addHTML( $this->editFormPageTop ); if ( $wgUser->getOption( 'previewontop' ) ) { @@ -1421,9 +1429,6 @@ class EditPage { $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 ); @@ -1522,21 +1527,6 @@ HTML
{$formattedtemplates}
-HTML -); - - if ( $wgEnableInterwikiTranscluding && $wgEnableInterwikiTemplatesTracking ) { - $wgOut->addHTML( <<editFormTextAfterTools} -
-{$formattedDistantTemplates} -
-HTML -); - } - - $wgOut->addHTML( <<editFormTextAfterTools}
{$formattedhiddencats}
@@ -1630,7 +1620,7 @@ HTML if ( $this->isCssJsSubpage ) { # Check the skin exists if ( $this->isWrongCaseCssJsPage ) { - $wgOut->wrapWikiMsg( "
\n$1\n
", array( 'userinvalidcssjstitle', $this->getContextTitle()->getSkinFromCssJsSubpage() ) ); + $wgOut->wrapWikiMsg( "
\n$1\n
", array( 'userinvalidcssjstitle', $this->mTitle->getSkinFromCssJsSubpage() ) ); } if ( $this->formtype !== 'preview' ) { if ( $this->isCssSubpage ) @@ -1868,7 +1858,7 @@ HTML 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 @@ -2018,7 +2008,7 @@ HTML $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( '

$1

', "yourtext" ); $this->showTextbox2(); @@ -2198,28 +2188,6 @@ HTML } } - 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 */ @@ -2258,7 +2226,7 @@ HTML array( 'returnto' => $this->getContextTitle()->getPrefixedText() ) ); - $wgOut->setPageTitle( wfMsg( 'whitelistedittitle' ) ); + $wgOut->setPageTitle( wfMessage( 'whitelistedittitle' ) ); $wgOut->setRobotPolicy( 'noindex,nofollow' ); $wgOut->setArticleRelated( false ); @@ -2273,7 +2241,7 @@ HTML function noSuchSectionPage() { global $wgOut; - $wgOut->setPageTitle( wfMsg( 'nosuchsectiontitle' ) ); + $wgOut->setPageTitle( wfMessage( 'nosuchsectiontitle' ) ); $wgOut->setRobotPolicy( 'noindex,nofollow' ); $wgOut->setArticleRelated( false ); @@ -2293,7 +2261,7 @@ HTML static function spamPage( $match = false ) { global $wgOut, $wgTitle; - $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) ); + $wgOut->setPageTitle( wfMessage( 'spamprotectiontitle' ) ); $wgOut->setRobotPolicy( 'noindex,nofollow' ); $wgOut->setArticleRelated( false ); @@ -2316,7 +2284,7 @@ HTML global $wgOut; $this->textbox2 = $this->textbox1; - $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) ); + $wgOut->setPageTitle( wfMessage( 'spamprotectiontitle' ) ); $wgOut->setRobotPolicy( 'noindex,nofollow' ); $wgOut->setArticleRelated( false ); @@ -2330,7 +2298,7 @@ HTML $wgOut->wrapWikiMsg( '

$1

', "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( '

$1

', "yourtext" ); $this->showTextbox2(); @@ -2877,7 +2845,7 @@ HTML function noCreatePermission() { global $wgOut; - $wgOut->setPageTitle( wfMsg( 'nocreatetitle' ) ); + $wgOut->setPageTitle( wfMessage( 'nocreatetitle' ) ); $wgOut->addWikiMsg( 'nocreatetext' ); } @@ -2972,6 +2940,7 @@ HTML $wgOut->permissionRequired( 'upload' ); return false; } + return false; } /**