r42974 - Code Review

From MediaWiki.org

Jump to: navigation, search
Repository:MediaWiki
Revision:r42973 | r42974 (on ViewVC) | r42975 >
Date:04:39, 1 November 2008
Author:charlie
Status:resolved (Comments)
Tags:
Comment:Added a new configuration option: $wgAllowUserSkin
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/User.php
===================================================================
--- trunk/phase3/includes/User.php	(revision 42973)
+++ trunk/phase3/includes/User.php	(revision 42974)
@@ -2104,12 +2104,19 @@
 	 * @todo FIXME : need to check the old failback system [AV]
 	 */
 	function &getSkin() {
-		global $wgRequest;
+		global $wgRequest, $wgAllowUserSkin, $wgDefaultSkin;
 		if ( ! isset( $this->mSkin ) ) {
 			wfProfileIn( __METHOD__ );
 
-			# get the user skin
-			$userSkin = $this->getOption( 'skin' );
+			if( $wgAllowUserSkin ) {
+				# get the user skin
+				$userSkin = $this->getOption( 'skin' );
+			} else {
+				# if we're not allowing users to override, then use the default
+				$userSkin = $wgDefaultSkin;
+			}
+			
+			# we'll allow skin "testing" regardless of the AllowUserSkin option
 			$userSkin = $wgRequest->getVal('useskin', $userSkin);
 
 			$this->mSkin =& Skin::newFromKey( $userSkin );
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 42973)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 42974)
@@ -2222,6 +2222,9 @@
 /** See list of skins and their symbolic names in languages/Language.php */
 $wgDefaultSkin = 'monobook';
 
+/** Should we allow the user's to select their own skin that will override the default? */
+$wgAllowUserSkin = true;
+
 /**
  * Optionally, we can specify a stylesheet to use for media="handheld".
  * This is recognized by some, but not all, handheld/mobile/PDA browsers.
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 42973)
+++ trunk/phase3/RELEASE-NOTES	(revision 42974)
@@ -53,6 +53,9 @@
   write actions using the API.
 * Added $wgRC2UDPInterwikiPrefix which adds an interwiki prefix
   ($wgLocalInterwiki) onto the page names in the UDP feed.
+* Added $wgAllowUserSkin to let the wiki's owner disable user selectable skins
+  on the wiki. If it's set to true, then the skin used will *always* be
+  $wgDefaultSkin.
 
 === Migrated extensions ===
 The following extensions are migrated into MediaWiki 1.14:

Comments

#Comment by Werdna (Talk | contribs)   05:03, 1 November 2008

In what use case would we want to prevent users from selecting other skins, but allow them to test them?

Also, we shouldn't let users change skins in their preferences if it won't work. We should gray out those options.

#Comment by Cmelbye (Talk | contribs)   05:05, 1 November 2008

Well, we could disallow testing of them also, I just did that in case it broke anything.

I'd like to gray out skins in preferences also, but I wasn't sure about how to go about that yet.

#Comment by Werdna (Talk | contribs)   05:07, 1 November 2008

Why do you want to be able to disable alternative skins in the first place?

#Comment by TheFearow (Talk | contribs)   05:27, 1 November 2008

I assume because on some wikis they use a specific skin for a reason (e.g. to restrict things, show extra options, the sort of thing we do on the Donate/Fundraising page on wikimediafoundation.org) and don't want users to be able to bypass it. Probably not a common option, but most CMS and forum software supports it, as well as a few other wikis (although I havent checked which)

#Comment by Werdna (Talk | contribs)   05:36, 1 November 2008

In that use case, useskin should be disabled too.

#Comment by Werdna (Talk | contribs)   08:53, 1 November 2008

Fixed up in r42980 and r42981.

#Comment by Bryan (Talk | contribs)   09:24, 1 November 2008

Can't this be a per user setting, something like $wgUser->userCan( 'setskin' );

#Comment by Cmelbye (Talk | contribs)   13:42, 1 November 2008

Well, that could be another feature, but for this, I just wanted $wgAllowUserSkin to allow or block all changes of a user's skin so that the admin can make sure every sees their nice skin made specifically for the wiki, etc.

Views
Toolbox