* (bug 2024) JavaScript error for custom skins
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 1 May 2005 02:39:54 +0000 (02:39 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 1 May 2005 02:39:54 +0000 (02:39 +0000)
Don't include the skinname.js message if it's not set for this skin.

Patch from Michael Keppler:
http://bugzilla.wikipedia.org/attachment.cgi?id=483

includes/SkinTemplate.php

index edd4975..9e34601 100644 (file)
@@ -939,7 +939,14 @@ class SkinTemplate extends Skin {
                $s = '/* generated javascript */';
                $s .= "var skin = '{$this->skinname}';\nvar stylepath = '{$wgStylePath}';";
                $s .= '/* MediaWiki:'.ucfirst($this->skinname)." */\n";
-               $s .= wfMsg(ucfirst($this->skinname).'.js');
+
+               // avoid inclusion of non defined user JavaScript (with custom skins only)
+               // by checking for default message content
+               $msgKey = ucfirst($this->skinname).'.js';
+               $userJS = wfMsg($msgKey);
+               if ('&lt;'.$msgKey.'&gt;' != $userJS) {
+                       $s .= $userJS;
+               }
                
                wfProfileOut( $fname );
                return $s;