Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -274,6 +274,24 @@ |
275 | 275 | return $this->deletedSinceEdit; |
276 | 276 | } |
277 | 277 | |
| 278 | + /** |
| 279 | + * Checks whether the user entered a skin name in uppercase, |
| 280 | + * e.g. "User:Example/Monobook.css" instead of "monobook.css" |
| 281 | + */ |
| 282 | + protected function isWrongCaseCssJsPage() { |
| 283 | + if( $this->mTitle->isCssJsSubpage() ) { |
| 284 | + $name = $this->mTitle->getSkinFromCssJsSubpage(); |
| 285 | + $skins = array_merge( |
| 286 | + array_keys( Skin::getSkinNames() ), |
| 287 | + array( 'common' ) |
| 288 | + ); |
| 289 | + return !in_array( $name, $skins ) |
| 290 | + && in_array( strtolower( $name ), $skins ); |
| 291 | + } else { |
| 292 | + return false; |
| 293 | + } |
| 294 | + } |
| 295 | + |
278 | 296 | function submit() { |
279 | 297 | $this->edit(); |
280 | 298 | } |
— | — | @@ -360,7 +378,7 @@ |
361 | 379 | $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage(); |
362 | 380 | $this->isCssSubpage = $this->mTitle->isCssSubpage(); |
363 | 381 | $this->isJsSubpage = $this->mTitle->isJsSubpage(); |
364 | | - $this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage(); |
| 382 | + $this->isWrongCaseCssJsPage = $this->isWrongCaseCssJsPage(); |
365 | 383 | |
366 | 384 | # Show applicable editing introductions |
367 | 385 | if ( $this->formtype == 'initial' || $this->firsttime ) |
— | — | @@ -1407,7 +1425,7 @@ |
1408 | 1426 | } else { |
1409 | 1427 | if ( $this->isCssJsSubpage ) { |
1410 | 1428 | # Check the skin exists |
1411 | | - if ( !$this->isValidCssJsSubpage ) { |
| 1429 | + if ( $this->isWrongCaseCssJsPage ) { |
1412 | 1430 | $wgOut->wrapWikiMsg( "<div class='error' id='mw-userinvalidcssjstitle'>\n$1\n</div>", array( 'userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage() ) ); |
1413 | 1431 | } |
1414 | 1432 | if ( $this->formtype !== 'preview' ) { |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -1898,21 +1898,12 @@ |
1899 | 1899 | |
1900 | 1900 | /** |
1901 | 1901 | * Is this a *valid* .css or .js subpage of a user page? |
1902 | | - * Check that the corresponding skin exists |
1903 | 1902 | * |
1904 | 1903 | * @return \type{\bool} |
| 1904 | + * @deprecated |
1905 | 1905 | */ |
1906 | 1906 | public function isValidCssJsSubpage() { |
1907 | | - if ( $this->isCssJsSubpage() ) { |
1908 | | - $name = $this->getSkinFromCssJsSubpage(); |
1909 | | - if ( $name == 'common' ) { |
1910 | | - return true; |
1911 | | - } |
1912 | | - $skinNames = Skin::getSkinNames(); |
1913 | | - return array_key_exists( $name, $skinNames ); |
1914 | | - } else { |
1915 | | - return false; |
1916 | | - } |
| 1907 | + return $this->isCssJsSubpage(); |
1917 | 1908 | } |
1918 | 1909 | |
1919 | 1910 | /** |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -438,6 +438,8 @@ |
439 | 439 | * Fixed PHP warnings when updating a broken MySQL database. |
440 | 440 | * (bug 26023) Corrected deleteBacth.php's documentation |
441 | 441 | * (bug 25451) Improved datetime representation in 32 bit php >= 5.2. |
| 442 | +* Show "skin does not exist error" only when the skin is inputted in the wrong |
| 443 | + case. |
442 | 444 | |
443 | 445 | === API changes in 1.17 === |
444 | 446 | * (bug 22738) Allow filtering by action type on query=logevent. |