Solve the FIXME set in r99025.
authorPlatonides <platonides@users.mediawiki.org>
Thu, 6 Oct 2011 21:43:31 +0000 (21:43 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Thu, 6 Oct 2011 21:43:31 +0000 (21:43 +0000)
Use $this->mTitle directly at EditPage instead of $this->getContextTitle()
$this->mTitle must be set, as it what was used to set $this->isWrongCaseCssJsPage

includes/EditPage.php
includes/Title.php

index 3bc0108..6714e0f 100644 (file)
@@ -1613,7 +1613,7 @@ HTML
                        if ( $this->isCssJsSubpage ) {
                                # Check the skin exists
                                if ( $this->isWrongCaseCssJsPage ) {
-                                       $wgOut->wrapWikiMsg( "<div class='error' id='mw-userinvalidcssjstitle'>\n$1\n</div>", array( 'userinvalidcssjstitle', $this->getContextTitle()->getSkinFromCssJsSubpage() ) );
+                                       $wgOut->wrapWikiMsg( "<div class='error' id='mw-userinvalidcssjstitle'>\n$1\n</div>", array( 'userinvalidcssjstitle', $this->mTitle->getSkinFromCssJsSubpage() ) );
                                }
                                if ( $this->formtype !== 'preview' ) {
                                        if ( $this->isCssSubpage )
index 39a1c4a..7bcde18 100644 (file)
@@ -2022,9 +2022,10 @@ class Title {
        public function getSkinFromCssJsSubpage() {
                $subpage = explode( '/', $this->mTextform );
                $subpage = $subpage[ count( $subpage ) - 1 ];
-               // FIXME: Should only match endings
-               // Consider 'Foo/.js.monobook' or 'Foo/mon.js.obook.css'
-               return( str_replace( array( '.css', '.js' ), array( '', '' ), $subpage ) );
+               $lastdot = strrpos( $subpage, '.' );
+               if ( $lastdot === false )
+                       return $subpage; # Never happens: only called for names ending in '.css' or '.js'
+               return substr( $subpage, 0, $lastdot );
        }
 
        /**