require_once( 'GlobalFunctions.php' );
require_once( 'Namespace.php' );
require_once( 'RecentChange.php' );
+require_once( 'User.php' );
require_once( 'Skin.php' );
require_once( 'OutputPage.php' );
-require_once( 'User.php' );
require_once( 'LinkCache.php' );
require_once( 'Title.php' );
require_once( 'Article.php' );
wfProfileOut( $fname.'-BlockCache' );
wfProfileIn( $fname.'-User' );
+// HASHAR : implements things relevant to user like skin !
if( $wgCommandLineMode ) {
# Used for some maintenance scripts; user session cookies can screw things up
# when the database is in an in-between state.
<?php
+# See skin.doc
-require_once( 'Feed.php' );
+require_once( 'Feed.php' ); // should not be called if the actual page isn't feed enabled
require_once( 'Image.php' );
-# See skin.doc
-
# These are the INTERNAL names, which get mapped
# directly to class names. For display purposes, the
# Language class has internationalized names
#
/* private */ $wgValidSkinNames = array(
- 'standard' => 'Standard',
- 'nostalgia' => 'Nostalgia',
- 'cologneblue' => 'CologneBlue'
+ 'standard' => 'Standard',
+ 'nostalgia' => 'Nostalgia',
+ 'cologneblue' => 'CologneBlue'
);
if( $wgUsePHPTal ) {
#$wgValidSkinNames[] = 'PHPTal';
}
}
-
-require_once( 'SkinStandard.php' );
-require_once( 'SkinNostalgia.php' );
-require_once( 'SkinCologneBlue.php' );
-
-if( $wgUsePHPTal ) {
- require_once( 'SkinPHPTal.php' );
-}
-
-
?>
# http://www.gnu.org/copyleft/gpl.html
require_once "GlobalFunctions.php";
+ global $IP;
require_once $IP."/PHPTAL-NP-0.7.0/libs/PHPTAL.php";
class MediaWiki_I18N extends PHPTAL_I18N
function &getSkin() {
if ( ! isset( $this->mSkin ) ) {
+ # get all skin names available from SkinNames.php
$skinNames = Skin::getSkinNames();
- $s = $this->getOption( 'skin' );
- if ( '' == $s ) { $s = 'standard'; }
-
- if ( !isset( $skinNames[$s] ) ) {
+ # get the user skin
+ $userSkin = $this->getOption( 'skin' );
+ if ( $userSkin == '' ) { $userSkin = 'standard'; }
+
+ if ( !isset( $skinNames[$userSkin] ) ) {
+ # in case the user skin could not be found find a replacement
$fallback = array(
0 => 'SkinStandard',
1 => 'SkinNostalgia',
2 => 'SkinCologneBlue');
+ # if phptal is enabled we should have monobook skin that superseed
+ # the good old SkinStandard.
if ( isset( $skinNames['monobook'] ) ) {
$fallback[0] = 'SkinMonoBook';
}
- if(is_numeric($s) && isset( $fallback[$s]) ){
- $sn = $fallback[$s];
+ if(is_numeric($userSkin) && isset( $fallback[$userSkin]) ){
+ $sn = $fallback[$userSkin];
} else {
$sn = 'SkinStandard';
}
} else {
- $sn = 'Skin' . $skinNames[$s];
+ # The user skin is available
+ $sn = 'Skin' . $skinNames[$userSkin];
+ }
+
+ # only require the needed stuff
+ switch($sn) {
+ case 'SkinMonoBook':
+ require_once( 'SkinPHPTal.php' );
+ break;
+ case 'SkinStandard':
+ require_once( 'SkinStandard.php' );
+ break;
+ case 'SkinNostalgia':
+ require_once( 'SkinNostalgia.php' );
+ break;
+ case 'SkinCologneBlue':
+ require_once( 'SkinCologneBlue.php' );
+ break;
}
+ # now we can create the skin object
$this->mSkin = new $sn;
}
return $this->mSkin;