(Bug 19725) Do not include suppressed edits in the "View X deleted edits" message...
[lhc/web/wiklou.git] / includes / EditPage.php
index 578ebbc..a17b4b1 100644 (file)
@@ -792,7 +792,7 @@ class EditPage {
                        $ip = User::isIP( $username );
                        if ( !$user->isLoggedIn() && !$ip ) { # User does not exist
                                $wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
-                                       array( 'userpage-userdoesnotexist', $username ) );
+                                       array( 'userpage-userdoesnotexist', wfEscapeWikiText( $username ) ) );
                        } elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
                                LogEventsList::showLogExtract(
                                        $wgOut,
@@ -1335,7 +1335,7 @@ class EditPage {
                        $previewOutput = $this->getPreviewText();
                }
 
-               wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) );
+               wfRunHooks( 'EditPage::showEditForm:initial', array( &$this, &$formCallback ) );
 
                $this->setHeaders();
 
@@ -1634,7 +1634,6 @@ HTML
         * @return array An array in the format array( $label, $input )
         */
        function getSummaryInput($summary = "", $labelText = null, $inputAttrs = null, $spanLabelAttrs = null) {
-               global $wgUser;
                //Note: the maxlength is overriden in JS to 250 and to make it use UTF-8 bytes, not characters.
                $inputAttrs = ( is_array($inputAttrs) ? $inputAttrs : array() ) + array(
                        'id' => 'wpSummary',
@@ -1642,7 +1641,7 @@ HTML
                        'tabindex' => '1',
                        'size' => 60,
                        'spellcheck' => 'true',
-               ) + $wgUser->getSkin()->tooltipAndAccessKeyAttribs( 'summary' );
+               ) + Linker::tooltipAndAccesskeyAttribs( 'summary' );
 
                $spanLabelAttrs = ( is_array($spanLabelAttrs) ? $spanLabelAttrs : array() ) + array(
                        'class' => $this->missingSummary ? 'mw-summarymissed' : 'mw-summary',
@@ -1815,6 +1814,10 @@ HTML
                        'style' => '' // avoid php notices when appending preferences (appending allows customAttribs['style'] to still work
                );
 
+               $pageLang = $this->mTitle->getPageLanguage();
+               $attribs['lang'] = $pageLang->getCode();
+               $attribs['dir'] = $pageLang->getDir();
+
                $wgOut->addHTML( Html::textarea( $name, $wikitext, $attribs ) );
        }
 
@@ -2012,8 +2015,14 @@ HTML
                if ( $wgRawHtml && !$this->mTokenOk ) {
                        // Could be an offsite preview attempt. This is very unsafe if
                        // HTML is enabled, as it could be an attack.
-                       $parsedNote = $wgOut->parse( "<div class='previewnote'>" .
-                               wfMsg( 'session_fail_preview_html' ) . "</div>" );
+                       $parsedNote = '';
+                       if ( $this->textbox1 !== '' ) {
+                               // Do not put big scary notice, if previewing the empty
+                               // string, which happens when you initially edit
+                               // a category page, due to automatic preview-on-open.
+                               $parsedNote = $wgOut->parse( "<div class='previewnote'>" .
+                                       wfMsg( 'session_fail_preview_html' ) . "</div>" );
+                       }
                        wfProfileOut( __METHOD__ );
                        return $parsedNote;
                }
@@ -2058,13 +2067,6 @@ HTML
 
                                wfRunHooks( 'EditPageGetPreviewText', array( $this, &$toparse ) );
 
-                               // Parse mediawiki messages with correct target language
-                               if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
-                                       list( /* $unused */, $lang ) = MessageCache::singleton()->figureMessage( $this->mTitle->getText() );
-                                       $obj = wfGetLangObj( $lang );
-                                       $parserOptions->setTargetLanguage( $obj );
-                               }
-
                                $parserOptions->setTidy( true );
                                $parserOptions->enableLimitReport();
                                $parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $toparse ),
@@ -2090,6 +2092,11 @@ HTML
                        '<h2 id="mw-previewheader">' . htmlspecialchars( wfMsg( 'preview' ) ) . "</h2>" .
                        $wgOut->parse( $note ) . $conflict . "</div>\n";
 
+               $pageLang = $this->mTitle->getPageLanguage();
+               $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
+                       'class' => 'mw-content-'.$pageLang->getDir() );
+               $previewHTML = Html::rawElement( 'div', $attribs, $previewHTML );
+
                wfProfileOut( __METHOD__ );
                return $previewhead . $previewHTML . $this->previewTextAfterContent;
        }