BUG#93 Fix handling of <nowiki> in templates
[lhc/web/wiklou.git] / includes / Skin.php
index 758d314..262c497 100644 (file)
@@ -1,33 +1,62 @@
 <?php
 
-# This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+/**
+ *
+ * @package MediaWiki
+ */
+
+/**
+ * This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+ */
 if( defined( "MEDIAWIKI" ) ) {
 
 # See skin.doc
-
-require_once( 'Feed.php' );  // should not be called if the actual page isn't feed enabled
 require_once( 'Image.php' );
 
-# These are the INTERNAL names, which get mapped
-# directly to class names.  For display purposes, the
-# Language class has internationalized names
+# These are the INTERNAL names, which get mapped directly to class names and
+# file names in ./skins/. For display purposes, the Language class has
+# internationalized names
 #
-/* private */ $wgValidSkinNames = array(
-       'standard'              => 'Standard',
-       'nostalgia'             => 'Nostalgia',
-       'cologneblue'   => 'CologneBlue'
+/*
+$wgValidSkinNames = array(
+       'standard'      => 'Standard',
+       'nostalgia'     => 'Nostalgia',
+       'cologneblue'   => 'CologneBlue'
 );
 if( $wgUsePHPTal ) {
-    #$wgValidSkinNames[] = 'PHPTal';
-    #$wgValidSkinNames['davinci'] = 'DaVinci';
-    #$wgValidSkinNames['mono'] = 'Mono';
-    $wgValidSkinNames['monobook'] = 'MonoBook';
-    $wgValidSkinNames['myskin'] = 'MySkin';
-    #$wgValidSkinNames['monobookminimal'] = 'MonoBookMinimal';
+       #$wgValidSkinNames[] = 'PHPTal';
+       #$wgValidSkinNames['davinci'] = 'DaVinci';
+       #$wgValidSkinNames['mono'] = 'Mono';
+       #$wgValidSkinNames['monobookminimal'] = 'MonoBookMinimal';
+       $wgValidSkinNames['monobook'] = 'MonoBook';
+       $wgValidSkinNames['myskin'] = 'MySkin';
+       $wgValidSkinNames['chick'] = 'Chick';
+}
+*/
+
+# Get a list of all skins available in /skins/
+# Build using the regular expression '^(.*).php$'
+# Array keys are all lower case, array value keep the case used by filename
+#
+
+$skinDir = dir($IP.'/skins');
+
+# while code from www.php.net
+while (false !== ($file = $skinDir->read())) {
+       if(preg_match('/^(.*).php$/',$file, $matches)) {
+               $aSkin = $matches[1];
+       $wgValidSkinNames[strtolower($aSkin)] = $aSkin;
+       }
 }
+$skinDir->close();
+unset($matches);
 
 require_once( 'RecentChange.php' );
 
+/**
+ * @todo document
+ * @package MediaWiki
+ */
 class RCCacheEntry extends RecentChange
 {
        var $secureName, $link;
@@ -43,41 +72,52 @@ class RCCacheEntry extends RecentChange
        }
 } ;
 
-class Skin {
 
-       /* private */ var $lastdate, $lastline;
+/**
+ * The main skin class that provide methods and properties for all other skins
+ * including PHPTal skins.
+ * This base class is also the "Standard" skin.
+ * @package MediaWiki
+ */
+class Skin {
+       /**#@+
+        * @access private
+        */
+       var $lastdate, $lastline;
        var $linktrail ; # linktrail regexp
        var $rc_cache ; # Cache for Enhanced Recent Changes
        var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
        var $rcMoveIndex;
        var $postParseLinkColour = true;
+       /**#@-*/
 
-       function Skin()
-       {
+       function Skin() {
+               global $wgUseOldExistenceCheck;
+               $postParseLinkColour = !$wgUseOldExistenceCheck;
                $this->linktrail = wfMsg('linktrail');
        }
 
-       function getSkinNames()
-       {
+       function getSkinNames() {
                global $wgValidSkinNames;
                return $wgValidSkinNames;
        }
 
-       function getStylesheet()
-       {
-               return 'wikistandard.css';
+       function getStylesheet() {
+               return 'common/wikistandard.css';
        }
+
        function getSkinName() {
-               return "standard";
+               return 'standard';
        }
 
-       # Get/set accessor for delayed link colouring
+       /**
+        * Get/set accessor for delayed link colouring
+        */
        function postParseLinkColour( $setting = NULL ) {
                return wfSetVar( $this->postParseLinkColour, $setting );
        }
 
-       function qbSetting()
-       {
+       function qbSetting() {
                global $wgOut, $wgUser;
 
                if ( $wgOut->isQuickbarSuppressed() ) { return 0; }
@@ -86,8 +126,7 @@ class Skin {
                return $q;
        }
 
-       function initPage( &$out )
-       {
+       function initPage( &$out ) {
                $fname = 'Skin::initPage';
                wfProfileIn( $fname );
 
@@ -165,7 +204,7 @@ class Skin {
 
        function getHeadScripts() {
                global $wgStylePath, $wgUser, $wgLang, $wgAllowUserJs;
-               $r = "<script type=\"text/javascript\" src=\"{$wgStylePath}/wikibits.js\"></script>\n";
+               $r = "<script type=\"text/javascript\" src=\"{$wgStylePath}/common/wikibits.js\"></script>\n";
                if( $wgAllowUserJs && $wgUser->getID() != 0 ) { # logged in
                        $userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
                        $userjs = htmlspecialchars($this->makeUrl($userpage.'/'.$this->getSkinName().'.js', 'action=raw&ctype=text/javascript'));
@@ -180,7 +219,7 @@ class Skin {
                $sheet = $this->getStylesheet();
                $action = $wgRequest->getText('action');
                $s = "@import \"$wgStylePath/$sheet\";\n";
-               if($wgLang->isRTL()) $s .= "@import \"$wgStylePath/common_rtl.css\";\n";
+               if($wgLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css\";\n";
                if( $wgAllowUserCss && $wgUser->getID() != 0 ) { # logged in
                        if($wgTitle->isCssSubpage() and $action == 'submit' and  $wgTitle->userCanEditCssJsSubpage()) {
                                $s .= $wgRequest->getText('wpTextbox1');
@@ -192,27 +231,32 @@ class Skin {
                $s .= $this->doGetUserStyles();
                return $s."\n";
        }
-       # placeholder, returns generated js in monobook
-       function getUserJs() {
-               return;
-       }
 
-       function getUserStyles()
-       {
+       /**
+        * placeholder, returns generated js in monobook
+        */
+       function getUserJs() { return; }
+
+       /**
+        * Return html code that include User stylesheets
+        */
+       function getUserStyles() {
                global $wgOut, $wgStylePath, $wgLang;
                $s = "<style type='text/css'>\n";
-               $s .= "/*/*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
+               $s .= "/*/*/ /*<![CDATA[*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
                $s .= $this->getUserStylesheet();
-               $s .= "/* */\n";
+               $s .= "/*]]>*/ /* */\n";
                $s .= "</style>\n";
                return $s;
        }
 
-       function doGetUserStyles()
-       {
+       /**
+        * Some styles that are set by user through the user settings interface.
+        */
+       function doGetUserStyles() {
                global $wgUser, $wgLang;
 
-               $csspage = $wgLang->getNsText( NS_MEDIAWIKI ) . ":" . $this->getSkinName() . ".css";
+               $csspage = $wgLang->getNsText( NS_MEDIAWIKI ) . ':' . $this->getSkinName() . '.css';
                $s = '@import "'.$this->makeUrl($csspage, 'action=raw&ctype=text/css')."\";\n";
 
                if ( 1 == $wgUser->getOption( 'underline' ) ) {
@@ -231,8 +275,7 @@ class Skin {
                return $s;
        }
 
-       function getBodyOptions()
-       {
+       function getBodyOptions() {
                global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $wgRequest;
 
                extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
@@ -260,14 +303,13 @@ class Skin {
                return $a;
        }
 
-       function getExternalLinkAttributes( $link, $text, $class='' )
-       {
+       function getExternalLinkAttributes( $link, $text, $class='' ) {
                global $wgUser, $wgOut, $wgLang;
 
                $link = urldecode( $link );
                $link = $wgLang->checkTitleEncoding( $link );
                $link = str_replace( '_', ' ', $link );
-               $link = wfEscapeHTML( $link );
+               $link = htmlspecialchars( $link );
 
                $r = ($class != '') ? " class='$class'" : " class='external'";
 
@@ -277,13 +319,12 @@ class Skin {
                return $r;
        }
 
-       function getInternalLinkAttributes( $link, $text, $broken = false )
-       {
+       function getInternalLinkAttributes( $link, $text, $broken = false ) {
                global $wgUser, $wgOut;
 
                $link = urldecode( $link );
                $link = str_replace( '_', ' ', $link );
-               $link = wfEscapeHTML( $link );
+               $link = htmlspecialchars( $link );
 
                if ( $broken == 'stub' ) {
                        $r = ' class="stub"';
@@ -299,8 +340,10 @@ class Skin {
                return $r;
        }
 
-       function getInternalLinkAttributesObj( &$nt, $text, $broken = false )
-       {
+       /**
+        * @param bool $broken
+        */
+       function getInternalLinkAttributesObj( &$nt, $text, $broken = false ) {
                global $wgUser, $wgOut;
 
                if ( $broken == 'stub' ) {
@@ -317,24 +360,25 @@ class Skin {
                return $r;
        }
 
-       function getLogo()
-       {
+       /**
+        * URL to the logo
+        */
+       function getLogo() {
                global $wgLogo;
                return $wgLogo;
        }
 
-       # This will be called immediately after the <body> tag.  Split into
-       # two functions to make it easier to subclass.
-       #
-       function beforeContent()
-       {
+       /**
+        * This will be called immediately after the <body> tag.  Split into
+        * two functions to make it easier to subclass.
+        */
+       function beforeContent() {
                global $wgUser, $wgOut;
 
                return $this->doBeforeContent();
        }
 
-       function doBeforeContent()
-       {
+       function doBeforeContent() {
                global $wgUser, $wgOut, $wgTitle, $wgLang, $wgSiteNotice;
                $fname = 'Skin::doBeforeContent';
                wfProfileIn( $fname );
@@ -410,10 +454,36 @@ class Skin {
                        wfMsg( 'categories' ), 'article=' . urlencode( $wgTitle->getPrefixedDBkey() ) )
                        . ': ' . $t;
 
+               # optional 'dmoz-like' category browser. Will be shown under the list
+               # of categories an article belong to
                if($wgUseCategoryBrowser) {
                        $s .= '<br/><hr/>';
-                       $catstack = array();
-                       $s.= $wgTitle->getAllParentCategories($catstack);
+
+                       # get a big array of the parents tree
+                       $parenttree = $wgTitle->getCategorieBrowser();
+
+                       # Render the array as a serie of links
+                       function walkThrough ($tree) {
+                               global $wgUser;
+                               $sk = $wgUser->getSkin();
+                               $return = '';
+                               foreach($tree as $element => $parent) {
+                                       if(empty($parent)) {
+                                               # element start a new list
+                                               $return .= '<br />';
+                                       } else {
+                                               # grab the others elements
+                                               $return .= walkThrough($parent);
+                                       }
+                                       # add our current element to the list
+                                       $eltitle = Title::NewFromText($element);
+                                       # FIXME : should be makeLink() [AV]
+                                       $return .= $sk->makeKnownLink($element, $eltitle->getText()).' &gt; ';
+                               }
+                               return $return;
+                       }
+
+                       $s .= walkThrough($parenttree);
                }
 
                return $s;
@@ -426,15 +496,13 @@ class Skin {
                }
        }
 
-       function getQuickbarCompensator( $rows = 1 )
-       {
+       function getQuickbarCompensator( $rows = 1 ) {
                return "<td width='152' rowspan='{$rows}'>&nbsp;</td>";
        }
 
        # This gets called immediately before the </body> tag.
        #
-       function afterContent()
-       {
+       function afterContent() {
                global $wgUser, $wgOut, $wgServer;
                global $wgTitle, $wgLang;
 
@@ -453,8 +521,7 @@ class Skin {
                        "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
        }
 
-       function doAfterContent()
-       {
+       function doAfterContent() {
                global $wgUser, $wgOut, $wgLang;
                $fname =  'Skin::doAfterContent';
                wfProfileIn( $fname );
@@ -501,8 +568,7 @@ class Skin {
                return $s;
        }
 
-       function pageTitleLinks()
-       {
+       function pageTitleLinks() {
                global $wgOut, $wgTitle, $wgUser, $wgLang, $wgUseApproval, $wgRequest;
 
                extract( $wgRequest->getValues( 'oldid', 'diff' ) );
@@ -514,7 +580,7 @@ class Skin {
                if ( $wgOut->isArticleRelated() ) {
                        if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
                                $name = $wgTitle->getDBkey();
-                               $link = wfEscapeHTML( Image::wfImageUrl( $name ) );
+                               $link = htmlspecialchars( Image::wfImageUrl( $name ) );
                                $style = $this->getInternalLinkAttributes( $link, $name );
                                $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
                        }
@@ -524,7 +590,7 @@ class Skin {
                                $t = $wgTitle->getDBkey();
                                $name = 'Approve this article' ;
                                $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
-                               #wfEscapeHTML( wfImageUrl( $name ) );
+                               #htmlspecialchars( wfImageUrl( $name ) );
                                $style = $this->getExternalLinkAttributes( $link, $name );
                                $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
                        }
@@ -545,6 +611,8 @@ class Skin {
                                                        Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
                                                wfMsg('newmessageslink') );
                                $s.= ' | <strong>'. wfMsg( 'newmessages', $tl ) . '</strong>';
+                               # disable caching
+                               $wgOut->setSquidMaxage(0);
                        }
                }
 
@@ -568,8 +636,7 @@ class Skin {
                return '';
        }
 
-       function printableLink()
-       {
+       function printableLink() {
                global $wgOut, $wgFeedClasses, $wgRequest;
 
                $baseurl = $_SERVER['REQUEST_URI'];
@@ -591,8 +658,7 @@ class Skin {
                return $s;
        }
 
-       function pageTitle()
-       {
+       function pageTitle() {
                global $wgOut, $wgTitle, $wgUser;
 
                $s = '<h1 class="pagetitle">' . htmlspecialchars( $wgOut->getPageTitle() ) . '</h1>';
@@ -600,14 +666,13 @@ class Skin {
                return $s;
        }
 
-       function pageSubtitle()
-       {
+       function pageSubtitle() {
                global $wgOut;
 
                $sub = $wgOut->getSubtitle();
                if ( '' == $sub ) {
                        global $wgExtraSubtitle;
-                       $sub = wfMsg( 'fromwikipedia' ) . $wgExtraSubtitle;
+                       $sub = wfMsg( 'tagline' ) . $wgExtraSubtitle;
                }
                $subpages = $this->subPageSubtitle();
                $sub .= !empty($subpages)?"</p><p class='subpages'>$subpages":'';
@@ -615,8 +680,7 @@ class Skin {
                return $s;
        }
 
-       function subPageSubtitle()
-       {
+       function subPageSubtitle() {
                global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
                $subpages = '';
                if($wgOut->isArticle() && !empty($wgNamespacesWithSubpages[$wgTitle->getNamespace()])) {
@@ -645,8 +709,7 @@ class Skin {
                return $subpages;
        }
 
-       function nameAndLogin()
-       {
+       function nameAndLogin() {
                global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader, $wgIP;
 
                $li = $wgLang->specialPage( 'Userlogin' );
@@ -703,8 +766,7 @@ class Skin {
                return htmlspecialchars( $this->getSearchLink() );
        }
 
-       function searchForm()
-       {
+       function searchForm() {
                global $wgRequest;
                $search = $wgRequest->getText( 'search' );
 
@@ -718,8 +780,7 @@ class Skin {
                return $s;
        }
 
-       function topLinks()
-       {
+       function topLinks() {
                global $wgOut;
                $sep = " |\n";
 
@@ -736,8 +797,7 @@ class Skin {
                return $s;
        }
 
-       function bottomLinks()
-       {
+       function bottomLinks() {
                global $wgOut, $wgUser, $wgTitle;
                $sep = " |\n";
 
@@ -778,8 +838,7 @@ class Skin {
                return $s;
        }
 
-       function pageStats()
-       {
+       function pageStats() {
                global $wgOut, $wgLang, $wgArticle, $wgRequest;
                global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax;
 
@@ -852,13 +911,12 @@ class Skin {
 
        function getPoweredBy() {
                global $wgStylePath;
-               $url = htmlspecialchars( "$wgStylePath/images/poweredby_mediawiki_88x31.png" );
+               $url = htmlspecialchars( "$wgStylePath/common/images/poweredby_mediawiki_88x31.png" );
                $img = '<a href="http://www.mediawiki.org/"><img src="'.$url.'" alt="MediaWiki" /></a>';
                return $img;
        }
 
-       function lastModified()
-       {
+       function lastModified() {
                global $wgLang, $wgArticle;
 
                $timestamp = $wgArticle->getTimestamp();
@@ -871,21 +929,24 @@ class Skin {
                return $s;
        }
 
-       function logoText( $align = '' )
-       {
-               if ( '' != $align ) { $a = ' align="'.$align.'"'; }
+       function logoText( $align = '' ) {
+               if ( '' != $align ) { $a = " align='{$align}'"; }
                else { $a = ''; }
 
                $mp = wfMsg( 'mainpage' );
                $titleObj = Title::newFromText( $mp );
-               $s = '<a href="' . $titleObj->escapeLocalURL()
-                 . '"><img'.$a.' src="'
-                 . $this->getLogo() . '" alt="' . "[{$mp}]\" /></a>";
+               if ( is_object( $titleObj ) ) {
+                       $url = $titleObj->escapeLocalURL();
+               } else {
+                       $url = '';
+               }
+
+               $logourl = $this->getLogo();
+               $s = "<a href='{$url}'><img{$a} src='{$logourl}' alt='[{$mp}]' /></a>";
                return $s;
        }
 
-       function quickBar()
-       {
+       function quickBar() {
                global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang;
                global $wgDisableUploads, $wgRemoteUploads;
 
@@ -1030,8 +1091,7 @@ class Skin {
                return $s;
        }
 
-       function specialPagesList()
-       {
+       function specialPagesList() {
                global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
                require_once('SpecialPage.php');
                $a = array();
@@ -1071,37 +1131,32 @@ class Skin {
                return $s;
        }
 
-       function mainPageLink()
-       {
+       function mainPageLink() {
                $mp = wfMsg( 'mainpage' );
                $s = $this->makeKnownLink( $mp, $mp );
                return $s;
        }
 
-       function copyrightLink()
-       {
+       function copyrightLink() {
                $s = $this->makeKnownLink( wfMsg( 'copyrightpage' ),
                  wfMsg( 'copyrightpagename' ) );
                return $s;
        }
 
-       function aboutLink()
-       {
+       function aboutLink() {
                $s = $this->makeKnownLink( wfMsg( 'aboutpage' ),
-                 wfMsg( 'aboutwikipedia' ) );
+                 wfMsg( 'aboutsite' ) );
                return $s;
        }
 
 
-      function disclaimerLink()
-       {
+       function disclaimerLink() {
                $s = $this->makeKnownLink( wfMsg( 'disclaimerpage' ),
                  wfMsg( 'disclaimers' ) );
                return $s;
        }
 
-       function editThisPage()
-       {
+       function editThisPage() {
                global $wgOut, $wgTitle, $wgRequest;
 
                $oldid = $wgRequest->getVal( 'oldid' );
@@ -1122,15 +1177,14 @@ class Skin {
 
                        if ( !is_null( $redirect ) ) { $red = "&redirect={$redirect}"; }
                        if ( $oldid && ! isset( $diff ) ) {
-                               $oid = "&oldid={$oldid}";
+                               $oid = '&oldid='.$oldid;
                        }
                        $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
                }
                return $s;
        }
 
-       function deleteThisPage()
-       {
+       function deleteThisPage() {
                global $wgUser, $wgOut, $wgTitle, $wgRequest;
 
                $diff = $wgRequest->getVal( 'diff' );
@@ -1145,8 +1199,7 @@ class Skin {
                return $s;
        }
 
-       function protectThisPage()
-       {
+       function protectThisPage() {
                global $wgUser, $wgOut, $wgTitle, $wgRequest;
 
                $diff = $wgRequest->getVal( 'diff' );
@@ -1167,8 +1220,7 @@ class Skin {
                return $s;
        }
 
-       function watchThisPage()
-       {
+       function watchThisPage() {
                global $wgUser, $wgOut, $wgTitle;
 
                if ( $wgOut->isArticleRelated() ) {
@@ -1188,8 +1240,7 @@ class Skin {
                return $s;
        }
 
-       function moveThisPage()
-       {
+       function moveThisPage() {
                global $wgTitle, $wgLang;
 
                if ( $wgTitle->userCanEdit() ) {
@@ -1199,8 +1250,7 @@ class Skin {
                return $s;
        }
 
-       function historyLink()
-       {
+       function historyLink() {
                global $wgTitle;
 
                $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
@@ -1208,8 +1258,7 @@ class Skin {
                return $s;
        }
 
-       function whatLinksHere()
-       {
+       function whatLinksHere() {
                global $wgTitle, $wgLang;
 
                $s = $this->makeKnownLink( $wgLang->specialPage( 'Whatlinkshere' ),
@@ -1217,8 +1266,7 @@ class Skin {
                return $s;
        }
 
-       function userContribsLink()
-       {
+       function userContribsLink() {
                global $wgTitle, $wgLang;
 
                $s = $this->makeKnownLink( $wgLang->specialPage( 'Contributions' ),
@@ -1226,8 +1274,7 @@ class Skin {
                return $s;
        }
 
-       function emailUserLink()
-       {
+       function emailUserLink() {
                global $wgTitle, $wgLang;
 
                $s = $this->makeKnownLink( $wgLang->specialPage( 'Emailuser' ),
@@ -1235,8 +1282,7 @@ class Skin {
                return $s;
        }
 
-       function watchPageLinksLink()
-       {
+       function watchPageLinksLink() {
                global $wgOut, $wgTitle, $wgLang;
 
                if ( ! $wgOut->isArticleRelated() ) {
@@ -1249,8 +1295,7 @@ class Skin {
                return $s;
        }
 
-       function otherLanguages()
-       {
+       function otherLanguages() {
                global $wgOut, $wgLang, $wgTitle, $wgUseNewInterlanguage;
 
                $a = $wgOut->getLanguageLinks();
@@ -1293,15 +1338,13 @@ class Skin {
                return $s;
        }
 
-       function bugReportsLink()
-       {
+       function bugReportsLink() {
                $s = $this->makeKnownLink( wfMsg( 'bugreportspage' ),
                  wfMsg( 'bugreports' ) );
                return $s;
        }
 
-       function dateLink()
-       {
+       function dateLink() {
                global $wgLinkCache;
                $t1 = Title::newFromText( gmdate( 'F j' ) );
                $t2 = Title::newFromText( gmdate( 'Y' ) );
@@ -1329,8 +1372,7 @@ class Skin {
                return $s;
        }
 
-       function talkLink()
-       {
+       function talkLink() {
                global $wgLang, $wgTitle, $wgLinkCache;
 
                $tns = $wgTitle->getNamespace();
@@ -1372,8 +1414,7 @@ class Skin {
                return $s;
        }
 
-       function commentLink()
-       {
+       function commentLink() {
                global $wgLang, $wgTitle, $wgLinkCache;
 
                $tns = $wgTitle->getNamespace();
@@ -1395,17 +1436,19 @@ class Skin {
                return $s;
        }
 
-       # After all the page content is transformed into HTML, it makes
-       # a final pass through here for things like table backgrounds.
-       #
-       function transformContent( $text )
-       {
+       /**
+        * After all the page content is transformed into HTML, it makes
+        * a final pass through here for things like table backgrounds.
+        * @todo probably deprecated [AV]
+        */
+       function transformContent( $text ) {
                return $text;
        }
 
-       # Note: This function MUST call getArticleID() on the link,
-       # otherwise the cache won't get updated properly.  See LINKCACHE.DOC.
-       #
+       /**
+        * Note: This function MUST call getArticleID() on the link,
+        * otherwise the cache won't get updated properly.  See LINKCACHE.DOC.
+        */
        function makeLink( $title, $text = '', $query = '', $trail = '' ) {
                wfProfileIn( 'Skin::makeLink' );
                $nt = Title::newFromText( $title );
@@ -1450,9 +1493,10 @@ class Skin {
                }
        }
 
-       # Pass a title object, not a title string
-       function makeLinkObj( &$nt, $text= '', $query = '', $trail = '', $prefix = '' )
-       {
+       /**
+        * Pass a title object, not a title string
+        */
+       function makeLinkObj( &$nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
                global $wgOut, $wgUser;
                $fname = 'Skin::makeLinkObj';
 
@@ -1526,9 +1570,10 @@ class Skin {
                return $retVal;
        }
 
-       # Pass a title object, not a title string
-       function makeKnownLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '')
-       {
+       /**
+        * Pass a title object, not a title string
+        */
+       function makeKnownLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '' ) {
                global $wgOut, $wgTitle, $wgInputEncoding;
 
                $fname = 'Skin::makeKnownLinkObj';
@@ -1538,6 +1583,8 @@ class Skin {
                        return $text;
                }
                $link = $nt->getPrefixedURL();
+#              if ( '' != $section && substr($section,0,1) != "#" ) {
+#                      $section = ''
 
                if ( '' == $link ) {
                        $u = '';
@@ -1572,11 +1619,16 @@ class Skin {
                return $r;
        }
 
-       # Pass a title object, not a title string
-       function makeBrokenLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' )
-       {
+       /**
+        * Pass a title object, not a title string
+        */
+       function makeBrokenLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
                global $wgOut, $wgUser;
 
+               # Fail gracefully
+               if ( ! isset($nt) )
+                       return "<!-- ERROR -->{$prefix}{$text}{$trail}";
+
                $fname = 'Skin::makeBrokenLinkObj';
                wfProfileIn( $fname );
 
@@ -1609,9 +1661,10 @@ class Skin {
                return $s;
        }
 
-       # Pass a title object, not a title string
-       function makeStubLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' )
-       {
+       /**
+        * Pass a title object, not a title string
+        */
+       function makeStubLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
                global $wgOut, $wgUser;
 
                $link = $nt->getPrefixedURL();
@@ -1638,8 +1691,7 @@ class Skin {
                return $s;
        }
 
-       function makeSelfLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' )
-       {
+       function makeSelfLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
                $u = $nt->escapeLocalURL( $query );
                if ( '' == $text ) {
                        $text = htmlspecialchars( $nt->getPrefixedText() );
@@ -1684,7 +1736,7 @@ class Skin {
        }
        # this can be passed the NS number as defined in Language.php
        /*static*/ function makeNSUrl( $name, $urlaction='', $namespace=0 ) {
-               $title = Title::makeTitle( $namespace, $name );
+               $title = Title::makeTitleSafe( $namespace, $name );
                $this->checkTitle($title, $name);
                return $title->getLocalURL( $urlaction );
        }
@@ -1735,25 +1787,28 @@ class Skin {
                }
        }
 
-       function fnamePart( $url )
-       {
+       function fnamePart( $url ) {
                $basename = strrchr( $url, '/' );
-               if ( false === $basename ) { $basename = $url; }
-               else { $basename = substr( $basename, 1 ); }
-               return wfEscapeHTML( $basename );
+               if ( false === $basename ) {
+                       $basename = $url;
+               } else {
+                       $basename = substr( $basename, 1 );
+               }
+               return htmlspecialchars( $basename );
        }
 
-       function makeImage( $url, $alt = '' )
-       {
+       function makeImage( $url, $alt = '' ) {
                global $wgOut;
 
-               if ( '' == $alt ) { $alt = $this->fnamePart( $url ); }
+               if ( '' == $alt ) {
+                       $alt = $this->fnamePart( $url );
+               }
                $s = '<img src="'.$url.'" alt="'.$alt.'" />';
                return $s;
        }
 
        function makeImageLink( $name, $url, $alt = '' ) {
-               $nt = Title::makeTitle( Namespace::getImage(), $name );
+               $nt = Title::makeTitleSafe( NS_IMAGE, $name );
                return $this->makeImageLinkObj( $nt, $alt );
        }
 
@@ -1882,11 +1937,13 @@ class Skin {
                return str_replace("\n", ' ',$prefix.$s.$postfix);
        }
 
-       # Make HTML for a thumbnail including image, border and caption
-       # $img is an Image object
+       /**
+        * Make HTML for a thumbnail including image, border and caption
+        * $img is an Image object
+        */
        function makeThumbLinkObj( $img, $label = '', $align = 'right', $boxwidth = 180, $boxheight=false, $framed=false , $manual_thumb = "" ) {
                global $wgStylePath, $wgLang;
-               # $image = Title::makeTitle( Namespace::getImage(), $name );
+               # $image = Title::makeTitleSafe( NS_IMAGE, $name );
                $url  = $img->getURL();
 
                #$label = htmlspecialchars( $label );
@@ -1928,7 +1985,7 @@ class Skin {
 
                if ( $manual_thumb != '' ) # Use manually specified thumbnail
                {
-                       $manual_title = Title::makeTitle( Namespace::getImage(), $manual_thumb ); #new Title ( $manual_thumb ) ;
+                       $manual_title = Title::makeTitleSafe( NS_IMAGE, $manual_thumb ); #new Title ( $manual_thumb ) ;
                        $manual_img = Image::newFromTitle( $manual_title );
                        $thumbUrl = $manual_img->getURL();
                        if ( $manual_img->exists() )
@@ -1960,7 +2017,7 @@ class Skin {
                        } else {
                                $zoomicon =  '<div class="magnify" style="float:'.$magnifyalign.'">'.
                                        '<a href="'.$u.'" class="internal" title="'.$more.'">'.
-                                       '<img src="'.$wgStylePath.'/images/magnify-clip.png" ' .
+                                       '<img src="'.$wgStylePath.'/common/images/magnify-clip.png" ' .
                                        'width="15" height="11" alt="'.$more.'" /></a></div>';
                        }
                }
@@ -1968,13 +2025,12 @@ class Skin {
                return str_replace("\n", ' ', $s);
        }
 
-       function makeMediaLink( $name, $url, $alt = "" ) {
-               $nt = Title::makeTitle( Namespace::getMedia(), $name );
+       function makeMediaLink( $name, $url, $alt = '' ) {
+               $nt = Title::makeTitleSafe( Namespace::getMedia(), $name );
                return $this->makeMediaLinkObj( $nt, $alt );
        }
 
-       function makeMediaLinkObj( $nt, $alt = "" )
-       {
+       function makeMediaLinkObj( $nt, $alt = '' ) {
                if ( ! isset( $nt ) )
                {
                        ### HOTFIX. Instead of breaking, return empty string.
@@ -1992,8 +2048,7 @@ class Skin {
                return $s;
        }
 
-       function specialLink( $name, $key = "" )
-       {
+       function specialLink( $name, $key = '' ) {
                global $wgLang;
 
                if ( '' == $key ) { $key = strtolower( $name ); }
@@ -2015,8 +2070,7 @@ class Skin {
        #
 
        # Returns text for the start of the tabular part of RC
-       function beginRecentChangesList()
-       {
+       function beginRecentChangesList() {
                $this->rc_cache = array() ;
                $this->rcMoveIndex = 0;
                $this->rcCacheIndex = 0 ;
@@ -2025,17 +2079,17 @@ class Skin {
                return '';
        }
 
-       function beginImageHistoryList()
-       {
+       function beginImageHistoryList() {
                $s = "\n<h2>" . wfMsg( 'imghistory' ) . "</h2>\n" .
                  "<p>" . wfMsg( 'imghistlegend' ) . "</p>\n".'<ul class="special">';
                return $s;
        }
 
-       # Returns text for the end of RC
-       # If enhanced RC is in use, returns pretty much all the text
-       function endRecentChangesList()
-       {
+       /**
+        * Returns text for the end of RC
+        * If enhanced RC is in use, returns pretty much all the text
+        */
+       function endRecentChangesList() {
                $s = $this->recentChangesBlock() ;
                if( $this->rclistOpen ) {
                        $s .= "</ul>\n";
@@ -2043,9 +2097,10 @@ class Skin {
                return $s;
        }
 
-       # Enhanced RC ungrouped line
-       function recentChangesBlockLine ( $rcObj )
-       {
+       /**
+        * Enhanced RC ungrouped line
+        */
+       function recentChangesBlockLine ( $rcObj ) {
                global $wgStylePath, $wgLang ;
 
                # Get rc_xxxx variables
@@ -2055,7 +2110,7 @@ class Skin {
                # Spacer image
                $r = '' ;
 
-               $r .= '<img src="'.$wgStylePath.'/images/Arr_.png" width="12" height="12" border="0" />' ;
+               $r .= '<img src="'.$wgStylePath.'/common/images/Arr_.png" width="12" height="12" border="0" />' ;
                $r .= '<tt>' ;
 
                if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
@@ -2100,7 +2155,7 @@ class Skin {
 
                # Comment
                 if ( $rc_comment != '' && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
-                       $rc_comment=$this->formatComment($rc_comment);
+                       $rc_comment=$this->formatComment($rc_comment, $rcObj->getTitle());
                        $r .= $wgLang->emphasize( ' ('.$rc_comment.')' );
                }
 
@@ -2108,9 +2163,10 @@ class Skin {
                return $r ;
        }
 
-       # Enhanced RC group
-       function recentChangesBlockGroup ( $block )
-       {
+       /**
+        * Enhanced RC group
+        */
+       function recentChangesBlockGroup ( $block ) {
                global $wgStylePath, $wgLang ;
 
                $r = '' ;
@@ -2145,8 +2201,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="'.$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>' ;
+               $tl  = '<span id="'.$rcm.'"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_'.$arrowdir.'.png" width="12" height="12" /></a></span>' ;
+               $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_d.png" width="12" height="12" /></a></span>' ;
                $r .= $tl ;
 
                # Main line
@@ -2188,7 +2244,7 @@ class Skin {
                        # Get rc_xxxx variables
                        extract( $rcObj->mAttribs );
 
-                       $r .= '<img src="'.$wgStylePath.'/images/Arr_.png" width="12" height="12" />';
+                       $r .= '<img src="'.$wgStylePath.'/common/images/Arr_.png" width="12" height="12" />';
                        $r .= '<tt>&nbsp; &nbsp; &nbsp; &nbsp;' ;
                        if ( $rc_new ) $r .= $N ;
                        else $r .= '&nbsp;' ;
@@ -2215,7 +2271,7 @@ class Skin {
                        $r .= ') . . '.$rcObj->userlink ;
                        $r .= $rcObj->usertalklink ;
                        if ( $rc_comment != '' ) {
-                               $rc_comment=$this->formatComment($rc_comment);
+                               $rc_comment=$this->formatComment($rc_comment, $rcObj->getTitle());
                                $r .= $wgLang->emphasize( ' ('.$rc_comment.')' ) ;
                        }
                        $r .= "<br />\n" ;
@@ -2226,10 +2282,11 @@ class Skin {
                return $r ;
        }
 
-       # If enhanced RC is in use, this function takes the previously cached
-       # RC lines, arranges them, and outputs the HTML
-       function recentChangesBlock ()
-       {
+       /**
+        * If enhanced RC is in use, this function takes the previously cached
+        * RC lines, arranges them, and outputs the HTML
+        */
+       function recentChangesBlock () {
                global $wgStylePath ;
                if ( count ( $this->rc_cache ) == 0 ) return '' ;
                $blockOut = '';
@@ -2244,10 +2301,11 @@ class Skin {
                return '<div>'.$blockOut.'</div>' ;
        }
 
-       # Called in a loop over all displayed RC entries
-       # Either returns the line, or caches it for later use
-       function recentChangesLine( &$rc, $watched = false )
-       {
+       /**
+        * Called in a loop over all displayed RC entries
+        * Either returns the line, or caches it for later use
+        */
+       function recentChangesLine( &$rc, $watched = false ) {
                global $wgUser ;
                $usenew = $wgUser->getOption( 'usenewrc' );
                if ( $usenew )
@@ -2257,8 +2315,7 @@ class Skin {
                return $line ;
        }
 
-       function recentChangesLineOld( &$rc, $watched = false )
-       {
+       function recentChangesLineOld( &$rc, $watched = false ) {
                global $wgTitle, $wgLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
 
                # Extract DB fields into local scope
@@ -2289,6 +2346,11 @@ class Skin {
                        $msg = ( $rc_type == RC_MOVE ) ? '1movedto2' : '1movedto2_redir';
                        $s .= wfMsg( $msg, $this->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
                                $this->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
+               } elseif( $rc_namespace == NS_SPECIAL && preg_match( '!^Log/(.*)$!', $rc_title, $matches ) ) {
+                       # Log updates, etc
+                       $logtype = $matches[1];
+                       $logname = LogPage::logName( $logtype );
+                       $s .= '(' . $this->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
                } else {
                        # Diff link
                        if ( $rc_type == RC_NEW || $rc_type == RC_LOG ) {
@@ -2365,7 +2427,7 @@ class Skin {
 
                # Add comment
                if ( '' != $rc_comment && '*' != $rc_comment && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
-                       $rc_comment=$this->formatComment($rc_comment);
+                       $rc_comment=$this->formatComment($rc_comment,$rc->getTitle());
                        $s .= $wgLang->emphasize(' (' . $rc_comment . ')');
                }
                $s .= "</li>\n";
@@ -2373,8 +2435,7 @@ class Skin {
                return $s;
        }
 
-       function recentChangesLineNew( &$baseRC, $watched = false )
-       {
+       function recentChangesLineNew( &$baseRC, $watched = false ) {
                global $wgTitle, $wgLang, $wgUser, $wgRCSeconds;
 
                # Create a specialised object
@@ -2400,6 +2461,11 @@ class Skin {
                        $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
                        $clink = wfMsg( $msg, $this->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
                          $this->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
+               } elseif( $rc_namespace == NS_SPECIAL && preg_match( '!^Log/(.*)$!', $rc_title, $matches ) ) {
+                       # Log updates, etc
+                       $logtype = $matches[1];
+                       $logname = LogPage::logName( $logtype );
+                       $clink = '(' . $this->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
                } else {
                        $clink = $this->makeKnownLinkObj( $rc->getTitle(), '' ) ;
                }
@@ -2477,22 +2543,28 @@ class Skin {
                return $ret;
        }
 
-       function endImageHistoryList()
-       {
+       function endImageHistoryList() {
                $s = "</ul>\n";
                return $s;
        }
 
-       /* This function is called by all recent changes variants, by the page history,
-          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)
-       */
-       function formatComment($comment)
-       {
+       /**
+        * This function is called by all recent changes variants, by the page history,
+        * 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]].
+        *
+        * The &$title parameter must be a title OBJECT. It is used to generate a
+        * direct link to the section in the autocomment.
+        * @author Erik Moeller <moeller@scireview.de>
+        *
+        * Note: there's not always a title to pass to this function.
+        * Since you can't set a default parameter for a reference, I've turned it
+        * temporarily to a value pass. Should be adjusted further. --brion
+        */
+       function formatComment($comment, $title = NULL) {
                global $wgLang;
-               $comment=wfEscapeHTML($comment);
+               $comment = htmlspecialchars( $comment );
 
                # The pattern for autogen comments is / * foo * /, which makes for
                # some nasty regex.
@@ -2502,7 +2574,18 @@ class Skin {
                        $pre=$match[1];
                        $auto=$match[2];
                        $post=$match[3];
+                       $link='';
+                       if($title) {
+                               $section=$auto;
+
+                               # This is hackish but should work in most cases.
+                               $section=str_replace('[[','',$section);
+                               $section=str_replace(']]','',$section);
+                               $title->mFragment=$section;
+                               $link=$this->makeKnownLinkObj($title,wfMsg('sectionlink'));
+                       }
                        $sep='-';
+                       $auto=$link.$auto;
                        if($pre) { $auto = $sep.' '.$auto; }
                        if($post) { $auto .= ' '.$sep; }
                        $auto='<span class="autocomment">'.$auto.'</span>';
@@ -2531,6 +2614,8 @@ class Skin {
                                        $trail = "";
                                }
                                $linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/';
+                               if ($match[1][0] == ':')
+                                       $match[1] = substr($match[1], 1);
                                $thelink = $this->makeLink( $match[1], $text, "", $trail );
                        }
                        $comment = preg_replace( $linkRegexp, $thelink, $comment, 1 );
@@ -2538,8 +2623,7 @@ class Skin {
                return $comment;
        }
 
-       function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description )
-       {
+       function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description ) {
                global $wgUser, $wgLang, $wgTitle;
 
                $datetime = $wgLang->timeanddate( $timestamp, true );
@@ -2560,7 +2644,7 @@ class Skin {
                                $dlink = $del;
                        }
                } else {
-                       $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
+                       $url = htmlspecialchars( wfImageArchiveUrl( $img ) );
                        if( $wgUser->getID() != 0 && $wgTitle->userCanEdit() ) {
                                $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
                                           wfMsg( 'revertimg' ), 'action=revert&oldimage=' .
@@ -2589,7 +2673,7 @@ class Skin {
 
                if ( '' != $description && '*' != $description ) {
                        $sk=$wgUser->getSkin();
-                       $s .= $wgLang->emphasize(' (' . $sk->formatComment($description) . ')');
+                       $s .= $wgLang->emphasize(' (' . $sk->formatComment($description,$wgTitle) . ')');
                }
                $s .= "</li>\n";
                return $s;
@@ -2603,7 +2687,9 @@ class Skin {
                return str_repeat( "</div>\n", $level>0 ? $level : 0 );
        }
 
-       # parameter level defines if we are on an indentation level
+       /**
+        * parameter level defines if we are on an indentation level
+        */
        function tocLine( $anchor, $tocline, $level ) {
                $link = '<a href="#'.$anchor.'">'.$tocline.'</a><br />';
                if($level) {
@@ -2626,7 +2712,10 @@ class Skin {
                $toc."</td></tr></table>\n";
        }
 
-       # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
+       /**
+        * These two do not check for permissions: check $wgTitle->userCanEdit
+        * before calling them
+        */
        function editSectionScript( $section, $head ) {
                global $wgTitle, $wgRequest;
                if( $wgRequest->getInt( 'oldid' ) && ( $wgRequest->getVal( 'diff' ) != '0' ) ) {
@@ -2661,98 +2750,103 @@ class Skin {
 
        }
 
-       // This function is called by EditPage.php and shows a bulletin board style
-       // toolbar for common editing functions. It can be disabled in the user preferences.
-       // The necsesary JavaScript code can be found in style/wikibits.js.
+       /**
+        * This function is called by EditPage.php and shows a bulletin board style
+        * toolbar for common editing functions. It can be disabled in the user
+        * preferences.
+        * The necessary JavaScript code can be found in style/wikibits.js.
+        */
        function getEditToolbar() {
                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,
-               // and optionally a sample text that is inserted between the two when no
-               // selection is highlighted.
-               // The tip text is shown when the user moves the mouse over the button.
-
-               // Already here are accesskeys (key), which are not used yet until someone
-               // can figure out a way to make them work in IE. However, we should make
-               // sure these keys are not defined on the edit page.
+               /**
+                * toolarray an array of arrays which each include the filename of
+                * the button image (without path), the opening tag, the closing tag,
+                * and optionally a sample text that is inserted between the two when no
+                * selection is highlighted.
+                * The tip text is shown when the user moves the mouse over the button.
+                *
+                * Already here are accesskeys (key), which are not used yet until someone
+                * can figure out a way to make them work in IE. However, we should make
+                * sure these keys are not defined on the edit page.
+                */
                $toolarray=array(
                        array(  'image'=>'button_bold.png',
-                               'open'=>"\'\'\'",
-                               'close'=>"\'\'\'",
-                               'sample'=>wfMsg('bold_sample'),
-                               'tip'=>wfMsg('bold_tip'),
-                               'key'=>'B'
+                                       'open'  =>      "\'\'\'",
+                                       'close' =>      "\'\'\'",
+                                       'sample'=>      wfMsg('bold_sample'),
+                                       'tip'   =>      wfMsg('bold_tip'),
+                                       'key'   =>      'B'
                                ),
-                       array(  "image"=>"button_italic.png",
-                               "open"=>"\'\'",
-                               "close"=>"\'\'",
-                               "sample"=>wfMsg("italic_sample"),
-                               "tip"=>wfMsg("italic_tip"),
-                               "key"=>"I"
+                       array(  'image'=>'button_italic.png',
+                                       'open'  =>      "\'\'",
+                                       'close' =>      "\'\'",
+                                       'sample'=>      wfMsg('italic_sample'),
+                                       'tip'   =>      wfMsg('italic_tip'),
+                                       'key'   =>      'I'
                                ),
-                       array(  "image"=>"button_link.png",
-                               "open"=>"[[",
-                               "close"=>"]]",
-                               "sample"=>wfMsg("link_sample"),
-                               "tip"=>wfMsg("link_tip"),
-                               "key"=>"L"
+                       array(  'image'=>'button_link.png',
+                                       'open'  =>      '[[',
+                                       'close' =>      ']]',
+                                       'sample'=>      wfMsg('link_sample'),
+                                       'tip'   =>      wfMsg('link_tip'),
+                                       'key'   =>      'L'
                                ),
-                       array(  "image"=>"button_extlink.png",
-                               "open"=>"[",
-                               "close"=>"]",
-                               "sample"=>wfMsg("extlink_sample"),
-                               "tip"=>wfMsg("extlink_tip"),
-                               "key"=>"X"
+                       array(  'image'=>'button_extlink.png',
+                                       'open'  =>      '[',
+                                       'close' =>      ']',
+                                       'sample'=>      wfMsg('extlink_sample'),
+                                       'tip'   =>      wfMsg('extlink_tip'),
+                                       'key'   =>      'X'
                                ),
-                       array(  "image"=>"button_headline.png",
-                               "open"=>"\\n== ",
-                               "close"=>" ==\\n",
-                               "sample"=>wfMsg("headline_sample"),
-                               "tip"=>wfMsg("headline_tip"),
-                               "key"=>"H"
+                       array(  'image'=>'button_headline.png',
+                                       'open'  =>      "\\n== ",
+                                       'close' =>      " ==\\n",
+                                       'sample'=>      wfMsg('headline_sample'),
+                                       'tip'   =>      wfMsg('headline_tip'),
+                                       'key'   =>      'H'
                                ),
-                       array(  "image"=>"button_image.png",
-                               "open"=>"[[".$wgLang->getNsText(NS_IMAGE).":",
-                               "close"=>"]]",
-                               "sample"=>wfMsg("image_sample"),
-                               "tip"=>wfMsg("image_tip"),
-                               "key"=>"D"
+                       array(  'image'=>'button_image.png',
+                                       'open'  =>      '[['.$wgLang->getNsText(NS_IMAGE).":",
+                                       'close' =>      ']]',
+                                       'sample'=>      wfMsg('image_sample'),
+                                       'tip'   =>      wfMsg('image_tip'),
+                                       'key'   =>      'D'
                                ),
-                       array(  "image"=>"button_media.png",
-                               "open"=>"[[".$wgLang->getNsText(NS_MEDIA).":",
-                               "close"=>"]]",
-                               "sample"=>wfMsg("media_sample"),
-                               "tip"=>wfMsg("media_tip"),
-                               "key"=>"M"
+                       array(  'image' =>      'button_media.png',
+                                       'open'  =>      '[['.$wgLang->getNsText(NS_MEDIA).':',
+                                       'close' =>      ']]',
+                                       'sample'=>      wfMsg('media_sample'),
+                                       'tip'   =>      wfMsg('media_tip'),
+                                       'key'   =>      'M'
                                ),
-                       array(  "image"=>"button_math.png",
-                               "open"=>"\\<math\\>",
-                               "close"=>"\\</math\\>",
-                               "sample"=>wfMsg("math_sample"),
-                               "tip"=>wfMsg("math_tip"),
-                               "key"=>"C"
+                       array(  'image' =>      'button_math.png',
+                                       'open'  =>      "\\<math\\>",
+                                       'close' =>      "\\</math\\>",
+                                       'sample'=>      wfMsg('math_sample'),
+                                       'tip'   =>      wfMsg('math_tip'),
+                                       'key'   =>      'C'
                                ),
-                       array(  "image"=>"button_nowiki.png",
-                               "open"=>"\\<nowiki\\>",
-                               "close"=>"\\</nowiki\\>",
-                               "sample"=>wfMsg("nowiki_sample"),
-                               "tip"=>wfMsg("nowiki_tip"),
-                               "key"=>"N"
+                       array(  'image' =>      'button_nowiki.png',
+                                       'open'  =>      "\\<nowiki\\>",
+                                       'close' =>      "\\</nowiki\\>",
+                                       'sample'=>      wfMsg('nowiki_sample'),
+                                       'tip'   =>      wfMsg('nowiki_tip'),
+                                       'key'   =>      'N'
                                ),
-                       array(  "image"=>"button_sig.png",
-                               "open"=>"--~~~~",
-                               "close"=>"",
-                               "sample"=>"",
-                               "tip"=>wfMsg("sig_tip"),
-                               "key"=>"Y"
+                       array(  'image' =>      'button_sig.png',
+                                       'open'  =>      '--~~~~',
+                                       'close' =>      '',
+                                       'sample'=>      '',
+                                       'tip'   =>      wfMsg('sig_tip'),
+                                       'key'   =>      'Y'
                                ),
-                       array(  "image"=>"button_hr.png",
-                               "open"=>"\\n----\\n",
-                               "close"=>"",
-                               "sample"=>"",
-                               "tip"=>wfMsg("hr_tip"),
-                               "key"=>"R"
+                       array(  'image' =>      'button_hr.png',
+                                       'open'  =>      "\\n----\\n",
+                                       'close' =>      '',
+                                       'sample'=>      '',
+                                       'tip'   =>      wfMsg('hr_tip'),
+                                       'key'   =>      'R'
                                )
                );
                $toolbar ="<script type='text/javascript'>\n/*<![CDATA[*/\n";
@@ -2760,7 +2854,7 @@ class Skin {
                $toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
                foreach($toolarray as $tool) {
 
-                       $image=$wgStylePath.'/images/'.$tool['image'];
+                       $image=$wgStylePath.'/common/images/'.$tool['image'];
                        $open=$tool['open'];
                        $close=$tool['close'];
                        $sample = addslashes( $tool['sample'] );
@@ -2783,6 +2877,12 @@ class Skin {
                return $toolbar;
        }
 
+       /**
+        * @access public
+        */
+       function suppressUrlExpansion() {
+               return false;
+       }
 }
 
 }