-<?
+<?php
+
+include_once( "Feed.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";
+}
+if( $wgUsePHPTal ) {
+ #$wgValidSkinNames[] = "PHPTal";
+ $wgValidSkinNames[] = "DaVinci";
+}
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;
+ $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 .= $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);
$link = str_replace( "_", " ", $link );
$link = wfEscapeHTML( $link );
- if ( $wgOut->isPrintable() ) { $r = " class='printable'"; }
- else { $r = " class='external'"; }
+ $r = " class='external'";
if ( 1 == $wgUser->getOption( "hover" ) ) {
$r .= " title=\"{$link}\"";
$link = str_replace( "_", " ", $link );
$link = wfEscapeHTML( $link );
- if ( $wgOut->isPrintable() ) {
- $r = " class='printable'";
- } else if ( $broken == "stub" ) {
+ if ( $broken == "stub" ) {
$r = " class='stub'";
} else if ( $broken == "yes" ) {
$r = " class='new'";
} else {
- $r = " class='internal'";
+ $r = "";
}
if ( 1 == $wgUser->getOption( "hover" ) ) {
{
global $wgUser, $wgOut;
- if ( $wgOut->isPrintable() ) {
- $r = " class='printable'";
- } else if ( $broken == "stub" ) {
+ if ( $broken == "stub" ) {
$r = " class='stub'";
} else if ( $broken == "yes" ) {
$r = " class='new'";
} else {
- $r = " class='internal'";
+ $r = "";
}
if ( 1 == $wgUser->getOption( "hover" ) ) {
{
global $wgUser, $wgOut, $wgSiteNotice;
- if ( $wgOut->isPrintable() ) {
- $s = $this->pageTitle() . $this->pageSubtitle() . "\n";
- $s .= "\n<div class='bodytext'>";
- return $s;
- }
if( $wgSiteNotice ) {
$note = "\n<div id='notice' style='font-weight: bold; color: red; text-align: center'>$wgSiteNotice</div>\n";
} else {
}
$s .= "\n<div id='content'>\n<div id='topbar'>" .
- "<table width='98%' border=0 cellspacing=0><tr>";
+ "<table border=0 cellspacing=0><tr>";
$shove = ($qb != 0);
$left = ($qb == 1 || $qb == 3);
function afterContent()
{
global $wgUser, $wgOut, $wgServer;
- global $wgTitle;
+ global $wgTitle, $wgLang;
- if ( $wgOut->isPrintable() ) {
- $s = "\n</div>\n";
-
- $u = htmlspecialchars( $wgServer . $wgTitle->getFullURL() );
- $u = "<a href=\"$u\">$u</a>";
- $rf = wfMsg( "retrievedfrom", $u );
-
- if ( $wgOut->isArticle() ) {
- $lm = "<br>" . $this->lastModified();
- } else { $lm = ""; }
-
- $cr = wfMsg( "gnunote" );
- $s .= "<p><em>{$rf}{$lm} {$cr}</em>\n";
- return $s;
- }
- return $this->doAfterContent();
+ $printfooter = "<div class=\"printfooter\">" . $this->printFooter() . "</div>\n";
+ return $printfooter . $this->doAfterContent();
}
-
+
+ function printFooter() {
+ global $wgTitle;
+ $url = htmlspecialchars( $wgTitle->getFullURL() );
+ return "<p>" . wfMsg( "retrievedfrom", "<a href=\"$url\">$url</a>" ) .
+ "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
+ }
+
function doAfterContent()
{
global $wgUser, $wgOut, $wgLang;
$s = "\n</div><br clear=all>\n";
$s .= "\n<div id='footer'>";
- $s .= "<table width='98%' border=0 cellspacing=0><tr>";
+ $s .= "<table border=0 cellspacing=0><tr>";
wfProfileOut( "$fname-1" );
wfProfileIn( "$fname-2" );
. " | " . $this->aboutLink()
. " | " . $this->specialLink( "recentchanges" )
. " | " . $this->searchForm()
- . "<br>" . $this->pageStats();
+ . "<br><span id='pagestats'>" . $this->pageStats() . "</span>";
$s .= "</td>";
if ( $shove && !$left ) { # Right
function pageTitleLinks()
{
- global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval ;
+ global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval;
$s = $this->printableLink();
if ( wfMsg ( "disclaimers" ) != "-" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
function printableLink()
{
- global $wgOut, $wgTitle, $oldid, $action;
+ global $wgOut, $wgFeedClasses, $wgRequest;
- $q = "";
- foreach( $_GET as $var => $val ) {
- if( $var != "title" && $var != "printable" )
- $q .= urlencode( $var ) . "=" . urlencode( $val );
+ $baseurl = $_SERVER['REQUEST_URI'];
+ if( strpos( "?", $baseurl ) == false ) {
+ $baseurl .= "?";
+ } else {
+ $baseurl .= "&";
}
- if( !empty( $q ) ) $q .= "&";
+ $baseurl = htmlspecialchars( $baseurl );
+ $printurl = $wgRequest->escapeAppendQuery( "printable=yes" );
- $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
- WfMsg( "printableversion" ), "{$q}printable=yes" );
+ $s = "<a href=\"$printurl\">" . wfMsg( "printableversion" ) . "</a>";
+ if( $wgOut->isSyndicated() ) {
+ foreach( $wgFeedClasses as $format => $class ) {
+ $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
+ $s .= " | <a href=\"$feedurl\">{$format}</a>";
+ }
+ }
return $s;
}
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();
$s .= " " . wfMsg( "gnunote" );
- return "<span id='pagestats'>{$s}</span>";
+ return $s;
}
function 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>";
+ . $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 ) {
- $res = wfQuery ( "SELECT HIGH_PRIORITY length(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ ) ;
+ $res = wfQuery ( "SELECT LENGTH(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ ) ;
if ( wfNumRows( $res ) > 0 ) {
$s = wfFetchObject( $res );
$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}";
+ if ( $wgUser->getOption( "highlightbroken" ) ) {
+ $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}";
+ if ( $wgUser->getOption( "highlightbroken" ) ) {
+ $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;
}
global $wgOut;
if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
- $s = "<img src=\"{$url}\" alt=\"{$alt}\">";
+ $s = "<img src=\"{$url}\" alt=\"{$alt}\" />";
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);
- if ( count($part) > 1 ) {
- $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 );
- $alt = $part[count($part)-1];
-
- $thumb=false;
-
- foreach( $part as $key => $val ) {
- if ( ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
- $thumb=true;
- } elseif ( ! is_null( $mwRight->matchVariableStartToEnd($val) ) ) {
- # remember to set an alignment, don't render immediately
- $align = "right";
- } elseif ( ! is_null( $mwLeft->matchVariableStartToEnd($val) ) ) {
- # remember to set an alignment, don't render immediately
- $align = "left";
- } elseif ( ! is_null( $mwNone->matchVariableStartToEnd($val) ) ) {
- # remember to set an alignment, don't render immediately
- $align = "none";
- } elseif ( ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {
- # $match is the image width in pixels
- $width = intval($match);
- }
+ $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;
+
+ foreach( $part as $key => $val ) {
+ if ( ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
+ $thumb=true;
+ } elseif ( ! is_null( $mwRight->matchVariableStartToEnd($val) ) ) {
+ # remember to set an alignment, don't render immediately
+ $align = "right";
+ } 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";
+ } elseif ( ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {
+ # $match is the image width in pixels
+ $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 = "\n <a href=\"{$u}\" class='image' title=\"{$alt}\">\n" .
+ " <img border=\"0\" src=\"{$url}\" alt=\"{$alt}\" />\n </a>";
+ }
if ( "" != $align ) {
- $s = "<div class=\"float{$align}\">{$s}</div>";
+ $s = "<div class=\"float{$align}\">{$s}\n</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}x ".
+ " -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 .= "\n".' <a href="'.$u.'" class="internal" title="'.$alt.'">'."\n".
+ ' <img border="0" src="'.$thumbUrl.'" alt="'.$alt.'" ' .
+ ' width="'.$boxwidth.'" height="'.$boxheight.'" /></a>' ."\n".
+ ' <a href="'.$u.'" class="internal" title="'.$more.'"> ' ."\n".
+ ' <img border="0" src="'.$wgUploadPath.'/magnify-clip.png" ' .
+ 'width="26" height="24" align="'.$magnifyalign.'" alt="'.$more.'" /> </a>'."\n";
+ }
+ $s .= ' <p'.$textalign.'>'.$label."</p>\n</div>";
return $s;
}
function beginImageHistoryList()
{
$s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
- "<p>" . wfMsg( "imghistlegend" ) . "\n<ul>";
+ "<p>" . wfMsg( "imghistlegend" ) . "\n<ul class='special'>";
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" );
$rci = "RCI{$this->rcCacheIndex}" ;
$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>" ;
- $tl .= "</a>" ;
+ $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' border='0' /></a></span>" ;
+ $tl .= "<span id='{$rcl}' style='display:none'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_d.png' width='12' height='12' border='0' /></a></span>" ;
$r .= $tl ;
# Main line
$r .= "; " ;
# History
- $r .= $this->makeKnownLink( $block[0]->getTitle(), wfMsg( "history" ), "{$curIdEq}&action=history" );
+ $r .= $this->makeKnownLinkObj( $block[0]->getTitle(), wfMsg( "history" ), "{$curIdEq}&action=history" );
$r .= ")" ;
}
# Get rc_xxxx variables
extract( $rcObj->mAttribs );
- $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>";
+ $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0 />";
$r .= "<tt> " ;
if ( $rc_new ) $r .= $N ;
else $r .= " " ;
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
$s = "";
if ( $date != $this->lastdate ) {
if ( "" != $this->lastdate ) { $s .= "</ul>\n"; }
- $s .= "<h4>{$date}</h4>\n<ul>";
+ $s .= "<h4>{$date}</h4>\n<ul class='special'>";
$this->lastdate = $date;
}
$s .= "<li> ";
# 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 tocIndent($level) {
-
- while($level-->0) $rv.="<div style=\"margin-left:2em;\">\n";
- return $rv;
-
+ return str_repeat( "<div class='tocindent'>\n", $level );
}
function tocUnindent($level) {
- $rv = "";
- while($level-->0) $rv.="</div>\n";
- return $rv;
+ return str_repeat( "</div>\n", $level );
}
- // parameter level defines if we are on an indentation level
- function tocLine($anchor,$tocline,$level) {
-
- if($level) {
-
- return "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n";
- } else {
-
- return "<div style=\"margin-bottom:0px;\">\n".
- "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n".
- "</div>\n";
+ # parameter level defines if we are on an indentation level
+ function tocLine( $anchor, $tocline, $level ) {
+ $link = "<a href=\"#$anchor\">$tocline</a><br />";
+ if($level) {
+ return "$link\n";
+ } else {
+ return "<div class='tocline'>$link</div>\n";
}
}
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
+ # try min-width & co when somebody gets a chance
+ $hideline = " <script type='text/javascript'>showTocToggle(\"" . addslashes( wfMsg("showtoc") ) . "\",\"" . addslashes( 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
- function editSectionScript($section,$head) {
-
- global $wgTitle,$wgUser,$oldid;
- if($oldid) return $head;
- $url = wfLocalUrlE(urlencode($wgTitle->getPrefixedText()),"action=edit§ion=$section");
- return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
+ function editSectionScript( $section, $head ) {
+ global $wgTitle, $wgRequest;
+ if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
+ return $head;
+ }
+ $url = $wgTitle->escapeLocalURL( "action=edit§ion=$section" );
+ return "<span oncontextmenu='document.location=\"$url\";return false;'>{$head}</span>";
}
- function editSectionLink($section) {
+ function editSectionLink( $section ) {
+ global $wgRequest;
+ global $wgTitle, $wgUser, $wgLang;
+
+ if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
+ # Section edit links would be out of sync on an old page.
+ # But, if we're diffing to the current page, they'll be
+ # correct.
+ return "";
+ }
- 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>";
+ $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 class=\"editsection\" style=\"float:$farside;margin-$nearside:5px;\">[".$url."]</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" ) ) . "','" . addslashes(wfMsg("infobox_alert")) . "','" . addslashes(wfMsg("infobox_mozvote"))."');\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" );
+}
+if( $wgUsePHPTal ) {
+ include_once( "SkinPHPTal.php" );
+}
+
?>