initPage() is far too late to be setting a title, so we'll do it right after newFromKey() is called. Allow getSkin() to be passed a title for context, else fall back to OutputPage's title.

This commit is contained in:
Chad Horohoe 2009-04-15 04:43:06 +00:00
parent 9d91ed5e93
commit eb377664b9
2 changed files with 21 additions and 6 deletions

View file

@ -176,8 +176,6 @@ class Skin extends Linker {
wfProfileIn( __METHOD__ );
$this->mTitle = $out->getTitle();
# Generally the order of the favicon and apple-touch-icon links
# should not matter, but Konqueror (3.5.9 at least) incorrectly
# uses whichever one appears later in the HTML source. Make sure
@ -268,12 +266,23 @@ class Skin extends Linker {
}
}
function setMembers(){
/**
* Set some local globals
*/
protected function setMembers(){
global $wgUser;
$this->mUser = $wgUser;
$this->userpage = $wgUser->getUserPage()->getPrefixedText();
$this->usercss = false;
}
/**
* Set the title
* @param Title $t The title to use
*/
public function setTitle( $t ) {
$this->mTitle = $t;
}
function outputPage( OutputPage $out ) {
global $wgDebugComments;

View file

@ -2144,11 +2144,12 @@ class User {
}
/**
* Get the current skin, loading it if required
* @return \type{Skin} Current skin
* Get the current skin, loading it if required, and setting a title
* @param Title $t The title to use in the skin
* @return Skin The current skin
* @todo FIXME : need to check the old failback system [AV]
*/
function &getSkin() {
function &getSkin( $t = null ) {
global $wgRequest, $wgAllowUserSkin, $wgDefaultSkin;
if ( ! isset( $this->mSkin ) ) {
wfProfileIn( __METHOD__ );
@ -2165,6 +2166,11 @@ class User {
$this->mSkin =& Skin::newFromKey( $userSkin );
wfProfileOut( __METHOD__ );
}
if ( !$t ) {
global $wgOut;
$t = $wgOut->getTitle();
}
$this->mSkin->setTitle( $t );
return $this->mSkin;
}