* Show "skin does not exist error" only when the skin is inputted in the wrong case...
authorVictor Vasiliev <vasilievvv@users.mediawiki.org>
Thu, 25 Nov 2010 23:12:05 +0000 (23:12 +0000)
committerVictor Vasiliev <vasilievvv@users.mediawiki.org>
Thu, 25 Nov 2010 23:12:05 +0000 (23:12 +0000)
* Deprecate isValidUserCssJSSubpage() as having a very confusing title. User scripts *are* valid user JS subpages.

RELEASE-NOTES
includes/EditPage.php
includes/Title.php

index ce6b501..7a237c2 100644 (file)
@@ -438,6 +438,8 @@ LocalSettings.php. The specific bugs are listed below in the general notes.
 * Fixed PHP warnings when updating a broken MySQL database.
 * (bug 26023) Corrected deleteBacth.php's documentation
 * (bug 25451) Improved datetime representation in 32 bit php >= 5.2.
+* Show "skin does not exist error" only when the skin is inputted in the wrong
+  case.
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent.
index 1182ef7..77dc174 100644 (file)
@@ -274,6 +274,24 @@ class EditPage {
                return $this->deletedSinceEdit;
        }
 
+       /**
+        * Checks whether the user entered a skin name in uppercase,
+        * e.g. "User:Example/Monobook.css" instead of "monobook.css"
+        */
+       protected function isWrongCaseCssJsPage() {
+               if( $this->mTitle->isCssJsSubpage() ) {
+                       $name = $this->mTitle->getSkinFromCssJsSubpage();
+                       $skins = array_merge(
+                               array_keys( Skin::getSkinNames() ),
+                               array( 'common' )
+                       );
+                       return !in_array( $name, $skins )
+                               && in_array( strtolower( $name ), $skins );
+               } else {
+                       return false;
+               }
+       }
+
        function submit() {
                $this->edit();
        }
@@ -360,7 +378,7 @@ class EditPage {
                $this->isCssJsSubpage      = $this->mTitle->isCssJsSubpage();
                $this->isCssSubpage        = $this->mTitle->isCssSubpage();
                $this->isJsSubpage         = $this->mTitle->isJsSubpage();
-               $this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage();
+               $this->isWrongCaseCssJsPage = $this->isWrongCaseCssJsPage();
 
                # Show applicable editing introductions
                if ( $this->formtype == 'initial' || $this->firsttime )
@@ -1407,7 +1425,7 @@ HTML
                } else {
                        if ( $this->isCssJsSubpage ) {
                                # Check the skin exists
-                               if ( !$this->isValidCssJsSubpage ) {
+                               if ( $this->isWrongCaseCssJsPage ) {
                                        $wgOut->wrapWikiMsg( "<div class='error' id='mw-userinvalidcssjstitle'>\n$1\n</div>", array( 'userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage() ) );
                                }
                                if ( $this->formtype !== 'preview' ) {
index 13ea7d9..6c0ddb4 100644 (file)
@@ -1898,21 +1898,12 @@ class Title {
 
        /**
         * Is this a *valid* .css or .js subpage of a user page?
-        * Check that the corresponding skin exists
         *
         * @return \type{\bool}
+        * @deprecated
         */
        public function isValidCssJsSubpage() {
-               if ( $this->isCssJsSubpage() ) {
-                       $name = $this->getSkinFromCssJsSubpage();
-                       if ( $name == 'common' ) {
-                               return true;
-                       }
-                       $skinNames = Skin::getSkinNames();
-                       return array_key_exists( $name, $skinNames );
-               } else {
-                       return false;
-               }
+               return $this->isCssJsSubpage();
        }
 
        /**