X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FEditPage.php;h=5e3a964842059e6b37f28352241d9cd7e06851a8;hb=313298d9d77a2cb37f806466de897c4fa30e420a;hp=287ed97c1f8046fd40370ca6da66b5e5a055c635;hpb=4565aac9f039dc7980445c8cdfbeeb373b2e5925;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index 287ed97c1f..5e3a964842 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -376,7 +376,7 @@ class EditPage { wfProfileOut( __METHOD__ ); return; } - if ( !$this->mTitle->getArticleId() ) + if ( !$this->mTitle->getArticleID() ) wfRunHooks( 'EditFormPreloadText', array( &$this->textbox1, &$this->mTitle ) ); else wfRunHooks( 'EditFormInitialText', array( $this ) ); @@ -805,7 +805,7 @@ class EditPage { # Otherwise, $text will be left as-is. if ( !is_null( $undorev ) && !is_null( $oldrev ) && $undorev->getPage() == $oldrev->getPage() && - $undorev->getPage() == $this->mTitle->getArticleId() && + $undorev->getPage() == $this->mTitle->getArticleID() && !$undorev->isDeleted( Revision::DELETED_TEXT ) && !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) { @@ -1478,7 +1478,7 @@ class EditPage { $res = $dbw->select( 'revision', 'rev_user', array( - 'rev_page' => $this->mTitle->getArticleId(), + 'rev_page' => $this->mTitle->getArticleID(), 'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $edittime ) ) ), __METHOD__, @@ -1603,21 +1603,21 @@ class EditPage { # Enabled article-related sidebar, toplinks, etc. $wgOut->setArticleRelated( true ); + $contextTitle = $this->getContextTitle(); if ( $this->isConflict ) { - $wgOut->setPageTitle( wfMessage( 'editconflict', $this->getContextTitle()->getPrefixedText() ) ); - } elseif ( $this->section != '' ) { + $msg = 'editconflict'; + } elseif ( $contextTitle->exists() && $this->section != '' ) { $msg = $this->section == 'new' ? 'editingcomment' : 'editingsection'; - $wgOut->setPageTitle( wfMessage( $msg, $this->getContextTitle()->getPrefixedText() ) ); } else { - # Use the title defined by DISPLAYTITLE magic word when present - if ( isset( $this->mParserOutput ) - && ( $dt = $this->mParserOutput->getDisplayTitle() ) !== false ) { - $title = $dt; - } else { - $title = $this->getContextTitle()->getPrefixedText(); - } - $wgOut->setPageTitle( wfMessage( 'editing', $title ) ); + $msg = $contextTitle->exists() || ( $contextTitle->getNamespace() == NS_MEDIAWIKI && $contextTitle->getDefaultMessageText() !== false ) ? + 'editing' : 'creating'; + } + # Use the title defined by DISPLAYTITLE magic word when present + $displayTitle = isset( $this->mParserOutput ) ? $this->mParserOutput->getDisplayTitle() : false; + if ( $displayTitle === false ) { + $displayTitle = $contextTitle->getPrefixedText(); } + $wgOut->setPageTitle( wfMessage( $msg, $displayTitle ) ); } /** @@ -1634,6 +1634,24 @@ class EditPage { if ( $namespace == NS_MEDIAWIKI ) { # Show a warning if editing an interface message $wgOut->wrapWikiMsg( "
\n$1\n
", 'editinginterface' ); + } else if( $namespace == NS_FILE ) { + # Show a hint to shared repo + $file = wfFindFile( $this->mTitle ); + if( $file && !$file->isLocal() ) { + $descUrl = $file->getDescriptionUrl(); + # there must be a description url to show a hint to shared repo + if( $descUrl ) { + if( !$this->mTitle->exists() ) { + $wgOut->wrapWikiMsg( "
\n$1\n
", array ( + 'sharedupload-desc-create', $file->getRepo()->getDisplayName(), $descUrl + ) ); + } else { + $wgOut->wrapWikiMsg( "
\n$1\n
", array( + 'sharedupload-desc-edit', $file->getRepo()->getDisplayName(), $descUrl + ) ); + } + } + } } # Show a warning message when someone creates/edits a user (talk) page but the user does not exist @@ -1872,7 +1890,7 @@ class EditPage { * @return Mixed|string or false */ public static function extractSectionTitle( $text ) { - preg_match( "/^(=+)(.+)\\1(\n|$)/i", $text, $matches ); + preg_match( "/^(=+)(.+)\\1\\s*(\n|$)/i", $text, $matches ); if ( !empty( $matches[2] ) ) { global $wgParser; return $wgParser->stripSectionName( trim( $matches[2] ) ); @@ -3027,12 +3045,15 @@ HTML /** * Show "your edit contains spam" page with your diff and text * - * @param $match string|bool Text which triggered one or more filters + * @param $match string|Array|bool Text (or array of texts) which triggered one or more filters */ public function spamPageWithContent( $match = false ) { - global $wgOut; + global $wgOut, $wgLang; $this->textbox2 = $this->textbox1; + if( is_array( $match ) ){ + $match = $wgLang->listToText( $match ); + } $wgOut->prepareErrorPage( wfMessage( 'spamprotectiontitle' ) ); $wgOut->addHTML( '
' );