include_once -> require_once
[lhc/web/wiklou.git] / includes / Skin.php
index de5b001..2720aff 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-include_once( "Feed.php" );
+require_once( "Feed.php" );
+require_once( "Image.php" );
 
 # See skin.doc
 
@@ -21,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
 {
@@ -166,18 +151,18 @@ 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;
                $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";
                $s .= $this->doGetUserStyles();
                $s .= "/* */\n";
                $s .= "</style>\n";
@@ -367,10 +352,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 )
        {
@@ -451,12 +450,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>";
                        }
@@ -534,17 +533,26 @@ class Skin {
 
        function pageSubtitle()
        {
-               global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
+               global $wgOut;
 
                $sub = $wgOut->getSubtitle();
                if ( "" == $sub ) {
                        global $wgExtraSubtitle;
                        $sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
                }
+               $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="";
@@ -555,19 +563,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()
@@ -618,15 +624,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;"
@@ -699,7 +713,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 ""; }
@@ -712,10 +726,95 @@ class Skin {
                                $s = wfMsg( "viewcount", $count );
                        }
                }
-               $s .= $this->lastModified();
+
+               $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 = "";
@@ -750,8 +849,8 @@ class Skin {
        }
        
        function getPoweredBy() {
-               global $wgUploadPath;
-               $url = htmlspecialchars( "$wgUploadPath/poweredby_mediawiki_88x31.png" );
+               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;
        }
@@ -809,7 +908,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) {                            
@@ -1514,6 +1613,61 @@ 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 ); 
+       }
+
+       # make sure we have some title to operate on, mind the '&'
+       /*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 )
        {
@@ -1539,8 +1693,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 = "";
 
@@ -1552,6 +1707,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);
        
@@ -1561,9 +1718,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;
+                       $framed=$thumb=false;
 
                        foreach( $part as $key => $val ) {
                                if ( ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
@@ -1583,6 +1741,8 @@ class Skin {
                                } elseif ( ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {
                                        # $match is the image width in pixels
                                        $width = intval($match);
+                               } elseif ( ! is_null( $mwFramed->matchVariableStartToEnd($val) ) ) {
+                                       $framed=true;
                                }
                        }
                        if ( "center" == $align )
@@ -1592,7 +1752,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-
@@ -1607,25 +1767,26 @@ class Skin {
                                if ( ! isset($width) ) {
                                        $width = 180;
                                }
-                               return $prefix.$this->makeThumbLinkObj( $nt, $alt, $align, $width ).$postfix;
+                               return $prefix.$this->makeThumbLinkObj( $img, $alt, $align, $width, $framed ).$postfix;
        
                        } elseif ( isset($width) ) {
                                
                                # Create a resized image, without the additional thumbnail
                                # features
-                               $url = $this->createThumb( $name, $width );
+                               $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 = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
                                "<img src=\"{$url}\" alt=\"{$alt}\" /></a>";
@@ -1636,152 +1797,61 @@ class Skin {
                return $prefix.$s.$postfix;
        }
 
-       function createThumb( $name, $width ) {
-               global $wgUploadDirectory;
-               global $wgImageMagickConvertCommand;
-               global $wgUseImageMagick;
-               global $wgUseSquid, $wgInternalServer;
-               $imgPath   = wfImagePath( $name );
-               $thumbName = $width."px-".$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, $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;
                        $boxheight = $height;
+                       $thumbUrl  = $url;
+               } else {
+                       $boxheight  = intval( $height/($width/$boxwidth) );
+                       # if ( $boxwidth > $width ) {
+                       #       $boxwidth  = $width;
+                       #       $boxheight = $height;
+                       #}
+                       $thumbUrl = $img->createThumb( $boxwidth );
                }
                $oboxwidth = $boxwidth + 2;
-               $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"' : "";
 
-               $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$oboxwidth}px;\"><div style=\"width:{$boxwidth}px;\">";
+               $s = "<div class=\"thumb t{$align}\"><div style=\"width:{$oboxwidth}px;\">";
                if ( $thumbUrl == "" ) {
-                       $s .= str_replace( "$1", $name, wfMsg("missingimage") );
-                       $zoom = '';
+                       $s .= str_replace( "$1", $img->getName(), wfMsg("missingimage") );
+                       $zoomicon = '';
                } else {
                        $s .= '<a href="'.$u.'" class="internal" title="'.$alt.'">'.
                                '<img src="'.$thumbUrl.'" alt="'.$alt.'" ' .
                                'width="'.$boxwidth.'" height="'.$boxheight.'" /></a>';
-                       $zoomicon =  '<div class="magnify" style="float:'.$magnifyalign.'">'.
-                               '<a href="'.$u.'" class="internal" title="'.$more.'">'.
-                               '<img src="'.$wgUploadPath.'/magnify-clip.png" ' .
-                               'width="15" height="11" alt="'.$more.'" /></a></div>';
-
+                       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>\n</div>";
                return $s;
@@ -1795,7 +1865,7 @@ class Skin {
        function makeMediaLinkObj( $nt, $alt = "" )
        {
                $name = $nt->getDBKey();
-               $url = wfImageUrl( $name );
+               $url = Image::wfImageUrl( $name );
                if ( empty( $alt ) ) {
                        $alt = preg_replace( '/\.(.+?)^/', '', $name );
                }
@@ -1859,7 +1929,7 @@ class Skin {
        # Enhanced RC ungrouped line
        function recentChangesBlockLine ( $rcObj )
        {
-               global $wgUploadPath, $wgLang ;
+               global $wgStylePath, $wgLang ;
 
                # Get rc_xxxx variables
                extract( $rcObj->mAttribs ) ;
@@ -1868,7 +1938,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;";
@@ -1923,7 +1993,7 @@ class Skin {
        # Enhanced RC group
        function recentChangesBlockGroup ( $block )
        {
-               global $wgUploadPath, $wgLang ;
+               global $wgStylePath, $wgLang ;
 
                $r = "" ;
                $M = wfMsg( "minoreditletter" );
@@ -1957,8 +2027,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
@@ -2000,7 +2070,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;" ;
@@ -2042,7 +2112,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 ) {
@@ -2340,7 +2410,7 @@ class Skin {
                $cur = wfMsg( "cur" );
 
                if ( $iscur ) {
-                       $url = wfImageUrl( $img );
+                       $url = Image::wfImageUrl( $img );
                        $rlink = $cur;
                        if ( $wgUser->isSysop() ) {
                                $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
@@ -2455,7 +2525,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,
@@ -2550,7 +2620,7 @@ class Skin {
                $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"] );
@@ -2574,12 +2644,12 @@ class Skin {
        }
 }
 
-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( $wgUsePHPTal ) {
-       include_once( "SkinPHPTal.php" );
+       require_once( "SkinPHPTal.php" );
 }