If local language's magicwords list is incomplete, try fetching it from the English one
[lhc/web/wiklou.git] / includes / Skin.php
index 593b513..ca7aed5 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-include_once( "Feed.php" );
+require_once( "Feed.php" );
+require_once( "Image.php" );
 
 # See skin.doc
 
@@ -13,10 +14,6 @@ include_once( "Feed.php" );
        'nostalgia' => "Nostalgia",
        'cologneblue' => "CologneBlue"
 );
-if( $wgUseSmarty ) {
-       $wgValidSkinNames['smarty'] = "Smarty";
-       $wgValidSkinNames['montparnasse'] = "Montparnasse";
-}
 if( $wgUsePHPTal ) {
     #$wgValidSkinNames[] = "PHPTal";
     #$wgValidSkinNames['davinci'] = "DaVinci";
@@ -25,23 +22,7 @@ if( $wgUsePHPTal ) {
     #$wgValidSkinNames['monobookminimal'] = "MonoBookMinimal";
 }
 
-include_once( "RecentChange.php" );
-
-# For some odd PHP bug, this function can't be part of a class
-function getCategories ()
-{
-  global $wgOut , $wgTitle , $wgUseCategoryMagic , $wgUser , $wgParser ;
-  if ( !isset ( $wgUseCategoryMagic ) || !$wgUseCategoryMagic ) return "" ;
-  if ( count ( $wgOut->mCategoryLinks ) == 0 ) return "" ;
-  if ( !$wgOut->isArticle() ) return "" ;
-  $sk = $wgUser->getSkin() ;
-  $s = "" ;
-  $s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ;
-  $t = implode ( " | " , $wgOut->mCategoryLinks ) ;
-  if ( $t != "" ) $s .= ": " ;
-  $s .= $t ;
-  return "<p class='catlinks'>$s</p>";
-}
+require_once( "RecentChange.php" );
 
 class RCCacheEntry extends RecentChange
 {
@@ -97,25 +78,47 @@ class Skin {
                $fname = "Skin::initPage";
                wfProfileIn( $fname );
                
-               $out->addLink( "shortcut icon", "", "/favicon.ico" );
-
-               $this->addMetadataLinks($out);
+               $out->addLink( array( "rel" => "shortcut icon", "href" => "/favicon.ico" ) );
+               
+               $this->addMetadataLinks($out);
            
                wfProfileOut( $fname );
        }
        
-        function addMetadataLinks( &$out ) {
-           global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf, $wgRdfMimeType, $action;
-
-           if ($action == 'view') {
-               # note: buggy CC software only reads first "meta" link
-               if ($wgEnableCreativeCommonsRdf) {
-                   $out->addMetadataLink('application/rdf+xml', wfLocalUrl($wgTitle->getPrefixedURL(), "action=creativecommons"));
+       function addMetadataLinks( &$out ) {
+               global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf, $wgRdfMimeType, $action;
+               global $wgRightsPage, $wgRightsUrl;
+
+               if( $out->isArticleRelated() ) {
+                       # note: buggy CC software only reads first "meta" link
+                       if( $wgEnableCreativeCommonsRdf ) {
+                               $out->addMetadataLink( array(
+                                       'title' => 'Creative Commons',
+                                       'type' => 'application/rdf+xml',
+                                       'href' => $wgTitle->getLocalURL( "action=creativecommons") ) );
+                       }
+                       if( $wgEnableDublinCoreRdf ) {
+                               $out->addMetadataLink( array(
+                                       'title' => 'Dublin Core',
+                                       'type' => 'application/rdf+xml',
+                                       'href' => $wgTitle->getLocalURL( "action=dublincore" ) ) );
+                       }
+               }
+               $copyright = "";
+               if( $wgRightsPage ) {
+                       $copy = Title::newFromText( $wgRightsPage );
+                       if( $copy ) {
+                               $copyright = $copy->getLocalURL();
+                       }
+               }
+               if( !$copyright && $wgRightsUrl ) {
+                       $copyright = $wgRightsUrl;
                }
-               if ($wgEnableDublinCoreRdf) {
-                   $out->addMetadataLink('application/rdf+xml', wfLocalUrl($wgTitle->getPrefixedURL(), "action=dublincore"));
+               if( $copyright ) {
+                       $out->addLink( array(
+                               "rel" => "copyright",
+                               "href" => $copyright ) );
                }
-           }
        }
     
        function outputPage( &$out ) {
@@ -148,18 +151,19 @@ class Skin {
        }
 
        function getHeadScripts() {
-               global $wgStyleSheetPath;
-               $r = "<script type=\"text/javascript\" src=\"{$wgStyleSheetPath}/wikibits.js\"></script>\n";
+               global $wgStylePath;
+               $r = "<script type=\"text/javascript\" src=\"{$wgStylePath}/wikibits.js\"></script>\n";
                return $r;
        }
 
        function getUserStyles()
        {
-               global $wgOut, $wgStyleSheetPath;
+               global $wgOut, $wgStylePath, $wgLang;
                $sheet = $this->getStylesheet();
                $s = "<style type='text/css'>\n";
                $s .= "/*/*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
-               $s .= "@import url(\"$wgStyleSheetPath/$sheet\");\n";
+               $s .= "@import url(\"$wgStylePath/$sheet\");\n";
+               if($wgLang->isRTL()) $s .= "@import url(\"$wgStylePath/common_rtl.css\");\n";
                $s .= $this->doGetUserStyles();
                $s .= "/* */\n";
                $s .= "</style>\n";
@@ -202,7 +206,7 @@ class Skin {
                  (!$wgTitle->isProtected() || $wgUser->isSysop()) ) {
                        $t = wfMsg( "editthispage" );
                        $oid = $red = "";
-                       if ( $redirect ) { 
+                       if ( !empty($redirect) ) { 
                                $red = "&redirect={$redirect}"; 
                        }
                        if ( !empty($oldid) && ! isset( $diff ) ) {
@@ -321,7 +325,7 @@ class Skin {
                if($wgLang->isRTL()) $left = !$left;
                
                if ( !$shove ) {
-                       $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>\n" .
+                       $s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
                          $this->logoText() . "</td>";
                } elseif( $left ) {
                        $s .= $this->getQuickbarCompensator( $rows );
@@ -349,10 +353,24 @@ class Skin {
 
                $s .= $this->pageTitle();
                $s .= $this->pageSubtitle() ;
-               $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
+               $s .= $this->getCategories();
                wfProfileOut( $fname );
                return $s;
        }
+       
+       function getCategories () {
+               global $wgOut, $wgTitle, $wgUser, $wgParser;
+               global $wgUseCategoryMagic;
+               if( !$wgUseCategoryMagic ) return "" ;
+               if( count( $wgOut->mCategoryLinks ) == 0 ) return "";
+               if( !$wgOut->isArticle() ) return "";
+               
+               $t = implode ( " | " , $wgOut->mCategoryLinks ) ;
+               $s = $this->makeKnownLink( "Special:Categories",
+                       wfMsg( "categories" ), "article=" . urlencode( $wgTitle->getPrefixedDBkey() ) )
+                       . ": " . $t;
+               return "<p class='catlinks'>$s</p>";
+       }
 
        function getQuickbarCompensator( $rows = 1 )
        {
@@ -384,7 +402,7 @@ class Skin {
                wfProfileIn( $fname );
                wfProfileIn( "$fname-1" );
 
-               $s = "\n</div><br clear='all' />\n";
+               $s = "\n</div><br style=\"clear:both\" />\n";
                $s .= "\n<div id='footer'>";
                $s .= "<table border='0' cellspacing='0'><tr>";
                
@@ -433,12 +451,12 @@ class Skin {
                $action = $wgRequest->getText( 'action' );
 
                $s = $this->printableLink();
-               if ( wfMsg ( "disclaimers" ) != "" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
+               if ( wfMsg ( "disclaimers" ) != "-" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
 
                if ( $wgOut->isArticleRelated() ) {
                        if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
                                $name = $wgTitle->getDBkey();
-                               $link = wfEscapeHTML( wfImageUrl( $name ) );
+                               $link = wfEscapeHTML( Image::wfImageUrl( $name ) );
                                $style = $this->getInternalLinkAttributes( $link, $name );
                                $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
                        }
@@ -509,24 +527,33 @@ class Skin {
        {
                global $wgOut, $wgTitle, $wgUser;
 
-               $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
+               $s = "<h1 class='pagetitle'>" . htmlspecialchars( $wgOut->getPageTitle() ) . "</h1>";
                if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
                return $s;
        }
 
        function pageSubtitle()
        {
-               global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
+               global $wgOut;
 
                $sub = $wgOut->getSubtitle();
                if ( "" == $sub ) {
                        global $wgExtraSubtitle;
                        $sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
                }
-               if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
+               $subpages = $this->subPageSubtitle();
+               $sub .= !empty($subpages)?"</p><p class='subpages'>$subpages":'';
+               $s = "<p class='subtitle'>{$sub}</p>\n";
+               return $s;
+       }
+
+       function subPageSubtitle()
+       {
+               global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
+               $subpages = '';
+               if($wgOut->isArticle() && !empty($wgNamespacesWithSubpages[$wgTitle->getNamespace()])) {
                        $ptext=$wgTitle->getPrefixedText();
                        if(preg_match("/\//",$ptext)) {
-                               $sub.="</p><p class='subpages'>";
                                $links=explode("/",$ptext);
                                $c=0;
                                $growinglink="";
@@ -537,19 +564,17 @@ class Skin {
                                                $getlink = $this->makeLink( $growinglink, $link );
                                                if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
                                                if ($c>1) {
-                                                       $sub .= " | ";
+                                                       $subpages .= " | ";
                                                } else  {
-                                                       $sub .="&lt; ";
+                                                       $subpages .="&lt; ";
                                                }
-                                               $sub .= $getlink;
+                                               $subpages .= $getlink;
                                                $growinglink.="/";
                                        }
-                                       
                                }
                        }
                }
-               $s = "<p class='subtitle'>{$sub}</p>\n";
-               return $s;
+               return $subpages;
        }
 
        function nameAndLogin()
@@ -600,15 +625,23 @@ class Skin {
 
                return $s;
        }
-
+       
+       function getSearchLink() {
+               $searchPage =& Title::makeTitle( NS_SPECIAL, "Search" );
+               return $searchPage->getLocalURL();
+       }
+       
+       function escapeSearchLink() {
+               return htmlspecialchars( $this->getSearchLink() );
+       }
+       
        function searchForm()
        {
                global $wgRequest;
-
-               $search = $wgRequest->getText( 'search' );;
-
+               $search = $wgRequest->getText( 'search' );
+               
                $s = "<form name='search' class='inline' method='post' action=\""
-                 . wfLocalUrl( "" ) . "\">\n"
+                 . $this->escapeSearchLink() . "\">\n"
                  . "<input type='text' name=\"search\" size='19' value=\""
                  . htmlspecialchars(substr($search,0,256)) . "\" />\n"
                  . "<input type='submit' name=\"go\" value=\"" . wfMsg ("go") . "\" />&nbsp;"
@@ -681,7 +714,7 @@ class Skin {
        {
                global $wgOut, $wgLang, $wgArticle, $wgRequest;
                global $wgDisableCounters;
-               
+
                extract( $wgRequest->getValues( 'oldid', 'diff' ) );
                if ( ! $wgOut->isArticle() ) { return ""; }
                if ( isset( $oldid ) || isset( $diff ) ) { return ""; }
@@ -694,9 +727,133 @@ class Skin {
                                $s = wfMsg( "viewcount", $count );
                        }
                }
-               $s .= $this->lastModified();
-               $s .= " " . wfMsg( "gnunote" );
-               return $s;
+
+               $s .= " " . $this->getCredits();
+           
+               return $s . " " .  $this->getCopyright();
+       }
+
+        function getCredits() {
+              global $wgMaxCredits;
+              
+              $s = '';
+           
+              if (!isset($wgMaxCredits) || $wgMaxCredits == 0) {
+                       $s = $this->lastModified();
+              } else {
+                       $s = $this->getAuthorCredits();
+                       if ($wgMaxCredits > 1) {
+                           $s .= " " . $this->getContributorCredits();
+                       }
+              }
+           
+              return $s;
+       }
+
+        function getAuthorCredits() {
+               global $wgLang, $wgArticle;
+
+               $last_author = $wgArticle->getUser();
+           
+               if ($last_author == 0) {
+                   $author_credit = wfMsg("anonymous");
+               } else {
+                   $real_name = User::whoIsReal($last_author);
+                   if (!empty($real_name)) {
+                       $author_credit = $real_name;
+                   } else {
+                       $author_credit = wfMsg("siteuser", User::whoIs($last_author));
+                   }
+               }
+           
+               $timestamp = $wgArticle->getTimestamp();
+               if ( $timestamp ) {
+                       $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
+               } else {
+                       $d = "";
+               }
+               return wfMsg("lastmodifiedby", $d, $author_credit);
+       }
+
+        function getContributorCredits() {
+           
+               global $wgArticle, $wgMaxCredits, $wgLang;
+
+                # don't count last editor
+
+               $contributors = $wgArticle->getContributors($wgMaxCredits - 1);
+           
+               $real_names = array();
+               $user_names = array();
+
+               # Sift for real versus user names
+               
+               foreach ($contributors as $user_id => $user_parts) {
+                   if ($user_id != 0) {
+                       if (!empty($user_parts[1])) {
+                           $real_names[$user_id] = $user_parts[1];
+                       } else {
+                           $user_names[$user_id] = $user_parts[0];
+                       }
+                   }
+               }
+           
+                $real = $wgLang->listToText(array_values($real_names));
+               $user = $wgLang->listToText(array_values($user_names));
+
+               if (!empty($user)) {
+                   $user = wfMsg("siteusers", $user);
+               }
+           
+               if ($contributors[0] && $contributors[0][0] > 0) {
+                   $anon = wfMsg("anonymous");
+               } else {
+                   $anon = '';
+               }
+           
+               $creds = $wgLang->listToText(array($real, $user, $anon));
+           
+               return wfMsg("othercontribs", $creds);
+       }
+    
+       function getCopyright() {
+               global $wgRightsPage, $wgRightsUrl, $wgRightsText;
+               $out = "";
+               if( $wgRightsPage ) {
+                       $link = $this->makeKnownLink( $wgRightsPage, $wgRightsText );
+               } elseif( $wgRightsUrl ) {
+                       $link = $this->makeExternalLink( $wgRightsUrl, $wgRightsText );
+               } else {
+                       # Give up now
+                       return $out;
+               }
+               $out .= wfMsg( "copyright", $link );
+               return $out;
+       }
+       
+       function getCopyrightIcon() {
+               global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRightsIcon;
+               $out = "";
+               if( $wgRightsIcon ) {
+                       $icon = htmlspecialchars( $wgRightsIcon );
+                       if( $wgRightsUrl ) {
+                               $url = htmlspecialchars( $wgRightsUrl );
+                               $out .= "<a href=\"$url\">";
+                       }
+                       $text = htmlspecialchars( $wgRightsText );
+                       $out .= "<img src=\"$icon\" alt='$text' />";
+                       if( $wgRightsUrl ) {
+                               $out .= "</a>";
+                       }
+               }
+               return $out;
+       }
+       
+       function getPoweredBy() {
+               global $wgStylePath;
+               $url = htmlspecialchars( "$wgStylePath/images/poweredby_mediawiki_88x31.png" );
+               $img = "<a href='http://www.mediawiki.org/'><img src='$url' alt='MediaWiki' /></a>";
+               return $img;
        }
 
        function lastModified()
@@ -752,7 +909,7 @@ class Skin {
                
                }
                // only show watchlist link if logged in
-               if ( wfMsg ( "currentevents" ) != "" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
+               if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
                $s .= "\n<br /><hr class='sep' />";
                $articleExists = $wgTitle->getArticleId();
                if ( $wgOut->isArticle() || $action =="edit" || $action =="history" || $wpPreview) {                            
@@ -876,29 +1033,21 @@ class Skin {
        {
                global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
                $a = array();
-
-               $validSP = $wgLang->getValidSpecialPages();
-
-               foreach ( $validSP as $name => $desc ) {
-                       if ( "" == $desc ) { continue; }
-                       $a[$name] = $desc;
+               $pages = SpecialPage::getPages();
+               
+               foreach ( $pages[""] as $name => $page ) {
+                       $a[$name] = $page->getDescription();
                }
                if ( $wgUser->isSysop() )
                { 
-                       $sysopSP = $wgLang->getSysopSpecialPages();
-
-                       foreach ( $sysopSP as $name => $desc ) {
-                               if ( "" == $desc ) { continue; }
-                               $a[$name] = $desc ;
+                       foreach ( $pages["sysop"] as $name => $page ) {
+                               $a[$name] = $page->getDescription();
                        }
                }
                if ( $wgUser->isDeveloper() )
                { 
-                       $devSP = $wgLang->getDeveloperSpecialPages();
-
-                       foreach ( $devSP as $name => $desc ) {
-                               if ( "" == $desc ) { continue; }
-                               $a[$name] = $desc ;
+                       foreach ( $pages["developer"] as $name => $page ) {
+                               $a[$name] = $page->getDescription() ;
                        }
                }
                $go = wfMsg( "go" );
@@ -906,7 +1055,7 @@ class Skin {
                $spp = $wgLang->specialPage( "Specialpages" );
 
                $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
-                 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
+                 "action=\"" . htmlspecialchars( "{$wgServer}{$wgRedirectScript}" ) . "\">\n";
                $s .= "<select name=\"wpDropdown\">\n";
                $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
 
@@ -915,7 +1064,7 @@ class Skin {
                        $s .= "<option value=\"{$p}\">{$desc}</option>\n";
                }
                $s .= "</select>\n";
-               $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
+               $s .= "<input type='submit' value=\"{$go}\" name='redirect' />\n";
                $s .= "</form>\n";
                return $s;
        }
@@ -1269,10 +1418,10 @@ class Skin {
                return $result;
        }
 
-       function makeKnownLink( $title, $text = "", $query = "", $trail = "" ) {
+       function makeKnownLink( $title, $text = "", $query = "", $trail = "", $prefix = '',$aprops = '') {
                $nt = Title::newFromText( $title );
                if ($nt) {
-                       return $this->makeKnownLinkObj( Title::newFromText( $title ), $text, $query, $trail );
+                       return $this->makeKnownLinkObj( Title::newFromText( $title ), $text, $query, $trail, $prefix , $aprops );
                } else {
                        wfDebug( "Invalid title passed to Skin::makeKnownLink(): \"$title\"\n" );
                        return $text == "" ? $title : $text;
@@ -1355,7 +1504,7 @@ class Skin {
        }
 
        # Pass a title object, not a title string
-       function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
+       function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" , $aprops = '')
        {
                global $wgOut, $wgTitle;
 
@@ -1366,14 +1515,18 @@ class Skin {
 
                if ( "" == $link ) {
                        $u = "";
-                       if ( "" == $text ) { $text = $nt->getFragment(); }
+                       if ( "" == $text ) {
+                               $text = htmlspecialchars( $nt->getFragment() );
+                       }
                } else {
                        $u = $nt->escapeLocalURL( $query );
                }
                if ( "" != $nt->getFragment() ) {
-                       $u .= "#" . wfEscapeHTML( $nt->getFragment() );
+                       $u .= "#" . htmlspecialchars( $nt->getFragment() );
+               }
+               if ( "" == $text ) {
+                       $text = htmlspecialchars( $nt->getPrefixedText() );
                }
-               if ( "" == $text ) { $text = $nt->getPrefixedText(); }
                $style = $this->getInternalLinkAttributesObj( $nt, $text );
 
                $inside = "";
@@ -1383,7 +1536,7 @@ class Skin {
                                $trail = $m[2];
                        }
                }
-               $r = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
+               $r = "<a href=\"{$u}\"{$style}{$aprops}>{$prefix}{$text}{$inside}</a>{$trail}";
                wfProfileOut( $fname );
                return $r;
        }
@@ -1403,7 +1556,9 @@ class Skin {
                }
                $u = $nt->escapeLocalURL( $q );
 
-               if ( "" == $text ) { $text = $nt->getPrefixedText(); }
+               if ( "" == $text ) {
+                       $text = htmlspecialchars( $nt->getPrefixedText() );
+               }
                $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
 
                $inside = "";
@@ -1432,7 +1587,9 @@ class Skin {
 
                $u = $nt->escapeLocalURL( $query );
 
-               if ( "" == $text ) { $text = $nt->getPrefixedText(); }
+               if ( "" == $text ) {
+                       $text = htmlspecialchars( $nt->getPrefixedText() );
+               }
                $style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
 
                $inside = "";
@@ -1449,6 +1606,97 @@ class Skin {
                }
                return $s;
        }
+       
+       function makeSelfLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
+       {
+               $u = $nt->escapeLocalURL( $query );
+               if ( "" == $text ) {
+                       $text = htmlspecialchars( $nt->getPrefixedText() );
+               }
+               $inside = "";
+               if ( "" != $trail ) {
+                       if ( preg_match( $this->linktrail, $trail, $m ) ) {
+                               $inside = $m[1];
+                               $trail = $m[2];
+                       }
+               }
+               return "<strong>{$prefix}{$text}{$inside}</strong>{$trail}";
+       }
+
+       /* these are used extensively in SkinPHPTal, but also some other places */
+       /*static*/ function makeSpecialUrl( $name, $urlaction='' ) {
+               $title = Title::makeTitle( NS_SPECIAL, $name );
+               $this->checkTitle($title, $name);       
+               return $title->getLocalURL( $urlaction );
+       }
+       /*static*/ function makeTalkUrl ( $name, $urlaction='' ) {
+               $title = Title::newFromText( $name );
+               $title = $title->getTalkPage();
+               $this->checkTitle($title, $name);       
+               return $title->getLocalURL( $urlaction );
+       }
+       /*static*/ function makeArticleUrl ( $name, $urlaction='' ) {
+               $title = Title::newFromText( $name );
+               $title= $title->getSubjectPage();
+               $this->checkTitle($title, $name);       
+               return $title->getLocalURL( $urlaction );
+       }
+       /*static*/ function makeI18nUrl ( $name, $urlaction='' ) {
+               $title = Title::newFromText( wfMsg($name) );
+               $this->checkTitle($title, $name);       
+               return $title->getLocalURL( $urlaction );
+       }
+       /*static*/ function makeUrl ( $name, $urlaction='' ) {
+               $title = Title::newFromText( $name );
+               $this->checkTitle($title, $name);       
+               return $title->getLocalURL( $urlaction ); 
+       }
+       
+       /* these return an array with the 'href' and boolean 'exists' */
+       /*static*/ function makeUrlDetails ( $name, $urlaction='' ) {
+               $title = Title::newFromText( $name );
+               $this->checkTitle($title, $name);
+               return array( 
+                       'href' => $title->getLocalURL( $urlaction ),
+                       'exists' => $title->getArticleID() != 0?true:false
+               ); 
+       }
+       /*static*/ function makeTalkUrlDetails ( $name, $urlaction='' ) {
+               $title = Title::newFromText( $name );
+               $title = $title->getTalkPage();
+               $this->checkTitle($title, $name);
+               return array( 
+                       'href' => $title->getLocalURL( $urlaction ),
+                       'exists' => $title->getArticleID() != 0?true:false
+               ); 
+       }
+       /*static*/ function makeArticleUrlDetails ( $name, $urlaction='' ) {
+               $title = Title::newFromText( $name );
+               $title= $title->getSubjectPage();
+               $this->checkTitle($title, $name);
+               return array( 
+                       'href' => $title->getLocalURL( $urlaction ),
+                       'exists' => $title->getArticleID() != 0?true:false
+               ); 
+       }
+       /*static*/ function makeI18nUrlDetails ( $name, $urlaction='' ) {
+               $title = Title::newFromText( wfMsg($name) );
+               $this->checkTitle($title, $name);
+               return array( 
+                       'href' => $title->getLocalURL( $urlaction ),
+                       'exists' => $title->getArticleID() != 0?true:false
+               ); 
+       }
+
+       # make sure we have some title to operate on
+       /*static*/ function checkTitle ( &$title, &$name ) { 
+               if(!is_object($title)) {
+                       $title = Title::newFromText( $name );
+                       if(!is_object($title)) {
+                               $title = Title::newFromText( '<error: link target missing>' );
+                       }
+               }
+       }
 
        function fnamePart( $url )
        {
@@ -1474,8 +1722,9 @@ class Skin {
 
        function makeImageLinkObj( $nt, $alt = "" ) {
                global $wgLang, $wgUseImageResize;
-               $name  = $nt->getDBKey();
-               $url   = wfImageUrl( $name );
+               $img   = Image::newFromTitle( $nt );
+               $url   = $img->getURL();
+
                $align = "";
                $prefix = $postfix = "";
 
@@ -1487,6 +1736,8 @@ class Skin {
                        #  * right              same, but right aligned
                        #  * none               same, but not aligned
                        #  * ___px              scale to ___ pixels width, no aligning. e.g. use in taxobox
+                       #  * center             center the image
+                       #  * framed             Keep original image size, no magnify-button.
        
                        $part = explode( "|", $alt);
        
@@ -1496,9 +1747,10 @@ class Skin {
                        $mwNone   =& MagicWord::get( MAG_IMG_NONE );
                        $mwWidth  =& MagicWord::get( MAG_IMG_WIDTH );
                        $mwCenter =& MagicWord::get( MAG_IMG_CENTER );
+                       $mwFramed =& MagicWord::get( MAG_IMG_FRAMED );
                        $alt = $part[count($part)-1];
 
-                       $thumb=false;
+                       $height = $framed = $thumb = false;
 
                        foreach( $part as $key => $val ) {
                                if ( ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
@@ -1517,7 +1769,14 @@ class Skin {
                                        $align = "none";
                                } elseif ( ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {
                                        # $match is the image width in pixels
-                                       $width = intval($match);
+                                       if ( preg_match( "/^([0-9]*)x([0-9]*)$/", $match, $m ) ) {
+                                               $width = intval( $m[1] );
+                                               $height = intval( $m[2] );
+                                       } else {
+                                               $width = intval($match);
+                                       }
+                               } elseif ( ! is_null( $mwFramed->matchVariableStartToEnd($val) ) ) {
+                                       $framed=true;
                                }
                        }
                        if ( "center" == $align )
@@ -1527,7 +1786,7 @@ class Skin {
                                $align   = "none";
                        }
        
-                       if ( $thumb ) {
+                       if ( $thumb || $framed ) {
        
                                # Create a thumbnail. Alignment depends on language
                                # writing direction, # right aligned for left-to-right-
@@ -1542,181 +1801,104 @@ class Skin {
                                if ( ! isset($width) ) {
                                        $width = 180;
                                }
-                               return $prefix.$this->makeThumbLinkObj( $nt, $alt, $align, $width ).$postfix;
+                               return $prefix.$this->makeThumbLinkObj( $img, $alt, $align, $width, $height, $framed ).$postfix;
        
                        } elseif ( isset($width) ) {
                                
                                # Create a resized image, without the additional thumbnail
                                # features
-                               $url = $this->createThumb( $name, $width );
+
+                               if (    ( ! $height === false ) 
+                                    && ( $img->getHeight() * $width / $img->getWidth() > $height ) ) {
+                                       print "height=$height<br>\nimg->getHeight() = ".$img->getHeight()."<br>\n";
+                                       print "rescaling by factor ". $height / $img->getHeight() . "<br>\n";
+                                       $width = $img->getWidth() * $height / $img->getHeight();
+                               }
+                               $url = $img->createThumb( $width );
                        }
                } # endif $wgUseImageResize
                        
                if ( empty( $alt ) ) {
-                       $alt = preg_replace( '/\.(.+?)^/', '', $name );
+                       $alt = preg_replace( '/\.(.+?)^/', '', $img->getName() );
                }
                $alt = htmlspecialchars( $alt );
 
                $u = $nt->escapeLocalURL();
                if ( $url == "" )
                {
-                       $s = str_replace( "$1", $name, wfMsg("missingimage") );
+                       $s = str_replace( "$1", $img->getName(), wfMsg("missingimage") );
+                       $s .= "<br>{$alt}<br>{$url}<br>\n";
                } else {
-                       $s = "\n  <a href=\"{$u}\" class='image' title=\"{$alt}\">\n" .
-                               "  <img src=\"{$url}\" alt=\"{$alt}\" />\n  </a>";
+                       $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
+                               "<img src=\"{$url}\" alt=\"{$alt}\" /></a>";
                }
                if ( "" != $align ) {
-                       $s = "<div class=\"float{$align}\"><span>{$s}\n</span></div>";
+                       $s = "<div class=\"float{$align}\"><span>{$s}</span></div>";
                }
-               return $prefix.$s.$postfix;
+               return str_replace("\n", ' ',$prefix.$s.$postfix);
        }
 
-       function createThumb( $name, $width ) {
-               global $wgUploadDirectory;
-               global $wgImageMagickConvertCommand;
-               global $wgUseImageMagick;
-               global $wgUseSquid, $wgInternalServer;
-               $imgPath   = wfImagePath( $name );
-               $thumbName = $width."px-".$icon.$name;
-               $thumbPath = wfImageThumbDir( $thumbName )."/".$thumbName;
-               $thumbUrl  = wfImageThumbUrl( $thumbName );
-
-               if ( ! file_exists( $imgPath ) )
-               {
-                       # If there is no image, there will be no thumbnail
-                       return "";
-               }
-
-               if (     (! file_exists( $thumbPath ) )
-               ||  ( filemtime($thumbPath) < filemtime($imgPath) ) ) {
-                       # Squid purging
-                       if ( $wgUseSquid ) {
-                               $urlArr = Array(
-                                       $wgInternalServer.$thumbUrl
-                               );
-                               wfPurgeSquidServers($urlArr);
-                       }
-
-                       if ( $wgUseImageMagick ) {
-                               # use ImageMagick
-                               $cmd  =  $wgImageMagickConvertCommand .
-                                       " -quality 85 -geometry {$width} ".
-                                       escapeshellarg($imgPath) . " " .
-                                       escapeshellarg($thumbPath);
-                               $conv = shell_exec( $cmd );
-                       } else {
-                               # Use PHP's builtin GD library functions.
-                               #
-                               # First find out what kind of file this is, and select the correct
-                               # input routine for this.
-                               list($src_width, $src_height, $src_type, $src_attr) = getimagesize( $imgPath );
-                               switch( $src_type ) {
-                                       case 1: # GIF
-                                               $src_image = imagecreatefromgif( $imgPath );
-                                               break;
-                                       case 2: # JPG
-                                               $src_image = imagecreatefromjpeg( $imgPath );
-                                               break;
-                                       case 3: # PNG
-                                               $src_image = imagecreatefrompng( $imgPath );
-                                               break;
-                                       case 15: # WBMP for WML
-                                               $src_image = imagecreatefromwbmp( $imgPath );
-                                               break;
-                                       case 16: # XBM
-                                               $src_image = imagecreatefromxbm( $imgPath );
-                                               break;
-                                       default:
-                                               return "Image type not supported";
-                                               break;
-                               }
-                               $height = floor( $src_height * ( $width/$src_width ) );
-                               $dst_image = imagecreatetruecolor( $width, $height );
-                               imagecopyresampled( $dst_image, $src_image, 
-                                                       0,0,0,0,
-                                                       $width, $height, $src_width, $src_height );
-                               switch( $src_type ) {
-                                       case 1:  # GIF
-                                       case 3:  # PNG
-                                       case 15: # WBMP
-                                       case 16: # XBM
-                                               #$thumbUrl .= ".png";
-                                               #$thumbPath .= ".png";
-                                               imagepng( $dst_image, $thumbPath );
-                                               break;
-                                       case 2:  # JPEG
-                                               #$thumbUrl .= ".jpg";
-                                               #$thumbPath .= ".jpg";
-                                               imageinterlace( $dst_image );
-                                               imagejpeg( $dst_image, $thumbPath, 95 );
-                                               break;
-                                       default:
-                                               break;
-                               }
-                               imagedestroy( $dst_image );
-                               imagedestroy( $src_image );
-
 
-                       }
-                       #
-                       # Check for zero-sized thumbnails. Those can be generated when 
-                       # no disk space is available or some other error occurs
-                       #
-                       $thumbstat = stat( $thumbPath );
-                       $imgstat   = stat( $imgPath );
-                       if( $thumbstat["size"] == 0 )
-                       {
-                               unlink( $thumbPath );
-                       }
-
-               }
-               return $thumbUrl;
-       }
-
-       function makeThumbLinkObj( $nt, $label = "", $align = "right", $boxwidth = 180 ) {
-               global $wgUploadPath, $wgLang;
-               $name = $nt->getDBKey();
-               $image = Title::makeTitle( Namespace::getImage(), $name );
-               $url  = wfImageUrl( $name );
-               $path = wfImagePath( $name );
+       function makeThumbLinkObj( $img, $label = "", $align = "right", $boxwidth = 180, $boxheight=false, $framed=false ) {
+               global $wgStylePath, $wgLang;
+               # $image = Title::makeTitle( Namespace::getImage(), $name );
+               $url  = $img->getURL();
                
                #$label = htmlspecialchars( $label );
                $alt = preg_replace( "/<[^>]*>/", "", $label);
                $alt = htmlspecialchars( $alt );
                
-               if ( file_exists( $path ) )
+               if ( $img->exists() )
                {
-                       list($width, $height, $type, $attr) = getimagesize( $path );
+                       $width  = $img->getWidth();
+                       $height = $img->getHeight();
                } else {
                        $width = $height = 200;
                }
-               $boxheight  = intval( $height/($width/$boxwidth) );
-               if ( $boxwidth > $width ) {
+               if ( $framed )
+               {
+                       // Use image dimensions, don't scale
                        $boxwidth  = $width;
+                       $oboxwidth = $boxwidth + 2;
                        $boxheight = $height;
+                       $thumbUrl  = $url;
+               } else {
+                       $h  = intval( $height/($width/$boxwidth) );
+                       $oboxwidth = $boxwidth + 2;
+                       if ( ( ! $boxheight === false ) &&  ( $h > $boxheight ) )
+                       {
+                               $boxwidth *= $boxheight/$h;
+                       } else {
+                               $boxheight = $h;
+                       }
+                       $thumbUrl = $img->createThumb( $boxwidth );
                }
-               
-               $thumbUrl = $this->createThumb( $name, $boxwidth );
 
-               $u = $nt->escapeLocalURL();
+               $u = $img->getEscapeLocalURL();
 
                $more = htmlspecialchars( wfMsg( "thumbnail-more" ) );
                $magnifyalign = $wgLang->isRTL() ? "left" : "right";
-               $textalign = $wgLang->isRTL() ? " style=\"text-align:right\"" : "";
+               $textalign = $wgLang->isRTL() ? ' style="text-align:right"' : "";
 
-               $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$boxwidth}px;\"><div>";
+               $s = "<div class=\"thumb t{$align}\"><div style=\"width:{$oboxwidth}px;\">";
                if ( $thumbUrl == "" ) {
-                       $s .= str_replace( "$1", $name, wfMsg("missingimage") );
+                       $s .= str_replace( "$1", $img->getName(), wfMsg("missingimage") );
+                       $zoomicon = '';
                } else {
-                       $s .= "\n".'  <a href="'.$u.'" class="internal" title="'.$alt.'">'."\n".
-                               '  <img src="'.$thumbUrl.'" alt="'.$alt.'" ' .
-                               '  width="'.$boxwidth.'" height="'.$boxheight.'" /></a>' ."\n".
-                               '  <a href="'.$u.'" class="internal" title="'.$more.'"> ' ."\n".
-                               '  <img src="'.$wgUploadPath.'/magnify-clip.png" ' .
-                               'width="26" height="24" align="'.$magnifyalign.'" alt="'.$more.'" /> </a>'."\n";
-               }
-               $s .= '  <p'.$textalign.'>'.$label."</p>\n</div></div>";
-               return $s;
+                       $s .= '<a href="'.$u.'" class="internal" title="'.$alt.'">'.
+                               '<img src="'.$thumbUrl.'" alt="'.$alt.'" ' .
+                               'width="'.$boxwidth.'" height="'.$boxheight.'" /></a>';
+                       if ( $framed ) {
+                               $zoomicon="";
+                       } else {
+                               $zoomicon =  '<div class="magnify" style="float:'.$magnifyalign.'">'.
+                                       '<a href="'.$u.'" class="internal" title="'.$more.'">'.
+                                       '<img src="'.$wgStylePath.'/images/magnify-clip.png" ' .
+                                       'width="15" height="11" alt="'.$more.'" /></a></div>';
+                       }
+               }
+               $s .= '  <div class="thumbcaption" '.$textalign.'>'.$zoomicon.$label."</div></div></div>";
+               return str_replace("\n", ' ', $s);
        }
 
        function makeMediaLink( $name, $url, $alt = "" ) {
@@ -1727,7 +1909,7 @@ class Skin {
        function makeMediaLinkObj( $nt, $alt = "" )
        {
                $name = $nt->getDBKey();
-               $url = wfImageUrl( $name );
+               $url = Image::wfImageUrl( $name );
                if ( empty( $alt ) ) {
                        $alt = preg_replace( '/\.(.+?)^/', '', $name );
                }
@@ -1746,6 +1928,15 @@ class Skin {
                return $this->makeKnownLink( $wgLang->specialPage( $pn ),
                  wfMsg( $key ) );
        }
+       
+       function makeExternalLink( $url, $text, $escape = true ) {
+               $style = $this->getExternalLinkAttributes( $url, $text );
+               $url = htmlspecialchars( $url );
+               if( $escape ) {
+                       $text = htmlspecialchars( $text );
+               }
+               return "<a href=\"$url\"$style>$text</a>";
+       }
 
        # Called by history lists and recent changes
        #
@@ -1757,13 +1948,14 @@ class Skin {
                $this->rcMoveIndex = 0;
                $this->rcCacheIndex = 0 ;
                $this->lastdate = "";
+               $this->rclistOpen = false;
                return "";
        }
 
        function beginImageHistoryList()
        {
                $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
-                 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul class='special'>";
+                 "<p>" . wfMsg( "imghistlegend" ) . "</p>\n<ul class='special'>";
                return $s;
        }
 
@@ -1772,14 +1964,16 @@ class Skin {
        function endRecentChangesList()
        {
                $s = $this->recentChangesBlock() ;
-               $s .= "</ul>\n";
+               if( $this->rclistOpen ) {
+                       $s .= "</ul>\n";
+               }
                return $s;
        }
 
        # Enhanced RC ungrouped line
        function recentChangesBlockLine ( $rcObj )
        {
-               global $wgUploadPath, $wgLang ;
+               global $wgStylePath, $wgLang ;
 
                # Get rc_xxxx variables
                extract( $rcObj->mAttribs ) ;
@@ -1788,7 +1982,7 @@ class Skin {
                # Spacer image
                $r = "" ;
 
-               $r .= "<img src='{$wgUploadPath}/Arr_.png' width='12' height='12' border='0' />" ;              $r .= "<tt>" ;
+               $r .= "<img src='{$wgStylePath}/images/Arr_.png' width='12' height='12' border='0' />" ;                $r .= "<tt>" ;
 
                if ( $rc_type == RC_MOVE ) {
                        $r .= "&nbsp;&nbsp;";
@@ -1843,7 +2037,7 @@ class Skin {
        # Enhanced RC group
        function recentChangesBlockGroup ( $block )
        {
-               global $wgUploadPath, $wgLang ;
+               global $wgStylePath, $wgLang ;
 
                $r = "" ;
                $M = wfMsg( "minoreditletter" );
@@ -1877,8 +2071,8 @@ class Skin {
                $rcm = "RCM{$this->rcCacheIndex}" ;
                $toggleLink = "javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")" ;
                $arrowdir = $wgLang->isRTL() ? "l" : "r";
-               $tl  = "<span id='{$rcm}'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_{$arrowdir}.png' width='12' height='12' /></a></span>" ;
-               $tl .= "<span id='{$rcl}' style='display:none'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_d.png' width='12' height='12' /></a></span>" ;
+               $tl  = "<span id='{$rcm}'><a href='$toggleLink'><img src='{$wgStylePath}/images/Arr_{$arrowdir}.png' width='12' height='12' /></a></span>" ;
+               $tl .= "<span id='{$rcl}' style='display:none'><a href='$toggleLink'><img src='{$wgStylePath}/images/Arr_d.png' width='12' height='12' /></a></span>" ;
                $r .= $tl ;
 
                # Main line
@@ -1920,7 +2114,7 @@ class Skin {
                        # Get rc_xxxx variables
                        extract( $rcObj->mAttribs );
                        
-                       $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 />";
+                       $r .= "<img src='{$wgStylePath}/images/Arr_.png' width=12 height=12 />";
                        $r .= "<tt>&nbsp; &nbsp; &nbsp; &nbsp;" ;
                        if ( $rc_new ) $r .= $N ;
                        else $r .= "&nbsp;" ;
@@ -1962,7 +2156,7 @@ class Skin {
        # RC lines, arranges them, and outputs the HTML
        function recentChangesBlock ()
        {
-               global $wgUploadPath ;
+               global $wgStylePath ;
                if ( count ( $this->rc_cache ) == 0 ) return "" ;
                $blockOut = "";
                foreach ( $this->rc_cache AS $secureName => $block ) {
@@ -2004,6 +2198,7 @@ class Skin {
                        if ( "" != $this->lastdate ) { $s .= "</ul>\n"; }
                        $s .= "<h4>{$date}</h4>\n<ul class='special'>";
                        $this->lastdate = $date;
+                       $this->rclistOpen = true;
                }
                $s .= "<li> ";
 
@@ -2025,7 +2220,7 @@ class Skin {
                                $diffLink = wfMsg( "diff" );
                        } else {
                                $diffLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "diff" ),
-                                 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
+                                 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}"  ,'' ,'' , ' tabindex="'.$rc->counter.'"');
                        }
                        $s .= "($diffLink) (";
 
@@ -2135,7 +2330,7 @@ class Skin {
                        $curLink = wfMsg( "cur" );
                } else {
                        $curLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "cur" ),
-                         "{$curIdEq}&diff=0&oldid={$rc_this_oldid}" );
+                         "{$curIdEq}&diff=0&oldid={$rc_this_oldid}" ,'' ,'' , ' tabindex="'.$baseRC->counter.'"' );
                }
 
                # Make "last" link
@@ -2204,7 +2399,7 @@ class Skin {
           and by the user contributions list. It is responsible for formatting edit
           comments. It escapes any HTML in the comment, but adds some CSS to format
           auto-generated comments (from section editing) and formats [[wikilinks]].
-          Main author: Erik Möller (moeller@scireview.de)
+          Main author: Erik Möller (moeller@scireview.de)
        */
        function formatComment($comment)
        {
@@ -2250,16 +2445,16 @@ class Skin {
 
        }
 
-       function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
+       function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description )
        {
                global $wgUser, $wgLang, $wgTitle;
 
-               $dt = $wgLang->timeanddate( $ts, true );
+               $datetime = $wgLang->timeanddate( $timestamp, true );
                $del = wfMsg( "deleteimg" );
                $cur = wfMsg( "cur" );
 
                if ( $iscur ) {
-                       $url = wfImageUrl( $img );
+                       $url = Image::wfImageUrl( $img );
                        $rlink = $cur;
                        if ( $wgUser->isSysop() ) {
                                $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
@@ -2274,10 +2469,10 @@ class Skin {
                        $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
                        if( $wgUser->getID() != 0 ) {
                                $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
-                                 wfMsg( "revertimg" ), "action=revert&oldimage=" .
-                                 urlencode( $img ) );
+                                          wfMsg( "revertimg" ), "action=revert&oldimage=" .
+                                          urlencode( $img ) );
                                $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
-                                 $del, "action=delete&oldimage=" . urlencode( $img ) );
+                                          $del, "action=delete&oldimage=" . urlencode( $img ) );
                        } else {
                                # Having live active links for non-logged in users
                                # means that bots and spiders crawling our site can
@@ -2286,19 +2481,21 @@ class Skin {
                                $dlink = $del;
                        }
                }
-               if ( 0 == $u ) { $ul = $ut; }
-               else { $ul = $this->makeLink( $wgLang->getNsText(
-                 Namespace::getUser() ) . ":{$ut}", $ut ); }
-
-               $nb = wfMsg( "nbytes", $size );
-               $style = $this->getInternalLinkAttributes( $url, $dt );
+               if ( 0 == $user ) {
+                       $userlink = $usertext;
+               } else {
+                       $userlink = $this->makeLink( $wgLang->getNsText( Namespace::getUser() ) .
+                                      ":{$usertext}", $usertext );
+               }
+               $nbytes = wfMsg( "nbytes", $size );
+               $style = $this->getInternalLinkAttributes( $url, $datetime );
 
-               $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
-                 . " . . {$ul} ({$nb})";
+               $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$datetime}</a>"
+                 . " . . {$userlink} ({$nbytes})";
 
-               if ( "" != $c && "*" != $c ) {
+               if ( "" != $description && "*" != $description ) {
                        $sk=$wgUser->getSkin();
-                       $s .= $wgLang->emphasize(" (" . $sk->formatComment($c) . ")");
+                       $s .= $wgLang->emphasize(" (" . $sk->formatComment($description) . ")");
                }
                $s .= "</li>\n";
                return $s;
@@ -2374,7 +2571,7 @@ class Skin {
        // toolbar for common editing functions. It can be disabled in the user preferences.
        // The necsesary JavaScript code can be found in style/wikibits.js.
        function getEditToolbar() {
-               global $wgUploadPath, $wgLang, $wgMimeType;
+               global $wgStylePath, $wgLang, $wgMimeType;
 
                // toolarray an array of arrays which each include the filename of
                // the button image (without path), the opening tag, the closing tag,
@@ -2464,17 +2661,12 @@ class Skin {
                                "key"=>"R"
                                )
                );
-               $toolbar ="<script type='text/javascript'>\n";
-
-               $xml = ($wgMimeType == "text/xml");
-               if( $xml ) {
-                       $toolbar .= "<![CDATA[";
-               }
-
-               $toolbar.="document.writeln(\"<div id='toolbar' tabindex='4000000'>\");\n";
+               $toolbar ="<script type='text/javascript'>\n/*<![CDATA[*/\n";
+               
+               $toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
                foreach($toolarray as $tool) {
 
-                       $image=$wgUploadPath."/".$tool["image"];
+                       $image=$wgStylePath."/images/".$tool["image"];
                        $open=$tool["open"];
                        $close=$tool["close"];
                        $sample = addslashes( $tool["sample"] );
@@ -2492,24 +2684,19 @@ class Skin {
 
                $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "','" . addslashes(wfMsg("infobox_alert")) . "');\n";
                $toolbar.="document.writeln(\"</div>\");\n";
-
-               if( $xml ) {
-                       $toolbar .= "]]>";
-               }
-               $toolbar.="</script>";
+               
+               $toolbar.="/*]]>*/\n</script>";
                return $toolbar;
        }
+
 }
 
-include_once( "SkinStandard.php" );
-include_once( "SkinNostalgia.php" );
-include_once( "SkinCologneBlue.php" );
+require_once( "SkinStandard.php" );
+require_once( "SkinNostalgia.php" );
+require_once( "SkinCologneBlue.php" );
 
-if( $wgUseSmarty ) {
-       include_once( "SkinSmarty.php" );
-}
 if( $wgUsePHPTal ) {
-       include_once( "SkinPHPTal.php" );
+       require_once( "SkinPHPTal.php" );
 }