-<?
+<?php
# See skin.doc
# These are the INTERNAL names, which get mapped
# Language class has internationalized names
#
/* private */ $wgValidSkinNames = array(
- "Standard", "Nostalgia", "CologneBlue" #, "Smarty", "Montparnasse"
+ "Standard", "Nostalgia", "CologneBlue"
);
+if( $wgUseSmarty ) {
+ $wgValidSkinNames[] = "Smarty";
+ $wgValidSkinNames[] = "Montparnasse";
+}
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 ;
+ global $wgOut , $wgTitle , $wgUseCategoryMagic , $wgUser , $wgParser ;
if ( !isset ( $wgUseCategoryMagic ) || !$wgUseCategoryMagic ) return "" ;
- if ( count ( $wgOut->mCategoryLinks ) == 0 ) return "" ;
+ if ( count ( $wgParser->mCategoryLinks ) == 0 ) return "" ;
if ( !$wgOut->isArticle() ) return "" ;
$sk = $wgUser->getSkin() ;
$s = "" ;
$s .= "\n<br>\n";
$s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ;
- $t = implode ( " | " , $wgOut->mCategoryLinks ) ;
+ $t = implode ( " | " , $wgParser->mCategoryLinks ) ;
if ( $t != "" ) $s .= " : " ;
$s .= $t ;
return $s ;
class Skin {
/* 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;
function Skin()
{
+ $this->linktrail = wfMsg("linktrail");
}
function getSkinNames()
{
global $wgOut, $wgUser;
- if ( $wgOut->isQuickbarSupressed() ) { return 0; }
+ if ( $wgOut->isQuickbarSuppressed() ) { return 0; }
$q = $wgUser->getOption( "quickbar" );
if ( "" == $q ) { $q = 0; }
return $q;
wfProfileIn( $fname );
$out->addLink( "shortcut icon", "", "/favicon.ico" );
- if ( $out->isPrintable() ) { $ss = "wikiprintable.css"; }
- else { $ss = $this->getStylesheet(); }
- $out->addLink( "stylesheet", "", "{$wgStyleSheetPath}/{$ss}" );
+
wfProfileOut( $fname );
}
function getUserStyles()
{
+ global $wgOut, $wgStyleSheetPath;
+ if( $wgOut->isPrintable() ) {
+ $sheet = "wikiprintable.css";
+ } else {
+ $sheet = $this->getStylesheet();
+ }
$s = "<style type='text/css'><!--\n";
+ $s .= "@import url(\"$wgStyleSheetPath/$sheet\");\n";
+ $s .= "/*/*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
$s .= $this->doGetUserStyles();
+ $s .= "/* */\n";
$s .= "//--></style>\n";
return $s;
}
(!$wgTitle->isProtected() || $wgUser->isSysop())
) {
- $n = $wgTitle->getPrefixedURL();
$t = wfMsg( "editthispage" );
$oid = $red = "";
if ( $redirect ) { $red = "&redirect={$redirect}"; }
if ( $oldid && ! isset( $diff ) ) {
$oid = "&oldid={$oldid}";
}
- $s = wfLocalUrlE($n,"action=edit{$oid}{$red}");
+ $s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" );
$s = "document.location = \"" .$s ."\";";
$a += array ("ondblclick" => $s);
function afterContent()
{
global $wgUser, $wgOut, $wgServer;
- global $wgTitle;
+ global $wgTitle, $wgLang;
if ( $wgOut->isPrintable() ) {
$s = "\n</div>\n";
} else { $lm = ""; }
$cr = wfMsg( "gnunote" );
- $s .= "<p><em>{$rf}{$lm} {$cr}</em>\n";
+ $s .= "<p>" . $wgLang->emphasize("{$rf}{$lm} {$cr}\n");
return $s;
}
return $this->doAfterContent();
function nameAndLogin()
{
- global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader;
+ global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader, $wgIP;
$li = $wgLang->specialPage( "Userlogin" );
$lo = $wgLang->specialPage( "Userlogout" );
$s = "";
if ( 0 == $wgUser->getID() ) {
- if( $wgShowIPinHeader ) {
- $n = getenv( "REMOTE_ADDR" );
+ if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
+ $n = $wgIP;
$tl = $this->makeKnownLink( $wgLang->getNsText(
Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
{
global $search;
- $s = "<form name='search' class='inline' method=get action=\""
+ $s = "<form name='search' class='inline' method=post action=\""
. wfLocalUrl( "" ) . "\">"
. "<input type=text name=\"search\" size=19 value=\""
. htmlspecialchars(substr($search,0,256)) . "\">\n"
. "<input type=submit name=\"go\" value=\"" . wfMsg ("go") . "\"> "
- . "<input type=submit value=\"" . wfMsg ("search") . "\"></form>";
+ . "<input type=submit name=\"fulltext\" value=\"" . wfMsg ("search") . "\"></form>";
return $s;
}
if ( $wgDisableCounters ) {
$s = "";
} else {
- $count = $wgArticle->getCount();
+ $count = $wgLang->formatNum( $wgArticle->getCount() );
$s = wfMsg( "viewcount", $count );
}
$s .= $this->lastModified();
{
if ( "" != $align ) { $a = " align='{$align}'"; }
else { $a = ""; }
-
+
$mp = wfMsg( "mainpage" );
- $s = "<a href=\"" . wfLocalUrlE( urlencode( $mp ) )
+ $titleObj = Title::newFromText( $mp );
+ $s = "<a href=\"" . $titleObj->escapeLocalURL()
. "\"><img{$a} border=0 src=\""
. $this->getLogo() . "\" alt=\"" . "[{$mp}]\"></a>";
return $s;
global $wgTitle, $wgLang;
$s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
- wfMsg( "contributions" ), "target=" . $wgTitle->getURL() );
+ wfMsg( "contributions" ), "target=" . $wgTitle->getPartialURL() );
return $s;
}
global $wgTitle, $wgLang;
$s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
- wfMsg( "emailuser" ), "target=" . $wgTitle->getURL() );
+ wfMsg( "emailuser" ), "target=" . $wgTitle->getPartialURL() );
return $s;
}
}
# Pass a title object, not a title string
- function makeLinkObj( &$nt, $text= "", $query = "", $trail = "" )
+ function makeLinkObj( &$nt, $text= "", $query = "", $trail = "", $prefix = "" )
{
global $wgOut, $wgUser;
if ( $nt->isExternal() ) {
}
$retVal = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
} elseif ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
- $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
+ $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
} elseif ( ( -1 == $nt->getNamespace() ) ||
( Namespace::getImage() == $nt->getNamespace() ) ) {
- $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
+ $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
} else {
$aid = $nt->getArticleID() ;
if ( 0 == $aid ) {
- $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail );
+ $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail, $prefix );
} else {
$threshold = $wgUser->getOption("stubthreshold") ;
if ( $threshold > 0 ) {
$size = 1 ;
}
if ( $size < $threshold ) {
- $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail );
+ $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
} else {
- $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
+ $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
}
}
}
}
# Pass a title object, not a title string
- function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "" )
+ function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
{
global $wgOut, $wgTitle;
$u = "";
if ( "" == $text ) { $text = $nt->getFragment(); }
} else {
- $u = wfLocalUrlE( $link, $query );
+ $u = $nt->escapeLocalURL( $query );
}
if ( "" != $nt->getFragment() ) {
$u .= "#" . wfEscapeHTML( $nt->getFragment() );
$inside = "";
if ( "" != $trail ) {
- if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
+ if ( preg_match( $this->linktrail, $trail, $m ) ) {
$inside = $m[1];
$trail = $m[2];
}
}
- $r = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
+ $r = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
wfProfileOut( $fname );
return $r;
}
# Pass a title object, not a title string
- function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "" )
+ function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
{
global $wgOut, $wgUser;
$fname = "Skin::makeBrokenLinkObj";
wfProfileIn( $fname );
- $link = $nt->getPrefixedURL();
-
- if ( "" == $query ) { $q = "action=edit"; }
- else { $q = "action=edit&{$query}"; }
- $u = wfLocalUrlE( $link, $q );
+ if ( "" == $query ) {
+ $q = "action=edit";
+ } else {
+ $q = "action=edit&{$query}";
+ }
+ $u = $nt->escapeLocalURL( $q );
if ( "" == $text ) { $text = $nt->getPrefixedText(); }
$style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
$inside = "";
if ( "" != $trail ) {
- if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
+ if ( preg_match( $this->linktrail, $trail, $m ) ) {
$inside = $m[1];
$trail = $m[2];
}
}
if ( $wgOut->isPrintable() ||
( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
- $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
+ $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
} else {
- $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
+ $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
}
wfProfileOut( $fname );
}
# Pass a title object, not a title string
- function makeStubLinkObj( &$nt, $text = "", $query = "", $trail = "" )
+ function makeStubLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
{
global $wgOut, $wgUser;
$link = $nt->getPrefixedURL();
- $u = wfLocalUrlE( $link, $query );
+ $u = $nt->escapeLocalURL( $query );
if ( "" == $text ) { $text = $nt->getPrefixedText(); }
$style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
$inside = "";
if ( "" != $trail ) {
- if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
+ if ( preg_match( $this->linktrail, $trail, $m ) ) {
$inside = $m[1];
$trail = $m[2];
}
}
if ( $wgOut->isPrintable() ||
( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
- $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
+ $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
} else {
- $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
+ $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
}
return $s;
}
function makeImageLinkObj( $nt, $alt = "" ) {
global $wgLang, $wgUseImageResize;
- $link = $nt->getPrefixedURL();
$name = $nt->getDBKey();
$url = wfImageUrl( $name );
$align = "";
+ $prefix = $postfix = "";
if ( $wgUseImageResize ) {
# Check if the alt text is of the form "options|alt text"
$part = explode( "|", $alt);
- $mwThumb =& MagicWord::get( MAG_IMG_THUMBNAIL );
- $mwLeft =& MagicWord::get( MAG_IMG_LEFT );
- $mwRight =& MagicWord::get( MAG_IMG_RIGHT );
- $mwNone =& MagicWord::get( MAG_IMG_NONE );
- $mwWidth =& MagicWord::get( MAG_IMG_WIDTH );
+ $mwThumb =& MagicWord::get( MAG_IMG_THUMBNAIL );
+ $mwLeft =& MagicWord::get( MAG_IMG_LEFT );
+ $mwRight =& MagicWord::get( MAG_IMG_RIGHT );
+ $mwNone =& MagicWord::get( MAG_IMG_NONE );
+ $mwWidth =& MagicWord::get( MAG_IMG_WIDTH );
+ $mwCenter =& MagicWord::get( MAG_IMG_CENTER );
$alt = $part[count($part)-1];
$thumb=false;
} elseif ( ! is_null( $mwLeft->matchVariableStartToEnd($val) ) ) {
# remember to set an alignment, don't render immediately
$align = "left";
+ } elseif ( ! is_null( $mwCenter->matchVariableStartToEnd($val) ) ) {
+ # remember to set an alignment, don't render immediately
+ $align = "center";
} elseif ( ! is_null( $mwNone->matchVariableStartToEnd($val) ) ) {
# remember to set an alignment, don't render immediately
$align = "none";
$width = intval($match);
}
}
+ if ( "center" == $align )
+ {
+ $prefix = "<center>";
+ $postfix = "</center>";
+ $align = "none";
+ }
if ( $thumb ) {
if ( ! isset($width) ) {
$width = 180;
}
- return $this->makeThumbLinkObj( $nt, $alt, $align, $width );
+ return $prefix.$this->makeThumbLinkObj( $nt, $alt, $align, $width ).$postfix;
} elseif ( isset($width) ) {
}
$alt = htmlspecialchars( $alt );
- $u = wfLocalUrlE( $link );
- $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
- "<img border=\"0\" src=\"{$url}\" alt=\"{$alt}\"></a>";
+ $u = $nt->escapeLocalURL();
+ if ( $url == "" )
+ {
+ $s = str_replace( "$1", $name, wfMsg("missingimage") );
+ } else {
+ $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
+ "<img border=\"0\" src=\"{$url}\" alt=\"{$alt}\"></a>";
+ }
if ( "" != $align ) {
$s = "<div class=\"float{$align}\">{$s}</div>";
}
- return $s;
+ return $prefix.$s.$postfix;
}
function createThumb( $name, $width ) {
global $wgUploadDirectory;
global $wgImageMagickConvertCommand;
global $wgUseImageMagick;
+ global $wgUseSquid, $wgInternalServer;
$imgPath = wfImagePath( $name );
$thumbName = $width."px-".$icon.$name;
- $thumbPath = wfImageArchiveDir( $thumbName, "thumb" )."/".$thumbName;
- $thumbUrl = wfImageArchiveUrl( $thumbName, "thumb" );
+ $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 ( (! file_exists( $thumbPath ) && file_exists( $imgPath ))
- || ( filemtime($thumbPath) < filemtime($imgPath) ) ) {
- if ( $wgUseImageMagick ) {
+ if ( $wgUseImageMagick ) {
# use ImageMagick
$cmd = $wgImageMagickConvertCommand .
- " -quality 95 -geometry {$width} ".
+ " -quality 85 -geometry {$width} ".
escapeshellarg($imgPath) . " " .
escapeshellarg($thumbPath);
$conv = shell_exec( $cmd );
}
+ #
+ # 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;
+ global $wgUploadPath, $wgLang;
$name = $nt->getDBKey();
$image = Title::makeTitle( Namespace::getImage(), $name );
- $link = $image->getPrefixedURL();
$url = wfImageUrl( $name );
$path = wfImagePath( $name );
-
- list($width, $height, $type, $attr) = getimagesize( $path );
- $cwidth = $boxwidth;
- $cheight = intval( $height/($width/$cwidth) );
- if ($cheight > $boxwidth*1.5) {
- $cheight = $boxwidth*1.3;
- $cwidth = intval( $width/($height/$cheight) );
+
+ #$label = htmlspecialchars( $label );
+ $alt = preg_replace( "/<[^>]*>/", "", $label);
+ $alt = htmlspecialchars( $alt );
+
+ if ( file_exists( $path ) )
+ {
+ list($width, $height, $type, $attr) = getimagesize( $path );
+ } else {
+ $width = $height = 200;
}
- if ( $cwidth > $width ) {
- $cwidth = $width;
- $cheight = $height;
+ $boxheight = intval( $height/($width/$boxwidth) );
+ if ( $boxwidth > $width ) {
+ $boxwidth = $width;
+ $boxheight = $height;
}
- $thumbUrl = $this->createThumb( $name, $cwidth );
+ $thumbUrl = $this->createThumb( $name, $boxwidth );
- $u = wfLocalUrlE( $link );
+ $u = $nt->escapeLocalURL();
- $more = wfMsg( "thumbnail-more" );
-
- $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$boxwidth}px;\">" .
- "<a href=\"{$u}\" class=\"internal\" title=\"{$label}\">" .
- "<img border=\"0\" src=\"{$thumbUrl}\" alt=\"{$label}\" width=\"{$cwidth}\" height=\"{$cheight}\"></a>" .
- "<a href=\"{$u}\" class=\"internal\" title=\"{$more}\">" .
- "<img border=\"0\" src=\"{$wgUploadPath}/magnify-clip.png\" width=\"26\" height=\"24\" align=\"right\" alt=\"{$more}\"></a>" .
- "<p>{$label}</div></p>";
+ $more = htmlspecialchars( wfMsg( "thumbnail-more" ) );
+ $magnifyalign = $wgLang->isRTL() ? "left" : "right";
+ $textalign = $wgLang->isRTL() ? " style=\"text-align:right\"" : "";
+
+ $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$boxwidth}px;\">";
+ if ( $thumbUrl == "" ) {
+ $s .= str_replace( "$1", $name, wfMsg("missingimage") );
+ } else {
+ $s .= "<a href=\"{$u}\" class=\"internal\" title=\"{$alt}\">" .
+ "<img border=\"0\" src=\"{$thumbUrl}\" alt=\"{$alt}\" " .
+ " width=\"{$boxwidth}\" height=\"{$boxheight}\"></a>" .
+ "<a href=\"{$u}\" class=\"internal\" title=\"{$more}\">" .
+ "<img border=\"0\" src=\"{$wgUploadPath}/magnify-clip.png\" " .
+ " width=\"26\" height=\"24\" align=\"{$magnifyalign}\" alt=\"{$more}\"></a>";
+ }
+ $s .= "<p{$textalign}>{$label}</p></div>";
return $s;
}
# Enhanced RC ungrouped line
function recentChangesBlockLine ( $rcObj )
{
- global $wgUploadPath ;
+ global $wgUploadPath, $wgLang ;
# Get rc_xxxx variables
extract( $rcObj->mAttribs ) ;
# Spacer image
$r = "" ;
- $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>" ; $r .= "<tt>" ;
+ $r .= "<img src='{$wgUploadPath}/Arr_.png' width='12' height='12' border='0'>" ; $r .= "<tt>" ;
if ( $rc_type == RC_MOVE ) {
$r .= " ";
$r .= $rcObj->usertalklink ;
# Comment
- if ( $rc_comment != "" && $rc_type != RC_MOVE )
- $r .= " <em>(".wfEscapeHTML($rc_comment).")</em>" ;
+ if ( $rc_comment != "" && $rc_type != RC_MOVE ) {
+ $r .= $wgLang->emphasize( " (".wfEscapeHTML($rc_comment).")" );
+ }
$r .= "<br>\n" ;
return $r ;
}
# Enhanced RC group
function recentChangesBlockGroup ( $block )
{
- global $wgUploadPath ;
+ global $wgUploadPath, $wgLang ;
$r = "" ;
$M = wfMsg( "minoreditletter" );
$rcl = "RCL{$this->rcCacheIndex}" ;
$rcm = "RCM{$this->rcCacheIndex}" ;
$tl = "<a href='javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")'>" ;
- $tl .= "<span id='{$rcm}'><img src='{$wgUploadPath}/Arr_r.png' width=12 height=12 border=0></span>" ;
- $tl .= "<span id='{$rcl}' style='display:none'><img src='{$wgUploadPath}/Arr_d.png' width=12 height=12 border=0></span>" ;
+ $arrowdir = $wgLang->isRTL() ? "l" : "r";
+ $tl .= "<span id='{$rcm}'><img src='{$wgUploadPath}/Arr_{$arrowdir}.png' width='12' height='12' border='0'></span>" ;
+ $tl .= "<span id='{$rcl}' style='display:none'><img src='{$wgUploadPath}/Arr_d.png' width='12' height='12' border='0'></span>" ;
$tl .= "</a>" ;
$r .= $tl ;
if ( $rc_type == RC_LOG ) {
$link = $rcObj->timestamp ;
} else {
- $link = $this->makeKnownLink( $rcObj->getTitle(), $rcObj->timestamp , "{$curIdEq}&$o" ) ;
+ $link = $this->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp , "{$curIdEq}&$o" ) ;
}
$link = "<tt>{$link}</tt>" ;
$r .= $rcObj->lastlink ;
$r .= ") . . ".$rcObj->userlink ;
$r .= $rcObj->usertalklink ;
- if ( $rc_comment != "" )
- $r .= " <em>(".wfEscapeHTML($rc_comment).")</em>" ;
+ if ( $rc_comment != "" ) {
+ $r .= $wgLang->emphasize( " (".wfEscapeHTML($rc_comment).")" ) ;
+ }
$r .= "<br>\n" ;
}
$r .= "</div>\n" ;
{
global $wgUploadPath ;
if ( count ( $this->rc_cache ) == 0 ) return "" ;
- #$k = array_keys ( $this->rc_cache ) ;
+ $blockOut = "";
foreach ( $this->rc_cache AS $secureName => $block ) {
if ( count ( $block ) < 2 ) {
- $r .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ;
+ $blockOut .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ;
} else {
- $r .= $this->recentChangesBlockGroup ( $block ) ;
+ $blockOut .= $this->recentChangesBlockGroup ( $block ) ;
}
}
- return "<div align=left>{$r}</div>" ;
+ return "<div>{$blockOut}</div>" ;
}
# Called in a loop over all displayed RC entries
# Add comment
if ( "" != $rc_comment && "*" != $rc_comment && $rc_type != RC_MOVE ) {
- $s .= " <em>(" . wfEscapeHTML( $rc_comment ) . ")</em>";
+ $s .= $wgLang->emphasize(" (" . wfEscapeHTML( $rc_comment ) . ")");
}
$s .= "</li>\n";
# Make user link (or user contributions for unregistered users)
if ( 0 == $rc_user ) {
- $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
+ $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
$rc_user_text, "target=" . $rc_user_text );
- } else { $userLink = $this->makeLink( $wgLang->getNsText(
- Namespace::getUser() ) . ":{$rc_user_text}", $rc_user_text ); }
+ } else {
+ $userLink = $this->makeLink( $wgLang->getNsText(
+ Namespace::getUser() ) . ":{$rc_user_text}", $rc_user_text );
+ }
$rc->userlink = $userLink ;
$rc->lastlink = $lastLink ;
$secureName = $title->getPrefixedDBkey();
if ( $rc_type == RC_MOVE ) {
# Use an @ character to prevent collision with page names
- $this->rc_cache["@@" . ($rcMoveIndex++)] = array($rc);
+ $this->rc_cache["@@" . ($this->rcMoveIndex++)] = array($rc);
} else {
if ( !isset ( $this->rc_cache[$secureName] ) ) $this->rc_cache[$secureName] = array() ;
array_push ( $this->rc_cache[$secureName] , $rc ) ;
$url = wfImageUrl( $img );
$rlink = $cur;
if ( $wgUser->isSysop() ) {
- $link = wfLocalUrlE( $wgTitle->getPrefixedText(), "image=" . $wgTitle->getURL() .
+ $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
"&action=delete" );
$style = $this->getInternalLinkAttributes( $link, $del );
. " . . {$ul} ({$nb})";
if ( "" != $c && "*" != $c ) {
- $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
+ $s .= $wgLang->emphasize(" (" . wfEscapeHTML( $c ) . ")");
}
$s .= "</li>\n";
return $s;
}
function tocTable($toc) {
- // note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
- global $printable;
-
- if (!$printable) {
- $hideline = " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>";
- }
- return
- "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
- "<b>".wfMsg("toc")."</b>" .
- $hideline .
- "</td></tr><tr id='tocinside'><td align=\"left\">\n".
- $toc."</td></tr></table><P>\n";
+ // note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
+ global $printable;
+
+ if (!$printable) {
+ $hideline = " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>";
+ }
+ return
+ "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
+ "<b>".wfMsg("toc")."</b>" .
+ $hideline .
+ "</td></tr><tr id='tocinside'><td>\n".
+ $toc."</td></tr></table><P>\n";
}
# These two do not check for permissions: check $wgTitle->userCanEdit before calling them
global $wgTitle,$wgUser,$oldid;
if($oldid) return $head;
- $url = wfLocalUrlE(urlencode($wgTitle->getPrefixedText()),"action=edit§ion=$section");
+ $url = $wgTitle->escapeLocalURL( "action=edit§ion=$section" );
return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
}
function editSectionLink($section) {
-
- global $printable;
- global $wgTitle,$wgUser,$oldid;
- if($oldid) return "";
- if ($printable) return "";
- $editurl="§ion={$section}";
- $url=$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
- return "<div style=\"float:right;margin-left:5px;\"><small>[".$url."]</small></div>";
+ global $printable,$oldid;
+ global $wgTitle, $wgUser, $wgLang;
+
+ if( isset( $oldid ) ) return "";
+ if( isset( $printable ) ) return "";
+
+ $editurl = "§ion={$section}";
+ $url = $this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
+
+ if( $wgLang->isRTL() ) {
+ $farside = "left";
+ $nearside = "right";
+ } else {
+ $farside = "right";
+ $nearside = "left";
+ }
+ return "<div style=\"float:$farside;margin-$nearside:5px;\"><small>[".$url."]</small></div>";
}
// The necsesary JavaScript code can be found in style/wikibits.js.
function getEditToolbar() {
- global $wgUploadPath;
+ global $wgUploadPath,$wgLang;
// toolarray an array of arrays which each include the filename of
// the button image (without path), the opening tag, the closing tag,
// selection is highlighted.
// The tip text is shown when the user moves the mouse over the button.
$toolarray=array(
- array( "image"=>"button_bold.gif",
+ array( "image"=>"button_bold.png",
"open"=>"\'\'\'",
"close"=>"\'\'\'",
"sample"=>wfMsg("bold_sample"),
"tip"=>wfMsg("bold_tip")),
- array( "image"=>"button_italic.gif",
+ array( "image"=>"button_italic.png",
"open"=>"\'\'",
"close"=>"\'\'",
"sample"=>wfMsg("italic_sample"),
"tip"=>wfMsg("italic_tip")),
- array( "image"=>"button_link.gif",
+ array( "image"=>"button_link.png",
"open"=>"[[",
"close"=>"]]",
"sample"=>wfMsg("link_sample"),
"tip"=>wfMsg("link_tip")),
- array( "image"=>"button_extlink.gif",
+ array( "image"=>"button_extlink.png",
"open"=>"[",
"close"=>"]",
"sample"=>wfMsg("extlink_sample"),
"tip"=>wfMsg("extlink_tip")),
- array( "image"=>"button_headline.gif",
+ array( "image"=>"button_headline.png",
"open"=>"\\n== ",
"close"=>" ==\\n",
"sample"=>wfMsg("headline_sample"),
"tip"=>wfMsg("headline_tip")),
- array( "image"=>"button_image.gif",
- "open"=>"[[Image:",
+ array( "image"=>"button_image.png",
+ "open"=>"[[".$wgLang->getNsText(NS_IMAGE).":",
"close"=>"]]",
"sample"=>wfMsg("image_sample"),
"tip"=>wfMsg("image_tip")),
- array( "image"=>"button_media.gif",
- "open"=>"[[Media:",
+ array( "image"=>"button_media.png",
+ "open"=>"[[".$wgLang->getNsText(NS_MEDIA).":",
"close"=>"]]",
"sample"=>wfMsg("media_sample"),
"tip"=>wfMsg("media_tip")),
- array( "image"=>"button_math.gif",
+ array( "image"=>"button_math.png",
"open"=>"\\<math\\>",
"close"=>"\\</math\\>",
"sample"=>wfMsg("math_sample"),
"tip"=>wfMsg("math_tip")),
- array( "image"=>"button_nowiki.gif",
+ array( "image"=>"button_nowiki.png",
"open"=>"\\<nowiki\\>",
"close"=>"\\</nowiki\\>",
"sample"=>wfMsg("nowiki_sample"),
"tip"=>wfMsg("nowiki_tip")),
- array( "image"=>"button_sig.gif",
+ array( "image"=>"button_sig.png",
"open"=>"--~~~~",
"close"=>"",
"sample"=>"",
"tip"=>wfMsg("sig_tip")),
- array( "image"=>"button_hr.gif",
+ array( "image"=>"button_hr.png",
"open"=>"\\n----\\n",
"close"=>"",
"sample"=>"",
"tip"=>wfMsg("hr_tip"))
);
- $toolbar.="<script type='text/javascript'>\n";
+ $toolbar ="<script type='text/javascript'>\n";
$toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
foreach($toolarray as $tool) {
$image=$wgUploadPath."/".$tool["image"];
$open=$tool["open"];
$close=$tool["close"];
- $sample=$tool["sample"];
+ $sample = addslashes( $tool["sample"] );
// Note that we use the tip both for the ALT tag and the TITLE tag of the image.
// Older browsers show a "speedtip" type message only for ALT.
// Ideally these should be different, realistically they
// probably don't need to be.
- $tip=$tool["tip"];
+ $tip = addslashes( $tool["tip"] );
$toolbar.="addButton('$image','$tip','$open','$close','$sample');\n";
}
- $toolbar.="addInfobox('".wfMsg("infobox")."');\n";
+ $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "');\n";
$toolbar.="document.writeln(\"</div>\");\n</script>";
return $toolbar;
}
include_once( "SkinNostalgia.php" );
include_once( "SkinCologneBlue.php" );
-#include_once( "SkinSmarty.php" );
+if( $wgUseSmarty ) {
+ include_once( "SkinSmarty.php" );
+}
?>