- $conflict = '<hr />';
- }
-
- $previewhead = "<div class='previewnote'>\n" .
- '<h2 id="mw-previewheader">' . htmlspecialchars( wfMsg( 'preview' ) ) . "</h2>" .
- $wgOut->parse( $note ) . $conflict . "</div>\n";
-
- wfProfileOut( __METHOD__ );
- return $previewhead . $previewHTML . $this->previewTextAfterContent;
- }
-
- function getTemplates() {
- if ( $this->preview || $this->section != '' ) {
- $templates = array();
- if ( !isset( $this->mParserOutput ) ) return $templates;
- foreach( $this->mParserOutput->getTemplates() as $ns => $template) {
- foreach( array_keys( $template ) as $dbk ) {
- $templates[] = Title::makeTitle($ns, $dbk);
- }
- }
- return $templates;
- } else {
- return $this->mArticle->getUsedTemplates();
- }
- }
-
- /**
- * Call the stock "user is blocked" page
- */
- function blockedPage() {
- global $wgOut;
- $wgOut->blockedPage( false ); # Standard block notice on the top, don't 'return'
-
- # If the user made changes, preserve them when showing the markup
- # (This happens when a user is blocked during edit, for instance)
- $first = $this->firsttime || ( !$this->save && $this->textbox1 == '' );
- if ( $first ) {
- $source = $this->mTitle->exists() ? $this->getContent() : false;
- } else {
- $source = $this->textbox1;
- }
-
- # Spit out the source or the user's modified version
- if ( $source !== false ) {
- $wgOut->addHTML( '<hr />' );
- $wgOut->addWikiMsg( $first ? 'blockedoriginalsource' : 'blockededitsource', $this->mTitle->getPrefixedText() );
- $this->showTextbox1( array( 'readonly' ), $source );
- }
- }
-
- /**
- * Produce the stock "please login to edit pages" page
- */
- function userNotLoggedInPage() {
- global $wgUser, $wgOut, $wgTitle;
- $skin = $wgUser->getSkin();
-
- $loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
- $loginLink = $skin->link(
- $loginTitle,
- wfMsgHtml( 'loginreqlink' ),
- array(),
- array( 'returnto' => $wgTitle->getPrefixedText() ),
- array( 'known', 'noclasses' )
- );
-
- $wgOut->setPageTitle( wfMsg( 'whitelistedittitle' ) );
- $wgOut->setRobotPolicy( 'noindex,nofollow' );
- $wgOut->setArticleRelated( false );
-
- $wgOut->addWikiMsgArray( 'whitelistedittext', array( $loginLink ), array( 'replaceafter' ) );
- $wgOut->returnToMain( false, $wgTitle );
- }
-
- /**
- * Creates a basic error page which informs the user that
- * they have attempted to edit a nonexistent section.
- */
- function noSuchSectionPage() {
- global $wgOut;
-
- $wgOut->setPageTitle( wfMsg( 'nosuchsectiontitle' ) );
- $wgOut->setRobotPolicy( 'noindex,nofollow' );
- $wgOut->setArticleRelated( false );
-
- $res = wfMsgExt( 'nosuchsectiontext', 'parse', $this->section );
- wfRunHooks( 'EditPageNoSuchSection', array( &$this, &$res ) );
- $wgOut->addHTML( $res );
-
- $wgOut->returnToMain( false, $this->mTitle );
- }
-
- /**
- * Produce the stock "your edit contains spam" page
- *
- * @param $match Text which triggered one or more filters
- * @deprecated Use method spamPageWithContent() instead
- */
- static function spamPage( $match = false ) {
- global $wgOut, $wgTitle;
-
- $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) );
- $wgOut->setRobotPolicy( 'noindex,nofollow' );
- $wgOut->setArticleRelated( false );
-
- $wgOut->addHTML( '<div id="spamprotected">' );
- $wgOut->addWikiMsg( 'spamprotectiontext' );
- if ( $match ) {
- $wgOut->addWikiMsg( 'spamprotectionmatch', wfEscapeWikiText( $match ) );
- }
- $wgOut->addHTML( '</div>' );
-
- $wgOut->returnToMain( false, $wgTitle );
- }
-
- /**
- * Show "your edit contains spam" page with your diff and text
- *
- * @param $match Text which triggered one or more filters
- */
- public function spamPageWithContent( $match = false ) {
- global $wgOut, $wgTitle;
- $this->textbox2 = $this->textbox1;
-
- $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) );
- $wgOut->setRobotPolicy( 'noindex,nofollow' );
- $wgOut->setArticleRelated( false );
-
- $wgOut->addHTML( '<div id="spamprotected">' );
- $wgOut->addWikiMsg( 'spamprotectiontext' );
- if ( $match ) {
- $wgOut->addWikiMsg( 'spamprotectionmatch', wfEscapeWikiText( $match ) );
- }
- $wgOut->addHTML( '</div>' );
-
- $wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourdiff" );
- $de = new DifferenceEngine( $this->mTitle );
- $de->setText( $this->getContent(), $this->textbox2 );
- $de->showDiff( wfMsg( "storedversion" ), wfMsg( "yourtext" ) );
-
- $wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourtext" );
- $this->showTextbox2();
-
- $wgOut->addReturnTo( $wgTitle, array( 'action' => 'edit' ) );
- }
-
-
- /**
- * @private
- * @todo document
- */
- function mergeChangesInto( &$editText ){
- wfProfileIn( __METHOD__ );
-
- $db = wfGetDB( DB_MASTER );
-
- // This is the revision the editor started from
- $baseRevision = $this->getBaseRevision();
- if ( is_null( $baseRevision ) ) {
- wfProfileOut( __METHOD__ );
- return false;
- }
- $baseText = $baseRevision->getText();
-
- // The current state, we want to merge updates into it
- $currentRevision = Revision::loadFromTitle( $db, $this->mTitle );
- if ( is_null( $currentRevision ) ) {
- wfProfileOut( __METHOD__ );
- return false;
- }
- $currentText = $currentRevision->getText();
-
- $result = '';
- if ( wfMerge( $baseText, $editText, $currentText, $result ) ) {
- $editText = $result;
- wfProfileOut( __METHOD__ );
- return true;
- } else {
- wfProfileOut( __METHOD__ );
- return false;
- }
- }
-
- /**
- * Check if the browser is on a blacklist of user-agents known to
- * mangle UTF-8 data on form submission. Returns true if Unicode
- * should make it through, false if it's known to be a problem.
- * @return bool
- * @private
- */
- function checkUnicodeCompliantBrowser() {
- global $wgBrowserBlackList;
- if ( empty( $_SERVER["HTTP_USER_AGENT"] ) ) {
- // No User-Agent header sent? Trust it by default...
- return true;
- }
- $currentbrowser = $_SERVER["HTTP_USER_AGENT"];
- foreach ( $wgBrowserBlackList as $browser ) {
- if ( preg_match($browser, $currentbrowser) ) {
- return false;
- }