wfProfileOut( __METHOD__ );
return;
}
- if ( !$this->mTitle->getArticleId() )
+ if ( !$this->mTitle->getArticleID() )
wfRunHooks( 'EditFormPreloadText', array( &$this->textbox1, &$this->mTitle ) );
else
wfRunHooks( 'EditFormInitialText', array( $this ) );
# 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 ) ) {
$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__,
# 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 ) ?\r
+ 'editing' : 'creating';\r
+ }
+ # Use the title defined by DISPLAYTITLE magic word when present
+ $displayTitle = isset( $this->mParserOutput ) ? $this->mParserOutput->getDisplayTitle() : false;\r
+ if ( $displayTitle === false ) {\r
+ $displayTitle = $contextTitle->getPrefixedText();\r
}
+ $wgOut->setPageTitle( wfMessage( $msg, $displayTitle ) );
}
/**
if ( $namespace == NS_MEDIAWIKI ) {
# Show a warning if editing an interface message
$wgOut->wrapWikiMsg( "<div class='mw-editinginterface'>\n$1\n</div>", '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( "<div class=\"mw-sharedupload-desc-create\">\n$1\n</div>", array (
+ 'sharedupload-desc-create', $file->getRepo()->getDisplayName(), $descUrl
+ ) );
+ } else {
+ $wgOut->wrapWikiMsg( "<div class=\"mw-sharedupload-desc-edit\">\n$1\n</div>", 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
* @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] ) );
/**
* 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( '<div id="spamprotected">' );