* (bug 20131) PHP Notice: Undfined index: page_latest in includes/ChangesList.php...
[lhc/web/wiklou.git] / includes / EditPage.php
index 2d2b858..4aa603b 100644 (file)
@@ -48,6 +48,8 @@ class EditPage {
        var $mMetaData = '';
        var $isConflict = false;
        var $isCssJsSubpage = false;
+       var $isCssSubpage = false;
+       var $isJsSubpage = false;
        var $deletedSinceEdit = false;
        var $formtype;
        var $firsttime;
@@ -111,6 +113,7 @@ class EditPage {
                return $this->mArticle;
        }
 
+
        /**
         * Fetch initial editing page content.
         * @private
@@ -360,7 +363,7 @@ class EditPage {
         * the newly-edited page.
         */
        function edit() {
-               global $wgOut, $wgRequest;
+               global $wgOut, $wgRequest, $wgEnableJS2system;
                // Allow extensions to modify/prevent this form or submission
                if ( !wfRunHooks( 'AlternateEdit', array( &$this ) ) ) {
                        return;
@@ -388,6 +391,10 @@ class EditPage {
                }
 
                $wgOut->addScriptFile( 'edit.js' );
+
+               if($wgEnableJS2system)
+                   $wgOut->addScriptClass( 'editPage' );
+
                $permErrors = $this->getEditPermissionErrors();
                if ( $permErrors ) {
                        wfDebug( __METHOD__.": User can't edit\n" );
@@ -422,6 +429,8 @@ class EditPage {
                $this->isConflict = false;
                // css / js subpages of user pages get a special treatment
                $this->isCssJsSubpage      = $this->mTitle->isCssJsSubpage();
+               $this->isCssSubpage        = $this->mTitle->isCssSubpage();
+               $this->isJsSubpage         = $this->mTitle->isJsSubpage();
                $this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage();
 
                # Show applicable editing introductions
@@ -877,7 +886,7 @@ class EditPage {
                        }
 
                        // Run post-section-merge edit filter
-                       if ( !wfRunHooks( 'EditFilterMerged', array( $this, $this->textbox1, &$this->hookError, $this->summary ) ) ) {
+                       if ( !wfRunHooks( 'EditFilterMerged', array( &$this, $this->textbox1, &$this->hookError, $this->summary ) ) ) {
                                # Error messages etc. could be handled within the hook...
                                wfProfileOut( $fname );
                                return self::AS_HOOK_ERROR;
@@ -965,7 +974,7 @@ class EditPage {
                $oldtext = $this->mArticle->getContent();
 
                // Run post-section-merge edit filter
-               if ( !wfRunHooks( 'EditFilterMerged', array( $this, $text, &$this->hookError, $this->summary ) ) ) {
+               if ( !wfRunHooks( 'EditFilterMerged', array( &$this, $text, &$this->hookError, $this->summary ) ) ) {
                        # Error messages etc. could be handled within the hook...
                        wfProfileOut( $fname );
                        return self::AS_HOOK_ERROR;
@@ -1070,7 +1079,7 @@ class EditPage {
                }
                return true;
        }
-       
+
        /**
         * Check given input text against $wgSpamRegex, and return the text of the first match.
         * @return mixed -- matching string or false
@@ -1236,13 +1245,15 @@ class EditPage {
                } else {
                        if ( $this->isCssJsSubpage ) {
                                # Check the skin exists
-                               if ( $this->isValidCssJsSubpage ) {
-                                       if ( $this->formtype !== 'preview' ) {
-                                               $wgOut->addWikiMsg( 'usercssjsyoucanpreview' );
-                                       }
-                               } else {
+                               if ( !$this->isValidCssJsSubpage ) {
                                        $wgOut->addWikiMsg( 'userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage() );
                                }
+                               if ( $this->formtype !== 'preview' ) {
+                                       if ( $this->isCssSubpage )
+                                               $wgOut->addWikiMsg( 'usercssyoucanpreview' );
+                                       if ( $this->isJsSubpage )
+                                               $wgOut->addWikiMsg( 'userjsyoucanpreview' );
+                               }
                        }
                }
 
@@ -1331,6 +1342,7 @@ class EditPage {
                        $toolbar = '';
                }
 
+
                // activate checkboxes if user wants them to be always active
                if ( !$this->preview && !$this->diff ) {
                        # Sort out the "watch" checkbox
@@ -1344,7 +1356,7 @@ class EditPage {
                                # Already watched
                                $this->watchthis = true;
                        }
-                       
+
                        # May be overriden by request parameters
                        if( $wgRequest->getBool( 'watchthis' ) ) {
                                $this->watchthis = true;
@@ -1397,6 +1409,8 @@ class EditPage {
                                                                                'maxlength' => '200',
                                                                                'tabindex' => '1'
                                                                        ) );
+                       } else {
+                               $summaryhiddens .= Xml::hidden( 'wpIgnoreBlankSummary', true ); # bug 18699
                        }
                        $editsummary = "<div class='editOptions'>\n";
                        global $wgParser;
@@ -2180,9 +2194,9 @@ END
 
                $toolbar.="/*]]>*/\n</script>";
                $toolbar.="\n</div>";
-               
+
                wfRunHooks( 'EditPageBeforeEditToolbar', array( &$toolbar ) );
-               
+
                return $toolbar;
        }