Re-enable MediaWiki.Usage.SuperGlobalsUsage.SuperGlobals sniff
[lhc/web/wiklou.git] / includes / EditPage.php
index a1d9ae8..67ce1f3 100644 (file)
@@ -504,16 +504,6 @@ class EditPage {
                }
        }
 
-       /**
-        * Check if the edit page is using OOUI controls
-        * @return bool Always true
-        * @deprecated since 1.30
-        */
-       public function isOouiEnabled() {
-               wfDeprecated( __METHOD__, '1.30' );
-               return true;
-       }
-
        /**
         * Returns if the given content model is editable.
         *
@@ -948,7 +938,7 @@ class EditPage {
                        if ( $this->incompleteForm ) {
                                # If the form is incomplete, force to preview.
                                wfDebug( __METHOD__ . ": Form data appears to be incomplete\n" );
-                               wfDebug( "POST DATA: " . var_export( $_POST, true ) . "\n" );
+                               wfDebug( "POST DATA: " . var_export( $request->getPostValues(), true ) . "\n" );
                                $this->preview = true;
                        } else {
                                $this->preview = $request->getCheck( 'wpPreview' );
@@ -3893,6 +3883,9 @@ ERROR;
                        $previewHTML = $parserResult['html'];
                        $this->mParserOutput = $parserOutput;
                        $out->addParserOutputMetadata( $parserOutput );
+                       if ( $out->userCanPreview() ) {
+                               $out->addContentOverride( $this->getTitle(), $content );
+                       }
 
                        if ( count( $parserOutput->getWarnings() ) ) {
                                $note .= "\n\n" . implode( "\n\n", $parserOutput->getWarnings() );
@@ -4118,12 +4111,15 @@ ERROR;
 
                $script .= '});';
 
+               $nonce = $wgOut->getCSPNonce();
+               $wgOut->addScript( ResourceLoader::makeInlineScript( $script, $nonce ) );
+
                $toolbar = '<div id="toolbar"></div>';
 
                if ( Hooks::run( 'EditPageBeforeEditToolbar', [ &$toolbar ] ) ) {
                        // Only add the old toolbar cruft to the page payload if the toolbar has not
                        // been over-written by a hook caller
-                       $wgOut->addScript( ResourceLoader::makeInlineScript( $script ) );
+                       $wgOut->addScript( ResourceLoader::makeInlineScript( $script, $nonce ) );
                };
 
                return $toolbar;