/**
* Fetch initial editing page content.
+ * @returns mixed string on success, $def_text for invalid sections
* @private
*/
function getContent( $def_text = '' ) {
if ( $section == 'new' ) {
$text = $this->getPreloadedText( $preload );
} else {
+ // Get section edit text (returns $def_text for invalid sections)
$text = $wgParser->getSection( $text, $section, $def_text );
}
}
$permErrors = $this->getEditPermissionErrors();
if ( $permErrors ) {
wfDebug( __METHOD__ . ": User can't edit\n" );
- $this->readOnlyPage( $this->getContent(), true, $permErrors, 'edit' );
+ $this->readOnlyPage( $this->getContent( false ), true, $permErrors, 'edit' );
wfProfileOut( __METHOD__ );
return;
} else {
/**
* Initialise form fields in the object
* Called on the first invocation, e.g. when a user clicks an edit link
+ * @returns bool -- if the requested section is valid
*/
function initialiseForm() {
global $wgUser;
}
protected function showHeader() {
- global $wgOut, $wgParser, $wgUser, $wgTitle, $wgMaxArticleSize, $wgLang;
+ global $wgOut, $wgUser, $wgTitle, $wgMaxArticleSize, $wgLang;
if ( $this->isConflict ) {
$wgOut->wrapWikiMsg( "<div class='mw-explainconflict'>\n$1</div>", 'explainconflict' );
$this->edittime = $this->mArticle->getTimestamp();
$wgOut->wrapWikiMsg( $notice, array( 'cascadeprotectedwarning', $cascadeSourcesCount ) );
}
if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) {
- $wgOut->wrapWikiMsg( "<div class=\"mw-titleprotectedwarning\">\n$1</div>", 'titleprotectedwarning' );
+ LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
+ array( 'lim' => 1,
+ 'showIfEmpty' => false,
+ 'msgKey' => array( 'titleprotectedwarning' ),
+ 'wrap' => "<div class=\"mw-titleprotectedwarning\">\n$1</div>" ) );
}
if ( $this->kblength === false ) {
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->setArticleRelated( false );
- $wgOut->addWikiMsg( 'nosuchsectiontext', $this->section );
+ $res = wfMsgExt( 'nosuchsectiontext', 'parse', $this->section );
+ wfRunHooks( 'EditPageNoSuchSection', array( &$this, &$res ) );
+ $wgOut->addHTML( $res );
+
$wgOut->returnToMain( false, $this->mTitle );
}
} else {
return $this->mBaseRevision;
}
- }
+ }
}