From e8d63e8cf74824c29bf0dcdfc79721498b0ca8a2 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 6 Aug 2008 17:41:17 +0000 Subject: [PATCH] Logic for $wgSkipSkins should be in Skin.php, where it's usable by things other than preferences. (bug 6795) --- includes/Skin.php | 15 +++++++++++++++ includes/specials/SpecialPreferences.php | 7 ++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/includes/Skin.php b/includes/Skin.php index 71ada4cf87..b09bed1abf 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -60,6 +60,21 @@ class Skin extends Linker { } return $wgValidSkinNames; } + + /** + * Fetch the list of usable skins in regards to $wgSkipSkins. + * Useful for Special:Preferences and other places where you + * only want to show skins users _can_ use. + * @return array of strings + */ + public static function getUsableSkins() { + global $wgSkipSkins; + $usableSkins = self::getSkinNames(); + foreach ( $wgSkipSkins as $skip ) { + unset( $usableSkins[$skip] ); + } + return $usableSkins; + } /** * Normalize a skin preference value to a form that can be loaded. diff --git a/includes/specials/SpecialPreferences.php b/includes/specials/SpecialPreferences.php index 3747785bd9..4528296a3d 100644 --- a/includes/specials/SpecialPreferences.php +++ b/includes/specials/SpecialPreferences.php @@ -517,7 +517,7 @@ class PreferencesForm { global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits; global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress; global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication; - global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth; + global $wgContLanguageCode, $wgDefaultSkin, $wgAuth; global $wgEmailConfirmToEdit, $wgAjaxSearch, $wgEnableMWSuggest; $wgOut->setPageTitle( wfMsg( 'preferences' ) ); @@ -819,7 +819,7 @@ class PreferencesForm { $previewtext = wfMsg('skin-preview'); # Only show members of Skin::getSkinNames() rather than # $skinNames (skins is all skin names from Language.php) - $validSkinNames = Skin::getSkinNames(); + $validSkinNames = Skin::getUsableSkins(); # Sort by UI skin name. First though need to update validSkinNames as sometimes # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI). foreach ($validSkinNames as $skinkey => & $skinname ) { @@ -829,9 +829,6 @@ class PreferencesForm { } asort($validSkinNames); foreach ($validSkinNames as $skinkey => $sn ) { - if ( in_array( $skinkey, $wgSkipSkins ) ) { - continue; - } $checked = $skinkey == $this->mSkin ? ' checked="checked"' : ''; $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey")); -- 2.20.1