+ $allInstalledSkins = Skin::getSkinNames();
+
+ // Display the installed skin the user has specifically requested via useskin=….
+ $useSkin = $context->getRequest()->getRawVal( 'useskin' );
+ if ( isset( $allInstalledSkins[$useSkin] )
+ && $context->msg( "skinname-$useSkin" )->exists()
+ ) {
+ $validSkinNames[$useSkin] = $useSkin;
+ }
+
+ // Display the skin if the user has set it as a preference already before it was hidden.
+ $currentUserSkin = $user->getOption( 'skin' );
+ if ( isset( $allInstalledSkins[$currentUserSkin] )
+ && $context->msg( "skinname-$useSkin" )->exists()
+ ) {
+ $validSkinNames[$currentUserSkin] = $currentUserSkin;
+ }