<?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' => "Standard",
+ 'nostalgia' => "Nostalgia",
+ 'cologneblue' => "CologneBlue"
);
+if( $wgUsePHPTal ) {
+ #$wgValidSkinNames[] = "PHPTal";
+ #$wgValidSkinNames['davinci'] = "DaVinci";
+ #$wgValidSkinNames['mono'] = "Mono";
+ $wgValidSkinNames['monobook'] = "MonoBook";
+ #$wgValidSkinNames['monobookminimal'] = "MonoBookMinimal";
+}
include_once( "RecentChange.php" );
{
global $wgOut , $wgTitle , $wgUseCategoryMagic , $wgUser , $wgParser ;
if ( !isset ( $wgUseCategoryMagic ) || !$wgUseCategoryMagic ) return "" ;
- if ( count ( $wgParser->mCategoryLinks ) == 0 ) return "" ;
+ if ( count ( $wgOut->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 ( " | " , $wgParser->mCategoryLinks ) ;
- if ( $t != "" ) $s .= " : " ;
+ $t = implode ( " | " , $wgOut->mCategoryLinks ) ;
+ if ( $t != "" ) $s .= ": " ;
$s .= $t ;
- return $s ;
+ return "<p class='catlinks'>$s</p>";
}
class RCCacheEntry extends RecentChange
function initPage( &$out )
{
- global $wgStyleSheetPath;
$fname = "Skin::initPage";
wfProfileIn( $fname );
- $out->addLink( "shortcut icon", "", "/favicon.ico" );
+ $out->addLink( array( "rel" => "shortcut icon", "href" => "/favicon.ico" ) );
+ $this->addMetadataLinks($out);
+
wfProfileOut( $fname );
}
+ function addMetadataLinks( &$out ) {
+ global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf, $wgRdfMimeType, $action;
+ global $wgRightsPage, $wgRightsUrl;
+
+ if( $out->isArticleRelated() ) {
+ # note: buggy CC software only reads first "meta" link
+ if( $wgEnableCreativeCommonsRdf ) {
+ $out->addMetadataLink( array(
+ 'title' => 'Creative Commons',
+ 'type' => 'application/rdf+xml',
+ 'href' => $wgTitle->getLocalURL( "action=creativecommons") ) );
+ }
+ if( $wgEnableDublinCoreRdf ) {
+ $out->addMetadataLink( array(
+ 'title' => 'Dublin Core',
+ 'type' => 'application/rdf+xml',
+ 'href' => $wgTitle->getLocalURL( "action=dublincore" ) ) );
+ }
+ }
+ $copyright = "";
+ if( $wgRightsPage ) {
+ $copy = Title::newFromText( $wgRightsPage );
+ if( $copy ) {
+ $copyright = $copy->getLocalURL();
+ }
+ }
+ if( !$copyright && $wgRightsUrl ) {
+ $copyright = $wgRightsUrl;
+ }
+ if( $copyright ) {
+ $out->addLink( array(
+ "rel" => "copyright",
+ "href" => $copyright ) );
+ }
+ }
+
function outputPage( &$out ) {
global $wgDebugComments;
}
$out->out( $this->beforeContent() );
- $out->out( $out->mBodytext );
+ $out->out( $out->mBodytext . "\n" );
$out->out( $this->afterContent() );
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";
+ $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";
+ $s .= "</style>\n";
return $s;
}
} else {
# CHECK MERGE @@@
# Force no underline
- $s .= "a.stub, a.new, a.internal, a.external { " .
+ $s .= "a { " .
"text-decoration: none; }\n";
}
if ( 1 == $wgUser->getOption( "highlightbroken" ) ) {
function getBodyOptions()
{
- global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $oldid, $redirect, $diff,$action;
+ global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $wgRequest;
+
+ extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
if ( 0 != $wgTitle->getNamespace() ) {
$a = array( "bgcolor" => "#ffffec" );
}
else $a = array( "bgcolor" => "#FFFFFF" );
- if($wgOut->isArticle() && $wgUser->getOption("editondblclick")
- &&
- (!$wgTitle->isProtected() || $wgUser->isSysop())
-
- ) {
+ if($wgOut->isArticle() && $wgUser->getOption("editondblclick") &&
+ (!$wgTitle->isProtected() || $wgUser->isSysop()) ) {
$t = wfMsg( "editthispage" );
$oid = $red = "";
- if ( $redirect ) { $red = "&redirect={$redirect}"; }
- if ( $oldid && ! isset( $diff ) ) {
+ if ( !empty($redirect) ) {
+ $red = "&redirect={$redirect}";
+ }
+ if ( !empty($oldid) && ! isset( $diff ) ) {
$oid = "&oldid={$oldid}";
}
$s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" );
$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 {
$borderhack = "class='top'";
}
- $s .= "\n<div id='content'>\n<div id='topbar'>" .
- "<table width='98%' border=0 cellspacing=0><tr>";
+ $s .= "\n<div id='content'>\n<div id='topbar'>\n" .
+ "<table border='0' cellspacing='0' width='98%'>\n<tr>\n";
$shove = ($qb != 0);
$left = ($qb == 1 || $qb == 3);
if($wgLang->isRTL()) $left = !$left;
if ( !$shove ) {
- $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>" .
+ $s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
$this->logoText() . "</td>";
} elseif( $left ) {
$s .= $this->getQuickbarCompensator( $rows );
}
$l = $wgLang->isRTL() ? "right" : "left";
- $s .= "<td {$borderhack} align='$l' valign='top'>";
+ $s .= "<td {$borderhack} align='$l' valign='top'>\n";
$s .= $this->topLinks() ;
- $s .= "<p class='subtitle'>" . $this->pageTitleLinks();
+ $s .= "<p class='subtitle'>" . $this->pageTitleLinks() . "</p>\n";
$r = $wgLang->isRTL() ? "left" : "right";
- $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap>";
+ $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
$s .= $this->nameAndLogin();
- $s .= "\n<br>" . $this->searchForm() . "</td>";
+ $s .= "\n<br />" . $this->searchForm() . "</td>";
if ( $langlinks ) {
- $s .= "</tr>\n<tr><td class='top' colspan=\"2\">$langlinks</td>";
+ $s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">$langlinks</td>\n";
}
if ( $shove && !$left ) { # Right
$s .= $this->getQuickbarCompensator( $rows );
}
- $s .= "</tr></table>\n</div>\n";
- $s .= "\n<div id='article'>";
+ $s .= "</tr>\n</table>\n</div>\n";
+ $s .= "\n<div id='article'>\n";
$s .= $this->pageTitle();
$s .= $this->pageSubtitle() ;
$s .= getCategories(); // For some odd reason, zhis can't be a function of the object
- $s .= "\n<p>";
wfProfileOut( $fname );
return $s;
}
global $wgUser, $wgOut, $wgServer;
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>" . $wgLang->emphasize("{$rf}{$lm} {$cr}\n");
- return $s;
- }
- return $this->doAfterContent();
+ $printfooter = "<div class=\"printfooter\">\n" . $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;
wfProfileIn( $fname );
wfProfileIn( "$fname-1" );
- $s = "\n</div><br clear=all>\n";
+ $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" );
$s .= "<td class='bottom' align='$l' valign='top'>";
$s .= $this->bottomLinks();
- $s .= "\n<br>" . $this->mainPageLink()
+ $s .= "\n<br />" . $this->mainPageLink()
. " | " . $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, $wgUser, $wgLang, $wgUseApproval, $wgRequest;
+
+ extract( $wgRequest->getValues( 'oldid', 'diff' ) );
+ $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() ) {
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;
}
{
global $wgOut, $wgTitle, $wgUser;
- $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
+ $s = "<h1 class='pagetitle'>" . htmlspecialchars( $wgOut->getPageTitle() ) . "</h1>";
if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
return $s;
}
global $wgExtraSubtitle;
$sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
}
- if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
+ if($wgOut->isArticle() && !empty($wgNamespacesWithSubpages[$wgTitle->getNamespace()])) {
$ptext=$wgTitle->getPrefixedText();
if(preg_match("/\//",$ptext)) {
$sub.="</p><p class='subpages'>";
}
}
}
- $s = "<p class='subtitle'>{$sub}\n";
+ $s = "<p class='subtitle'>{$sub}</p>\n";
return $s;
}
$q = "";
} else { $q = "returnto={$rt}"; }
- $s .= "\n<br>" . $this->makeKnownLink( $li,
+ $s .= "\n<br />" . $this->makeKnownLink( $li,
wfMsg( "login" ), $q );
} else {
$n = $wgUser->getName();
$tl = " ({$tl})";
$s .= $this->makeKnownLink( $wgLang->getNsText(
- Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br>" .
+ Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br />" .
$this->makeKnownLink( $lo, wfMsg( "logout" ),
"returnto={$rt}" ) . " | " .
$this->specialLink( "preferences" );
function searchForm()
{
- global $search;
+ global $wgRequest;
+
+ $search = $wgRequest->getText( 'search' );;
- $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 name=\"fulltext\" value=\"" . wfMsg ("search") . "\"></form>";
+ $s = "<form name='search' class='inline' method='post' action=\""
+ . wfLocalUrl( "" ) . "\">\n"
+ . "<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' name=\"fulltext\" value=\"" . wfMsg ("search") . "\" />\n</form>";
return $s;
}
if ( $wgTitle->getNamespace() == Namespace::getUser()
|| $wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
- {
+ {
$id=User::idFromName($wgTitle->getText());
$ip=User::isIP($wgTitle->getText());
}
}
if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
- $s .= "\n<br>" . $this->deleteThisPage() .
+ $s .= "\n<br />" . $this->deleteThisPage() .
$sep . $this->protectThisPage() .
$sep . $this->moveThisPage();
}
- $s .= "<br>\n" . $this->otherLanguages();
+ $s .= "<br />\n" . $this->otherLanguages();
}
return $s;
}
function pageStats()
{
- global $wgOut, $wgLang, $wgArticle;
- global $oldid, $diff, $wgDisableCounters;
-
+ global $wgOut, $wgLang, $wgArticle, $wgRequest;
+ global $wgDisableCounters;
+
+ extract( $wgRequest->getValues( 'oldid', 'diff' ) );
if ( ! $wgOut->isArticle() ) { return ""; }
if ( isset( $oldid ) || isset( $diff ) ) { return ""; }
if ( 0 == $wgArticle->getID() ) { return ""; }
- if ( $wgDisableCounters ) {
- $s = "";
- } else {
+ $s = "";
+ if ( !$wgDisableCounters ) {
$count = $wgLang->formatNum( $wgArticle->getCount() );
- $s = wfMsg( "viewcount", $count );
+ if ( $count ) {
+ $s = wfMsg( "viewcount", $count );
+ }
}
$s .= $this->lastModified();
- $s .= " " . wfMsg( "gnunote" );
- return "<span id='pagestats'>{$s}</span>";
+ return $s . " " . $this->getCopyright();
+ }
+
+ function getCopyright() {
+ global $wgRightsPage, $wgRightsUrl, $wgRightsText;
+ $out = "";
+ if( $wgRightsPage ) {
+ $link = $this->makeKnownLink( $wgRightsPage, $wgRightsText );
+ } elseif( $wgRightsUrl ) {
+ $link = $this->makeExternalLink( $wgRightsUrl, $wgRightsText );
+ } else {
+ # Give up now
+ return $out;
+ }
+ $out .= wfMsg( "copyright", $link );
+ return $out;
+ }
+
+ function getCopyrightIcon() {
+ global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRightsIcon;
+ $out = "";
+ if( $wgRightsIcon ) {
+ $icon = htmlspecialchars( $wgRightsIcon );
+ if( $wgRightsUrl ) {
+ $url = htmlspecialchars( $wgRightsUrl );
+ $out .= "<a href=\"$url\">";
+ }
+ $text = htmlspecialchars( $wgRightsText );
+ $out .= "<img src=\"$icon\" alt='$text' />";
+ if( $wgRightsUrl ) {
+ $out .= "</a>";
+ }
+ }
+ return $out;
+ }
+
+ function getPoweredBy() {
+ global $wgUploadPath;
+ $url = htmlspecialchars( "$wgUploadPath/poweredby_mediawiki_88x31.png" );
+ $img = "<a href='http://www.mediawiki.org/'><img src='$url' alt='MediaWiki' /></a>";
+ return $img;
}
function lastModified()
{
global $wgLang, $wgArticle;
-
- $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
- $s = " " . wfMsg( "lastmodified", $d );
+
+ $timestamp = $wgArticle->getTimestamp();
+ if ( $timestamp ) {
+ $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
+ $s = " " . wfMsg( "lastmodified", $d );
+ } else {
+ $s = "";
+ }
return $s;
}
$mp = wfMsg( "mainpage" );
$titleObj = Title::newFromText( $mp );
$s = "<a href=\"" . $titleObj->escapeLocalURL()
- . "\"><img{$a} border=0 src=\""
- . $this->getLogo() . "\" alt=\"" . "[{$mp}]\"></a>";
+ . "\"><img{$a} src=\""
+ . $this->getLogo() . "\" alt=\"" . "[{$mp}]\" /></a>";
return $s;
}
function quickBar()
{
- global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
- global $wpPreview, $wgDisableUploads, $wgRemoteUploads;
+ global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang;
+ global $wgDisableUploads, $wgRemoteUploads;
$fname = "Skin::quickBar";
wfProfileIn( $fname );
+ $action = $wgRequest->getText( 'action' );
+ $wpPreview = $wgRequest->getBool( 'wpPreview' );
$tns=$wgTitle->getNamespace();
$s = "\n<div id='quickbar'>";
- $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
+ $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
- $sep = "\n<br>";
+ $sep = "\n<br />";
$s .= $this->mainPageLink()
. $sep . $this->specialLink( "recentchanges" )
. $sep . $this->specialLink( "randompage" );
}
// only show watchlist link if logged in
- if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
- $s .= "\n<br><hr class='sep'>";
+ 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) {
if($wgOut->isArticle()) {
$link = $nstext . ":" . $link ;
}
- $s .= $this->makeLink( $link, $text );
+ $s .= $this->makeLink( $link, $text );
} elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
# we just throw in a "New page" text to tell the user that he's in edit mode,
# and to avoid messing with the separator that is prepended to the next item
if( $tns%2 && $action!="edit" && !$wpPreview) {
- $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
+ $s.="<br />".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
}
/*
if user edits article, then loads "watch this article" in background and then saves
article with "Watch this article" checkbox disabled, the article is transparently
unwatched. Therefore we do not show the "Watch this page" link in edit mode
- */
+ */
if ( 0 != $wgUser->getID() && $articleExists) {
- if($action!="edit" && $action != "submit" )
+ if($action!="edit" && $action != "submit" )
{
- $s .= $sep . $this->watchThisPage();
+ $s .= $sep . $this->watchThisPage();
}
- if ( $wgTitle->userCanEdit() )
+ if ( $wgTitle->userCanEdit() )
$s .= $sep . $this->moveThisPage();
}
if ( $wgUser->isSysop() and $articleExists ) {
$sep . $this->protectThisPage();
}
$s .= $sep . $this->talkLink();
- if ($articleExists && $action !="history") {
+ if ($articleExists && $action !="history") {
$s .= $sep . $this->historyLink();
}
$s.=$sep . $this->whatLinksHere();
}
}
}
- $s .= "\n<br><hr class='sep'>";
+ $s .= "\n<br /><hr class='sep' />";
}
if ( 0 != $wgUser->getID() && ( !$wgDisableUploads || $wgRemoteUploads ) ) {
global $wgSiteSupportPage;
if( $wgSiteSupportPage ) {
- $s .= "\n<br><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
+ $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
"\" class=\"internal\">" . wfMsg( "sitesupport" ) . "</a>";
}
- $s .= "\n<br></div>\n";
+ $s .= "\n<br /></div>\n";
wfProfileOut( $fname );
return $s;
}
$spp = $wgLang->specialPage( "Specialpages" );
$s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
- "action=\"{$wgServer}{$wgRedirectScript}\">\n";
+ "action=\"" . htmlspecialchars( "{$wgServer}{$wgRedirectScript}" ) . "\">\n";
$s .= "<select name=\"wpDropdown\">\n";
$s .= "<option value=\"{$spp}\">{$sp}</option>\n";
$s .= "<option value=\"{$p}\">{$desc}</option>\n";
}
$s .= "</select>\n";
- $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
+ $s .= "<input type='submit' value=\"{$go}\" name='redirect' />\n";
$s .= "</form>\n";
return $s;
}
function editThisPage()
{
- global $wgOut, $wgTitle, $oldid, $redirect, $diff;
-
+ global $wgOut, $wgTitle, $wgRequest;
+
+ $oldid = $wgRequest->getVal( 'oldid' );
+ $diff = $wgRequest->getVal( 'diff' );
+ $redirect = $wgRequest->getVal( 'redirect' );
+
if ( ! $wgOut->isArticleRelated() ) {
$s = wfMsg( "protectedpage" );
} else {
}
$oid = $red = "";
- if ( $redirect ) { $red = "&redirect={$redirect}"; }
+ if ( !is_null( $redirect ) ) { $red = "&redirect={$redirect}"; }
if ( $oldid && ! isset( $diff ) ) {
$oid = "&oldid={$oldid}";
}
function deleteThisPage()
{
- global $wgUser, $wgOut, $wgTitle, $diff;
+ global $wgUser, $wgOut, $wgTitle, $wgRequest;
+ $diff = $wgRequest->getVal( 'diff' );
if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
$n = $wgTitle->getPrefixedText();
$t = wfMsg( "deletethispage" );
function protectThisPage()
{
- global $wgUser, $wgOut, $wgTitle, $diff;
+ global $wgUser, $wgOut, $wgTitle, $wgRequest;
+ $diff = $wgRequest->getVal( 'diff' );
if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
$n = $wgTitle->getPrefixedText();
function watchThisPage()
{
- global $wgUser, $wgOut, $wgTitle, $diff;
+ global $wgUser, $wgOut, $wgTitle;
if ( $wgOut->isArticleRelated() ) {
$n = $wgTitle->getPrefixedText();
global $wgOut, $wgLang, $wgTitle, $wgUseNewInterlanguage;
$a = $wgOut->getLanguageLinks();
- # TEST THIS @@@
if ( 0 == count( $a ) ) {
if ( !$wgUseNewInterlanguage ) return "";
$ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
$text= wfMsg("articlepage");
}
} else {
-
+
$lns = Namespace::getTalk( $tns );
$text=$tp;
}
function makeLink( $title, $text = "", $query = "", $trail = "" ) {
wfProfileIn( "Skin::makeLink" );
$nt = Title::newFromText( $title );
- if ($nt) {
+ if ($nt) {
$result = $this->makeLinkObj( Title::newFromText( $title ), $text, $query, $trail );
} else {
wfDebug( "Invalid title passed to Skin::makeLink(): \"$title\"\n" );
$result = $text == "" ? $title : $text;
- }
-
+ }
+
wfProfileOut( "Skin::makeLink" );
return $result;
}
- function makeKnownLink( $title, $text = "", $query = "", $trail = "" ) {
+ function makeKnownLink( $title, $text = "", $query = "", $trail = "", $prefix = '',$aprops = '') {
$nt = Title::newFromText( $title );
- if ($nt) {
- return $this->makeKnownLinkObj( Title::newFromText( $title ), $text, $query, $trail );
+ if ($nt) {
+ return $this->makeKnownLinkObj( Title::newFromText( $title ), $text, $query, $trail, $prefix , $aprops );
} else {
wfDebug( "Invalid title passed to Skin::makeKnownLink(): \"$title\"\n" );
return $text == "" ? $title : $text;
function makeBrokenLink( $title, $text = "", $query = "", $trail = "" ) {
$nt = Title::newFromText( $title );
- if ($nt) {
+ if ($nt) {
return $this->makeBrokenLinkObj( Title::newFromText( $title ), $text, $query, $trail );
} else {
wfDebug( "Invalid title passed to Skin::makeBrokenLink(): \"$title\"\n" );
global $wgOut, $wgUser;
if ( $nt->isExternal() ) {
$u = $nt->getFullURL();
+ $link = $nt->getPrefixedURL();
if ( "" == $text ) { $text = $nt->getPrefixedText(); }
$style = $this->getExternalLinkAttributes( $link, $text );
}
} else {
$size = 1 ;
- }
+ }
if ( $size < $threshold ) {
$retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
} else {
}
# Pass a title object, not a title string
- function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
+ function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" , $aprops = '')
{
global $wgOut, $wgTitle;
if ( "" == $link ) {
$u = "";
- if ( "" == $text ) { $text = $nt->getFragment(); }
+ if ( "" == $text ) {
+ $text = htmlspecialchars( $nt->getFragment() );
+ }
} else {
$u = $nt->escapeLocalURL( $query );
}
if ( "" != $nt->getFragment() ) {
- $u .= "#" . wfEscapeHTML( $nt->getFragment() );
+ $u .= "#" . htmlspecialchars( $nt->getFragment() );
+ }
+ if ( "" == $text ) {
+ $text = htmlspecialchars( $nt->getPrefixedText() );
}
- if ( "" == $text ) { $text = $nt->getPrefixedText(); }
$style = $this->getInternalLinkAttributesObj( $nt, $text );
$inside = "";
$trail = $m[2];
}
}
- $r = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
+ $r = "<a href=\"{$u}\"{$style}{$aprops}>{$prefix}{$text}{$inside}</a>{$trail}";
wfProfileOut( $fname );
return $r;
}
-
+
# Pass a title object, not a title string
function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
{
global $wgOut, $wgUser;
-
+
$fname = "Skin::makeBrokenLinkObj";
wfProfileIn( $fname );
}
$u = $nt->escapeLocalURL( $q );
- if ( "" == $text ) { $text = $nt->getPrefixedText(); }
+ if ( "" == $text ) {
+ $text = htmlspecialchars( $nt->getPrefixedText() );
+ }
$style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
$inside = "";
$trail = $m[2];
}
}
- if ( $wgOut->isPrintable() ||
- ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
+ if ( $wgUser->getOption( "highlightbroken" ) ) {
$s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
} else {
$s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
$u = $nt->escapeLocalURL( $query );
- if ( "" == $text ) { $text = $nt->getPrefixedText(); }
+ if ( "" == $text ) {
+ $text = htmlspecialchars( $nt->getPrefixedText() );
+ }
$style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
$inside = "";
$trail = $m[2];
}
}
- if ( $wgOut->isPrintable() ||
- ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
+ if ( $wgUser->getOption( "highlightbroken" ) ) {
$s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
} else {
$s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
global $wgOut;
if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
- $s = "<img src=\"{$url}\" alt=\"{$alt}\">";
+ $s = "<img src=\"{$url}\" alt=\"{$alt}\" />";
return $s;
}
}
if ( "center" == $align )
{
- $prefix = "<center>";
- $postfix = "</center>";
+ $prefix = '<span style="text-align: center">';
+ $postfix = '</span>';
$align = "none";
}
$alt = htmlspecialchars( $alt );
$u = $nt->escapeLocalURL();
- $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
- "<img border=\"0\" src=\"{$url}\" alt=\"{$alt}\"></a>";
+ if ( $url == "" )
+ {
+ $s = str_replace( "$1", $name, wfMsg("missingimage") );
+ } else {
+ $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
+ "<img src=\"{$url}\" alt=\"{$alt}\" /></a>";
+ }
if ( "" != $align ) {
- $s = "<div class=\"float{$align}\">{$s}</div>";
+ $s = "<div class=\"float{$align}\"><span>{$s}</span>\n</div>";
}
return $prefix.$s.$postfix;
}
global $wgUseImageMagick;
global $wgUseSquid, $wgInternalServer;
$imgPath = wfImagePath( $name );
- $thumbName = $width."px-".$icon.$name;
+ $thumbName = $width."px-".$name;
$thumbPath = wfImageThumbDir( $thumbName )."/".$thumbName;
$thumbUrl = wfImageThumbUrl( $thumbName );
- if ( (! file_exists( $thumbPath ) && file_exists( $imgPath ))
+ 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 ) {
}
function makeThumbLinkObj( $nt, $label = "", $align = "right", $boxwidth = 180 ) {
- global $wgUploadPath;
+ global $wgUploadPath, $wgLang;
$name = $nt->getDBKey();
$image = Title::makeTitle( Namespace::getImage(), $name );
$url = wfImageUrl( $name );
$alt = preg_replace( "/<[^>]*>/", "", $label);
$alt = htmlspecialchars( $alt );
- list($width, $height, $type, $attr) = getimagesize( $path );
+ if ( file_exists( $path ) )
+ {
+ list($width, $height, $type, $attr) = getimagesize( $path );
+ } else {
+ $width = $height = 200;
+ }
$boxheight = intval( $height/($width/$boxwidth) );
if ( $boxwidth > $width ) {
$boxwidth = $width;
$boxheight = $height;
}
-
+ $oboxwidth = $boxwidth + 2;
$thumbUrl = $this->createThumb( $name, $boxwidth );
$u = $nt->escapeLocalURL();
- $more = htmlspecialchars(wfMsg( "thumbnail-more" ));
-
- $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$boxwidth}px;\">" .
- "<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=\"right\" alt=\"{$more}\"></a>" .
- "<p>{$label}</p></div>";
+ $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;\">";
+ if ( $thumbUrl == "" ) {
+ $s .= str_replace( "$1", $name, wfMsg("missingimage") );
+ $zoom = '';
+ } 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>';
+
+ }
+ $s .= ' <div class="thumbcaption" '.$textalign.'>'.$zoomicon.$label."</div></div>\n</div>";
return $s;
}
return $this->makeKnownLink( $wgLang->specialPage( $pn ),
wfMsg( $key ) );
}
+
+ function makeExternalLink( $url, $text, $escape = true ) {
+ $style = $this->getExternalLinkAttributes( $url, $text );
+ $url = htmlspecialchars( $url );
+ if( $escape ) {
+ $text = htmlspecialchars( $text );
+ }
+ return "<a href=\"$url\"$style>$text</a>";
+ }
# Called by history lists and recent changes
#
$this->rcMoveIndex = 0;
$this->rcCacheIndex = 0 ;
$this->lastdate = "";
+ $this->rclistOpen = false;
return "";
}
function beginImageHistoryList()
{
$s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
- "<p>" . wfMsg( "imghistlegend" ) . "\n<ul>";
+ "<p>" . wfMsg( "imghistlegend" ) . "</p>\n<ul class='special'>";
return $s;
}
function endRecentChangesList()
{
$s = $this->recentChangesBlock() ;
- $s .= "</ul>\n";
+ if( $this->rclistOpen ) {
+ $s .= "</ul>\n";
+ }
return $s;
}
# Enhanced RC ungrouped line
- function recentChangesBlockLine ( $rcObj )
+ function recentChangesBlockLine ( $rcObj )
{
global $wgUploadPath, $wgLang ;
-
+
# Get rc_xxxx variables
extract( $rcObj->mAttribs ) ;
$curIdEq = "curid=$rc_cur_id";
-
+
# 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 .= " ";
} else {
# M & N (minor & new)
$M = wfMsg( "minoreditletter" );
$N = wfMsg( "newpageletter" );
-
+
if ( $rc_type == RC_NEW ) {
$r .= $N ;
} else {
$r .= " " ;
}
}
-
+
# Timestamp
$r .= " ".$rcObj->timestamp." " ;
$r .= "</tt>" ;
$r .= " (" ;
$r .= $rcObj->curlink ;
$r .= "; " ;
-
+
# Hist
$r .= $this->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
# User/talk
$r .= ") . . ".$rcObj->userlink ;
$r .= $rcObj->usertalklink ;
-
+
# Comment
if ( $rc_comment != "" && $rc_type != RC_MOVE ) {
- $r .= $wgLang->emphasize( " (".wfEscapeHTML($rc_comment).")" );
+ $rc_comment=$this->formatComment($rc_comment);
+ $r .= $wgLang->emphasize( " (".$rc_comment.")" );
}
- $r .= "<br>\n" ;
+
+ $r .= "<br />\n" ;
return $r ;
}
# Enhanced RC group
- function recentChangesBlockGroup ( $block )
+ function recentChangesBlockGroup ( $block )
{
global $wgUploadPath, $wgLang ;
-
+
$r = "" ;
$M = wfMsg( "minoreditletter" );
$N = wfMsg( "newpageletter" );
-
+
# Collate list of users
$isnew = false ;
$userlinks = array () ;
if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
$userlinks[$u]++ ;
}
-
+
# Sort the list and convert to text
krsort ( $userlinks ) ;
asort ( $userlinks ) ;
$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' /></a></span>" ;
+ $tl .= "<span id='{$rcl}' style='display:none'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_d.png' width='12' height='12' /></a></span>" ;
$r .= $tl ;
# Main line
# Timestamp
$r .= " ".$block[0]->timestamp." " ;
$r .= "</tt>" ;
-
+
# Article link
$link = $block[0]->link ;
if ( $block[0]->watched ) $link = "<strong>{$link}</strong>" ;
}
$r .= $users ;
- $r .= "<br>\n" ;
+ $r .= "<br />\n" ;
# Sub-entries
$r .= "<div id='{$rci}' style='display:none'>" ;
# 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 />";
$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->userlink ;
$r .= $rcObj->usertalklink ;
if ( $rc_comment != "" ) {
- $r .= $wgLang->emphasize( " (".wfEscapeHTML($rc_comment).")" ) ;
+ $rc_comment=$this->formatComment($rc_comment);
+ $r .= $wgLang->emphasize( " (".$rc_comment.")" ) ;
}
- $r .= "<br>\n" ;
+ $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
$line = $this->recentChangesLineOld ( $rc, $watched ) ;
return $line ;
}
-
+
function recentChangesLineOld( &$rc, $watched = false )
{
- global $wgTitle, $wgLang, $wgUser;
-
+ global $wgTitle, $wgLang, $wgUser, $wgRCSeconds;
+
# Extract DB fields into local scope
extract( $rc->mAttribs );
$curIdEq = "curid=" . $rc_cur_id;
-
+
# Make date header if necessary
$date = $wgLang->date( $rc_timestamp, true);
$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;
+ $this->rclistOpen = true;
}
$s .= "<li> ";
-
+
if ( $rc_type == RC_MOVE ) {
# Diff
$s .= "(" . wfMsg( "diff" ) . ") (";
$diffLink = wfMsg( "diff" );
} else {
$diffLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "diff" ),
- "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
+ "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" ,'' ,'' , ' tabindex="'.$rc->counter.'"');
}
$s .= "($diffLink) (";
-
+
# History link
- $s .= $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
+ $s .= $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
$s .= ") . . ";
# M and N (minor and new)
$s .= " $articleLink";
}
-
+
# Timestamp
- $s .= "; " . $wgLang->time( $rc_timestamp, true ) . " . . ";
-
+ $s .= "; " . $wgLang->time( $rc_timestamp, true, $wgRCSeconds ) . " . . ";
+
# User link (or contributions for unregistered users)
if ( 0 == $rc_user ) {
$userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
- $rc_user_text, "target=" . $rc_user_text );
- } else {
- $userLink = $this->makeLink( $wgLang->getNsText( NS_USER ) . ":{$rc_user_text}", $rc_user_text );
+ $rc_user_text, "target=" . $rc_user_text );
+ } else {
+ $userLink = $this->makeLink( $wgLang->getNsText( NS_USER ) . ":{$rc_user_text}", $rc_user_text );
}
$s .= $userLink;
-
+
# User talk link
$talkname=$wgLang->getNsText(NS_TALK); # use the shorter name
global $wgDisableAnonTalk;
if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
$blockLink = $this->makeKnownLink( $wgLang->specialPage(
"Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
-
+
}
- if($blockLink) {
+ if($blockLink) {
if($userTalkLink) $userTalkLink .= " | ";
$userTalkLink .= $blockLink;
}
# Add comment
if ( "" != $rc_comment && "*" != $rc_comment && $rc_type != RC_MOVE ) {
- $s .= $wgLang->emphasize(" (" . wfEscapeHTML( $rc_comment ) . ")");
+ $rc_comment=$this->formatComment($rc_comment);
+ $s .= $wgLang->emphasize(" (" . $rc_comment . ")");
}
$s .= "</li>\n";
return $s;
}
-
+
# function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
function recentChangesLineNew( &$baseRC, $watched = false )
{
- global $wgTitle, $wgLang, $wgUser;
+ global $wgTitle, $wgLang, $wgUser, $wgRCSeconds;
# Create a specialised object
$rc = RCCacheEntry::newFromParent( $baseRC ) ;
$clink = $this->makeKnownLinkObj( $rc->getTitle(), "" ) ;
}
- $time = $wgLang->time( $rc_timestamp, true );
+ $time = $wgLang->time( $rc_timestamp, true, $wgRCSeconds );
$rc->watched = $watched ;
$rc->link = $clink ;
$rc->timestamp = $time;
$curLink = wfMsg( "cur" );
} else {
$curLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "cur" ),
- "{$curIdEq}&diff=0&oldid={$rc_this_oldid}" );
+ "{$curIdEq}&diff=0&oldid={$rc_this_oldid}" ,'' ,'' , ' tabindex="'.$baseRC->counter.'"' );
}
# Make "last" link
$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 ) ;
return $s;
}
+ /* This function is called by all recent changes variants, by the page history,
+ and by the user contributions list. It is responsible for formatting edit
+ comments. It escapes any HTML in the comment, but adds some CSS to format
+ auto-generated comments (from section editing) and formats [[wikilinks]].
+ Main author: Erik Möller (moeller@scireview.de)
+ */
+ function formatComment($comment)
+ {
+ global $wgLang;
+ $comment=wfEscapeHTML($comment);
+
+ # The pattern for autogen comments is / * foo * /, which makes for
+ # some nasty regex.
+ # We look for all comments, match any text before and after the comment,
+ # add a separator where needed and format the comment itself with CSS
+ while (preg_match("/(.*)\/\*\s*(.*?)\s*\*\/(.*)/", $comment,$match)) {
+ $pre=$match[1];
+ $auto=$match[2];
+ $post=$match[3];
+ $sep="-";
+ if($pre) { $auto="$sep ".$auto; }
+ if($post) { $auto.=" $sep"; }
+ $auto="<span class=\"autocomment\">".$auto."</span>";
+ $comment=$pre.$auto.$post;
+ }
+
+ # format regular and media links - all other wiki formatting
+ # is ignored
+ while(preg_match("/\[\[(.*?)(\|(.*?))*\]\]/",$comment,$match)) {
+
+ $medians = $wgLang->getNsText(Namespace::getMedia());
+ $func="makeLink";
+ if(preg_match("/^".$medians."/i",$match[1])) {
+ $func="makeMediaLink";
+ }
+ if(isset($match[3]) ) {
+ $comment=
+ preg_replace("/\[\[(.*?)\]\]/",
+ $this->$func($match[1],$match[3]),$comment,1);
+ } else {
+ $comment=
+ preg_replace("/\[\[(.*?)\]\]/",
+ $this->$func($match[1],$match[1]),$comment,1);
+ }
+ }
+
+ return $comment;
+
+ }
+
function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
{
global $wgUser, $wgLang, $wgTitle;
$url = wfImageUrl( $img );
$rlink = $cur;
if ( $wgUser->isSysop() ) {
- $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
+ $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
"&action=delete" );
$style = $this->getInternalLinkAttributes( $link, $del );
. " . . {$ul} ({$nb})";
if ( "" != $c && "*" != $c ) {
- $s .= $wgLang->emphasize(" (" . wfEscapeHTML( $c ) . ")");
+ $sk=$wgUser->getSkin();
+ $s .= $wgLang->emphasize(" (" . $sk->formatComment($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>0 ? $level : 0 );
}
function tocUnindent($level) {
- $rv = "";
- while($level-->0) $rv.="</div>\n";
- return $rv;
+ return str_repeat( "</div>\n", $level>0 ? $level : 0 );
}
- // 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>";
- }
+ # 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".
+ "<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";
+ $toc."</td></tr></table>\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;
+ 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>";
+ return "<span oncontextmenu='document.location=\"$url\";return false;'>{$head}</span>";
}
- function editSectionLink($section) {
- global $printable,$oldid;
+ function editSectionLink( $section ) {
+ global $wgRequest;
global $wgTitle, $wgUser, $wgLang;
-
- if( isset( $oldid ) ) return "";
- if( isset( $printable ) ) return "";
-
+
+ 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 "";
+ }
+
$editurl = "§ion={$section}";
$url = $this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
-
+
if( $wgLang->isRTL() ) {
$farside = "left";
$nearside = "right";
$farside = "right";
$nearside = "left";
}
- return "<div style=\"float:$farside;margin-$nearside:5px;\"><small>[".$url."]</small></div>";
+ return "<div class=\"editsection\" style=\"float:$farside;margin-$nearside:5px;\">[".$url."]</div>";
}
// 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;
+ global $wgUploadPath, $wgLang, $wgMimeType;
// toolarray an array of arrays which each include the filename of
// the button image (without path), the opening tag, the closing tag,
// and optionally a sample text that is inserted between the two when no
// selection is highlighted.
// The tip text is shown when the user moves the mouse over the button.
+
+ // Already here are accesskeys (key), which are not used yet until someone
+ // can figure out a way to make them work in IE. However, we should make
+ // sure these keys are not defined on the edit page.
$toolarray=array(
array( "image"=>"button_bold.png",
"open"=>"\'\'\'",
"close"=>"\'\'\'",
"sample"=>wfMsg("bold_sample"),
- "tip"=>wfMsg("bold_tip")),
+ "tip"=>wfMsg("bold_tip"),
+ "key"=>"B"
+ ),
array( "image"=>"button_italic.png",
"open"=>"\'\'",
"close"=>"\'\'",
"sample"=>wfMsg("italic_sample"),
- "tip"=>wfMsg("italic_tip")),
+ "tip"=>wfMsg("italic_tip"),
+ "key"=>"I"
+ ),
array( "image"=>"button_link.png",
"open"=>"[[",
"close"=>"]]",
"sample"=>wfMsg("link_sample"),
- "tip"=>wfMsg("link_tip")),
+ "tip"=>wfMsg("link_tip"),
+ "key"=>"L"
+ ),
array( "image"=>"button_extlink.png",
"open"=>"[",
"close"=>"]",
"sample"=>wfMsg("extlink_sample"),
- "tip"=>wfMsg("extlink_tip")),
+ "tip"=>wfMsg("extlink_tip"),
+ "key"=>"X"
+ ),
array( "image"=>"button_headline.png",
"open"=>"\\n== ",
"close"=>" ==\\n",
"sample"=>wfMsg("headline_sample"),
- "tip"=>wfMsg("headline_tip")),
+ "tip"=>wfMsg("headline_tip"),
+ "key"=>"H"
+ ),
array( "image"=>"button_image.png",
"open"=>"[[".$wgLang->getNsText(NS_IMAGE).":",
"close"=>"]]",
"sample"=>wfMsg("image_sample"),
- "tip"=>wfMsg("image_tip")),
+ "tip"=>wfMsg("image_tip"),
+ "key"=>"D"
+ ),
array( "image"=>"button_media.png",
"open"=>"[[".$wgLang->getNsText(NS_MEDIA).":",
"close"=>"]]",
"sample"=>wfMsg("media_sample"),
- "tip"=>wfMsg("media_tip")),
+ "tip"=>wfMsg("media_tip"),
+ "key"=>"M"
+ ),
array( "image"=>"button_math.png",
"open"=>"\\<math\\>",
"close"=>"\\</math\\>",
"sample"=>wfMsg("math_sample"),
- "tip"=>wfMsg("math_tip")),
+ "tip"=>wfMsg("math_tip"),
+ "key"=>"C"
+ ),
array( "image"=>"button_nowiki.png",
"open"=>"\\<nowiki\\>",
"close"=>"\\</nowiki\\>",
"sample"=>wfMsg("nowiki_sample"),
- "tip"=>wfMsg("nowiki_tip")),
+ "tip"=>wfMsg("nowiki_tip"),
+ "key"=>"N"
+ ),
array( "image"=>"button_sig.png",
"open"=>"--~~~~",
"close"=>"",
"sample"=>"",
- "tip"=>wfMsg("sig_tip")),
+ "tip"=>wfMsg("sig_tip"),
+ "key"=>"Y"
+ ),
array( "image"=>"button_hr.png",
"open"=>"\\n----\\n",
"close"=>"",
"sample"=>"",
- "tip"=>wfMsg("hr_tip"))
+ "tip"=>wfMsg("hr_tip"),
+ "key"=>"R"
+ )
);
- $toolbar.="<script type='text/javascript'>\n";
+ $toolbar ="<script type='text/javascript'>\n/*<![CDATA[*/\n";
+
$toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
foreach($toolarray as $tool) {
// Ideally these should be different, realistically they
// probably don't need to be.
$tip = addslashes( $tool["tip"] );
+
+ #$key = $tool["key"];
+
$toolbar.="addButton('$image','$tip','$open','$close','$sample');\n";
}
- $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "');\n";
- $toolbar.="document.writeln(\"</div>\");\n</script>";
+ $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "','" . addslashes(wfMsg("infobox_alert")) . "');\n";
+ $toolbar.="document.writeln(\"</div>\");\n";
+
+ $toolbar.="/*]]>*/\n</script>";
return $toolbar;
}
}
include_once( "SkinNostalgia.php" );
include_once( "SkinCologneBlue.php" );
-#include_once( "SkinSmarty.php" );
+if( $wgUsePHPTal ) {
+ include_once( "SkinPHPTal.php" );
+}
+
?>