From d1adc1b994b41caa402d3acf187cdb9450555dc4 Mon Sep 17 00:00:00 2001 From: Gabriel Wicke Date: Fri, 26 Mar 2004 22:25:57 +0000 Subject: [PATCH] skin names now in associative array, provides fallback for the three main skins --- includes/Skin.php | 10 ++++++---- includes/User.php | 19 +++++++++++++++---- languages/Language.php | 9 +++++++-- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/includes/Skin.php b/includes/Skin.php index 78da8c46a5..48cd2e3b69 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -9,15 +9,17 @@ include_once( "Feed.php" ); # Language class has internationalized names # /* private */ $wgValidSkinNames = array( - "Standard", "Nostalgia", "CologneBlue" + 'standard' => "Standard", + 'nostalgia' => "Nostalgia", + 'cologneblue' => "CologneBlue" ); if( $wgUseSmarty ) { - $wgValidSkinNames[] = "Smarty"; - $wgValidSkinNames[] = "Montparnasse"; + $wgValidSkinNames['smarty'] = "Smarty"; + $wgValidSkinNames['montparnasse'] = "Montparnasse"; } if( $wgUsePHPTal ) { #$wgValidSkinNames[] = "PHPTal"; - $wgValidSkinNames[] = "DaVinci"; + $wgValidSkinNames['davinci'] = "DaVinci"; } include_once( "RecentChange.php" ); diff --git a/includes/User.php b/includes/User.php index 7024b983b3..1f6ff8fc2f 100644 --- a/includes/User.php +++ b/includes/User.php @@ -434,10 +434,21 @@ class User { if ( ! isset( $this->mSkin ) ) { $skinNames = Skin::getSkinNames(); $s = $this->getOption( "skin" ); - if ( "" == $s ) { $s = 0; } - - if ( $s >= count( $skinNames ) ) { $sn = "SkinStandard"; } - else $sn = "Skin" . $skinNames[$s]; + if ( "" == $s ) { $s = 'standard'; } + + if ( !isset( $skinNames[$s] ) ) { + $fallback = array( + 'standard' => "Standard", + 'nostalgia' => "Nostalgia", + 'cologneblue' => "Cologne Blue"); + if(is_int($s) && isset( $fallback[$s]) ){ + $sn = $fallback[$s]; + } else { + $sn = "SkinStandard"; + } + } else { + $sn = "Skin" . $skinNames[$s]; + } $this->mSkin = new $sn; } return $this->mSkin; diff --git a/languages/Language.php b/languages/Language.php index c1a8e82e4f..92de7627d1 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -82,7 +82,7 @@ if($wgMetaNamespace === FALSE) "quickbar" => 1, "underline" => 1, "hover" => 1, "cols" => 80, "rows" => 25, "searchlimit" => 20, "contextlines" => 5, "contextchars" => 50, - "skin" => 0, "math" => 1, "rcdays" => 7, "rclimit" => 50, + "skin" => 'standard', "math" => 1, "rcdays" => 7, "rclimit" => 50, "highlightbroken" => 1, "stubthreshold" => 0, "previewontop" => 1, "editsection"=>0,"editsectiononrightclick"=>0, "showtoc"=>1, "showtoolbar" =>1, @@ -94,7 +94,12 @@ if($wgMetaNamespace === FALSE) ); /* private */ $wgSkinNamesEn = array( - "Standard", "Nostalgia", "Cologne Blue", "Paddington", "Montparnasse", "DaVinci" + 'standard' => "Standard", + 'nostalgia' => "Nostalgia", + 'cologneblue' => "Cologne Blue", + 'smarty' => "Paddington", + 'montparnasse' => "Montparnasse", + 'davinci' => "DaVinci" ); /* private */ $wgMathNamesEn = array( -- 2.20.1