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