4 # These are the INTERNAL names, which get mapped
5 # directly to class names. For display purposes, the
6 # Language class has internationalized names
8 /* private */ $wgValidSkinNames = array(
9 "Standard", "Nostalgia", "CologneBlue"
12 # For some odd PHP bug, this function can't be part of a class
13 function getCategories ()
15 global $wgOut , $wgTitle , $wgUseCategoryMagic , $wgUser ;
16 if ( !isset ( $wgUseCategoryMagic ) ||
!$wgUseCategoryMagic ) return "" ;
17 if ( count ( $wgOut->mCategoryLinks
) == 0 ) return "" ;
18 if ( !$wgOut->isArticle() ) return "" ;
19 $sk = $wgUser->getSkin() ;
22 $s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ;
23 $t = implode ( " | " , $wgOut->mCategoryLinks
) ;
24 if ( $t != "" ) $s .= " : " ;
30 class RecentChangesClass
{
31 var $secureName , $displayName , $link , $namespace ;
32 var $oldid , $diffid , $timestamp , $curlink , $lastlink , $usertalklink , $versionlink ;
33 var $usercomment , $userlink ;
34 var $isminor , $isnew , $watched , $islog ;
39 /* private */ var $lastdate, $lastline;
41 var $rc_cache ; # Cache for Enhanced Recent Changes
42 var $rccc ; # Recent Changes Cache Counter for visibility toggle
49 function getSkinNames()
51 global $wgValidSkinNames;
52 return $wgValidSkinNames;
55 function getStylesheet()
57 return "wikistandard.css";
62 global $wgOut, $wgUser;
64 if ( $wgOut->isQuickbarSupressed() ) { return 0; }
65 $q = $wgUser->getOption( "quickbar" );
66 if ( "" == $q ) { $q = 0; }
72 global $wgOut, $wgStyleSheetPath;
73 wfProfileIn( "Skin::initPage" );
75 $wgOut->addLink( "shortcut icon", "", "/favicon.ico" );
76 if ( $wgOut->isPrintable() ) { $ss = "wikiprintable.css"; }
77 else { $ss = $this->getStylesheet(); }
78 $wgOut->addLink( "stylesheet", "", "{$wgStyleSheetPath}/{$ss}" );
82 function getHeadScripts() {
83 global $wgStyleSheetPath;
84 $r = "<script type=\"text/javascript\" src=\"{$wgStyleSheetPath}/wikibits.js\"></script>\n";
88 function getUserStyles()
90 $s = "<style type='text/css'><!--\n";
91 $s .= $this->doGetUserStyles();
92 $s .= "//--></style>\n";
96 function doGetUserStyles()
101 if ( 1 == $wgUser->getOption( "underline" ) ) {
102 # Don't override browser settings
105 $s .= "a.stub, a.new, a.internal, a.external { " .
106 "text-decoration: none; }\n";
108 if ( 1 == $wgUser->getOption( "highlightbroken" ) ) {
109 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
111 if ( 1 == $wgUser->getOption( "justify" ) ) {
112 $s .= "#article { text-align: justify; }\n";
117 function getBodyOptions()
119 global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $oldid, $redirect, $diff,$action;
121 if ( 0 != $wgTitle->getNamespace() ) {
122 $a = array( "bgcolor" => "#ffffec" );
124 else $a = array( "bgcolor" => "#FFFFFF" );
125 if($wgOut->isArticle() && $wgUser->getOption("editondblclick")
127 (!$wgTitle->isProtected() ||
$wgUser->isSysop())
130 $n = $wgTitle->getPrefixedURL();
131 $t = wfMsg( "editthispage" );
133 if ( $redirect ) { $red = "&redirect={$redirect}"; }
134 if ( $oldid && ! isset( $diff ) ) {
135 $oid = "&oldid={$oldid}";
137 $s = wfLocalUrlE($n,"action=edit{$oid}{$red}");
138 $s = "document.location = \"" .$s ."\";";
139 $a +
= array ("ondblclick" => $s);
142 if($action=="edit") { # set focus in edit box
143 $foc = "document.editform.wpTextbox1.focus()";
145 $a['onload'] .= ";$foc";
153 function getExternalLinkAttributes( $link, $text )
155 global $wgUser, $wgOut, $wgLang;
157 $link = urldecode( $link );
158 $link = $wgLang->checkTitleEncoding( $link );
159 $link = str_replace( "_", " ", $link );
160 $link = wfEscapeHTML( $link );
162 if ( $wgOut->isPrintable() ) { $r = " class='printable'"; }
163 else { $r = " class='external'"; }
165 if ( 1 == $wgUser->getOption( "hover" ) ) {
166 $r .= " title=\"{$link}\"";
171 function getInternalLinkAttributes( $link, $text, $broken = false )
173 global $wgUser, $wgOut;
175 $link = urldecode( $link );
176 $link = str_replace( "_", " ", $link );
177 $link = wfEscapeHTML( $link );
179 if ( $wgOut->isPrintable() ) { $r = " class='printable'"; }
180 else if ( $broken == "stub" ) { $r = " class='stub'"; }
181 else if ( $broken == "yes" ) { $r = " class='new'"; }
182 else { $r = " class='internal'"; }
184 if ( 1 == $wgUser->getOption( "hover" ) ) {
185 $r .= " title=\"{$link}\"";
196 # This will be called immediately after the <body> tag. Split into
197 # two functions to make it easier to subclass.
199 function beforeContent()
201 global $wgUser, $wgOut;
203 if ( $wgOut->isPrintable() ) {
204 $s = $this->pageTitle() . $this->pageSubtitle() . "\n";
205 $s .= "\n<div class='bodytext'>";
208 return $this->doBeforeContent();
211 function doBeforeContent()
213 global $wgUser, $wgOut, $wgTitle, $wgLang;
214 wfProfileIn( "Skin::doBeforeContent" );
217 $qb = $this->qbSetting();
219 if( $langlinks = $this->otherLanguages() ) {
225 $borderhack = "class='top'";
228 $s .= "\n<div id='content'>\n<div id='topbar'>" .
229 "<table width='98%' border=0 cellspacing=0><tr>";
232 $left = ($qb == 1 ||
$qb == 3);
233 if($wgLang->isRTL()) $left = !$left;
236 $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>" .
237 $this->logoText() . "</td>";
239 $s .= $this->getQuickbarCompensator( $rows );
241 $l = $wgLang->isRTL() ?
"right" : "left";
242 $s .= "<td {$borderhack} align='$l' valign='top'>";
244 $s .= $this->topLinks() ;
245 $s .= "<p class='subtitle'>" . $this->pageTitleLinks();
247 $r = $wgLang->isRTL() ?
"left" : "right";
248 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap>";
249 $s .= $this->nameAndLogin();
250 $s .= "\n<br>" . $this->searchForm() . "</td>";
253 $s .= "</tr>\n<tr><td class='top' colspan=\"2\">$langlinks</td>";
256 if ( $shove && !$left ) { # Right
257 $s .= $this->getQuickbarCompensator( $rows );
259 $s .= "</tr></table>\n</div>\n";
260 $s .= "\n<div id='article'>";
262 $s .= $this->pageTitle();
263 $s .= $this->pageSubtitle() ;
264 $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
270 function getQuickbarCompensator( $rows = 1 )
272 return "<td width='152' rowspan='{$rows}'> </td>";
275 # This gets called immediately before the </body> tag.
277 function afterContent()
279 global $wgUser, $wgOut, $wgServer, $HTTP_SERVER_VARS;
282 if ( $wgOut->isPrintable() ) {
285 $u = $wgServer . $wgTitle->getFullURL();
286 $rf = wfMsg( "retrievedfrom", $u );
288 if ( $wgOut->isArticle() ) {
289 $lm = "<br>" . $this->lastModified();
292 $cr = wfMsg( "gnunote" );
293 $s .= "<p><em>{$rf}{$lm} {$cr}</em>\n";
296 return $this->doAfterContent();
299 function doAfterContent()
301 global $wgUser, $wgOut, $wgLang;
302 wfProfileIn( "Skin::doAfterContent" );
304 $s = "\n</div><br clear=all>\n";
306 $s .= "\n<div id='footer'>";
307 $s .= "<table width='98%' border=0 cellspacing=0><tr>";
309 $qb = $this->qbSetting();
311 $left = ($qb == 1 ||
$qb == 3);
312 if($wgLang->isRTL()) $left = !$left;
314 if ( $shove && $left ) { # Left
315 $s .= $this->getQuickbarCompensator();
317 $l = $wgLang->isRTL() ?
"right" : "left";
318 $s .= "<td class='bottom' align='$l' valign='top'>";
320 $s .= $this->bottomLinks();
321 $s .= "\n<br>" . $this->mainPageLink()
322 . " | " . $this->aboutLink()
323 . " | " . $this->specialLink( "recentchanges" )
324 . " | " . $this->searchForm()
325 . "<br>" . $this->pageStats();
328 if ( $shove && !$left ) { # Right
329 $s .= $this->getQuickbarCompensator();
331 $s .= "</tr></table>\n</div>\n</div>\n";
333 if ( 0 != $qb ) { $s .= $this->quickBar(); }
338 function pageTitleLinks()
340 global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval ;
342 $s = $this->printableLink();
344 if ( $wgOut->isArticle() ) {
345 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
346 $name = $wgTitle->getDBkey();
347 $link = wfEscapeHTML( wfImageUrl( $name ) );
348 $style = $this->getInternalLinkAttributes( $link, $name );
349 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
351 # This will show the "Approve" link if $wgUseApproval=true;
352 if ( isset ( $wgUseApproval ) && $wgUseApproval )
354 $t = $wgTitle->getDBkey();
355 $name = "Approve this article" ;
356 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
357 #wfEscapeHTML( wfImageUrl( $name ) );
358 $style = $this->getExternalLinkAttributes( $link, $name );
359 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
361 if ( "history" == $action ||
isset( $diff ) ||
isset( $oldid ) ) {
362 $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
363 wfMsg( "currentrev" ) );
366 if ( $wgUser->getNewtalk() ) {
367 # do not show "You have new messages" text when we are viewing our
370 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
371 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
372 $n =$wgUser->getName();
373 $tl = $this->makeKnownLink( $wgLang->getNsText(
374 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
375 wfMsg("newmessageslink") );
376 $s.=" | <strong>". str_replace( "$1", $tl, wfMsg("newmessages") ) . "</strong>";
379 if( $wgUser->isSysop() &&
380 (($wgTitle->getArticleId() == 0) ||
($action == "history")) &&
381 ($n = $wgTitle->isDeleted() ) ) {
382 $s .= " | " . wfMsg( "thisisdeleted",
383 $this->makeKnownLink(
384 $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
385 wfMsg( "restorelink", $n ) ) );
390 function printableLink()
392 global $wgOut, $wgTitle, $oldid, $action;
394 if ( "history" == $action ) { $q = "action=history&"; }
397 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
398 WfMsg( "printableversion" ), "{$q}printable=yes" );
404 global $wgOut, $wgTitle, $wgUser;
406 $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
407 if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
411 function pageSubtitle()
413 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
415 $sub = $wgOut->getSubtitle();
416 if ( "" == $sub ) { $sub = wfMsg( "fromwikipedia" ); }
417 if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
418 $ptext=$wgTitle->getPrefixedText();
419 if(preg_match("/\//",$ptext)) {
420 $sub.="</p><p class='subpages'>";
421 $links=explode("/",$ptext);
424 foreach($links as $link) {
426 if ($c<count($links)) {
428 $getlink=$this->makeLink($growinglink,$link);
429 if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
442 $s = "<p class='subtitle'>{$sub}\n";
446 function nameAndLogin()
448 global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader;
450 $li = $wgLang->specialPage( "Userlogin" );
451 $lo = $wgLang->specialPage( "Userlogout" );
454 if ( 0 == $wgUser->getID() ) {
455 if( $wgShowIPinHeader ) {
456 $n = getenv( "REMOTE_ADDR" );
458 $tl = $this->makeKnownLink( $wgLang->getNsText(
459 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
460 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
462 $s .= $n . " (".$tl.")";
464 $s .= wfMsg("notloggedin");
467 $rt = $wgTitle->getPrefixedURL();
468 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
470 } else { $q = "returnto={$rt}"; }
472 $s .= "\n<br>" . $this->makeKnownLink( $li,
473 wfMsg( "login" ), $q );
475 $n = $wgUser->getName();
476 $rt = $wgTitle->getPrefixedURL();
477 $tl = $this->makeKnownLink( $wgLang->getNsText(
478 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
479 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
483 $s .= $this->makeKnownLink( $wgLang->getNsText(
484 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br>" .
485 $this->makeKnownLink( $lo, wfMsg( "logout" ),
486 "returnto={$rt}" ) . " | " .
487 $this->specialLink( "preferences" );
489 $s .= " | " . $this->makeKnownLink( wfMsg( "helppage" ),
495 function searchForm()
499 $s = "<form name='search' class='inline' method=get action=\""
500 . wfLocalUrl( "" ) . "\">"
501 . "<input type=text name=\"search\" size=19 value=\""
502 . htmlspecialchars(substr($search,0,256)) . "\">\n"
503 . "<input type=submit name=\"go\" value=\"" . wfMsg ("go") . "\"> "
504 . "<input type=submit value=\"" . wfMsg ("search") . "\"></form>";
514 $s = $this->mainPageLink() . $sep
515 . $this->specialLink( "recentchanges" );
517 if ( $wgOut->isArticle() ) {
518 $s .= $sep . $this->editThisPage()
519 . $sep . $this->historyLink();
521 # Many people don't like this dropdown box
522 #$s .= $sep . $this->specialPagesList();
527 function bottomLinks()
529 global $wgOut, $wgUser, $wgTitle;
533 if ( $wgOut->isArticle() ) {
534 $s .= "<strong>" . $this->editThisPage() . "</strong>";
535 if ( 0 != $wgUser->getID() ) {
536 $s .= $sep . $this->watchThisPage();
538 $s .= $sep . $this->talkLink()
539 . $sep . $this->historyLink()
540 . $sep . $this->whatLinksHere()
541 . $sep . $this->watchPageLinksLink();
543 if ( $wgTitle->getNamespace() == Namespace::getUser()
544 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
547 $id=User
::idFromName($wgTitle->getText());
548 $ip=User
::isIP($wgTitle->getText());
550 if($id ||
$ip) { # both anons and non-anons have contri list
551 $s .= $sep . $this->userContribsLink();
553 if ( 0 != $wgUser->getID() ) { # show only to signed in users
554 if($id) { # can only email non-anons
555 $s .= $sep . $this->emailUserLink();
559 if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
560 $s .= "\n<br>" . $this->deleteThisPage() .
561 $sep . $this->protectThisPage() .
562 $sep . $this->moveThisPage();
564 $s .= "<br>\n" . $this->otherLanguages();
571 global $wgOut, $wgLang, $wgArticle;
572 global $oldid, $diff, $wgDisableCounters;
574 if ( ! $wgOut->isArticle() ) { return ""; }
575 if ( isset( $oldid ) ||
isset( $diff ) ) { return ""; }
576 if ( 0 == $wgArticle->getID() ) { return ""; }
578 if ( $wgDisableCounters ) {
581 $count = $wgArticle->getCount();
582 $s = str_replace( "$1", $count, wfMsg( "viewcount" ) );
584 $s .= $this->lastModified();
585 $s .= " " . wfMsg( "gnunote" );
586 return "<span id='pagestats'>{$s}</span>";
589 function lastModified()
591 global $wgLang, $wgArticle;
593 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
594 $s = " " . str_replace( "$1", $d, wfMsg( "lastmodified" ) );
598 function logoText( $align = "" )
600 if ( "" != $align ) { $a = " align='{$align}'"; }
603 $mp = wfMsg( "mainpage" );
604 $s = "<a href=\"" . wfLocalUrlE( urlencode( $mp ) )
605 . "\"><img{$a} border=0 src=\""
606 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\"></a>";
612 global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
614 wfProfileIn( "Skin::quickBar" );
615 $tns=$wgTitle->getNamespace();
617 $s = "\n<div id='quickbar'>";
618 $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
621 $s .= $this->mainPageLink()
622 . $sep . $this->specialLink( "recentchanges" )
623 . $sep . $this->specialLink( "randompage" );
624 if ($wgUser->getID()) {
625 $s.= $sep . $this->specialLink( "watchlist" ) ;
626 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
627 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
630 // only show watchlist link if logged in
631 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
632 $s .= "\n<br><hr class='sep'>";
633 $articleExists = $wgTitle->getArticleId();
634 if ( $wgOut->isArticle() ||
$action =="edit" ||
$action =="history" ||
$wpPreview) {
636 if($wgOut->isArticle()) {
637 $s .= "<strong>" . $this->editThisPage() . "</strong>";
638 } else { # backlink to the article in edit or history mode
639 if($articleExists){ # no backlink if no article
642 $text = wfMsg("articlepage");
645 $text = wfMsg("viewtalkpage");
648 $text = wfMsg("userpage");
651 $text = wfMsg("viewtalkpage");
654 $text = wfMsg("wikipediapage");
657 $text = wfMsg("viewtalkpage");
660 $text = wfMsg("imagepage");
663 $text = wfMsg("viewtalkpage");
666 $text= wfMsg("articlepage");
669 $link = $wgTitle->getText();
670 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
671 $link = $nstext . ":" . $link ;
673 $s .= $this->makeLink($link, $text );
674 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
675 # we just throw in a "New page" text to tell the user that he's in edit mode,
676 # and to avoid messing with the separator that is prepended to the next item
677 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
683 if( $tns%2
&& $action!="edit" && !$wpPreview) {
684 $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
688 watching could cause problems in edit mode:
689 if user edits article, then loads "watch this article" in background and then saves
690 article with "Watch this article" checkbox disabled, the article is transparently
691 unwatched. Therefore we do not show the "Watch this page" link in edit mode
693 if ( 0 != $wgUser->getID() && $articleExists) {
694 if($action!="edit" && $action!="history" &&
695 $action != "submit" )
696 {$s .= $sep . $this->watchThisPage(); }
697 if ( $wgTitle->userCanEdit() ) $s .= $sep . $this->moveThisPage();
699 if ( $wgUser->isSysop() and $articleExists ) {
700 $s .= $sep . $this->deleteThisPage() .
701 $sep . $this->protectThisPage();
703 $s .= $sep . $this->talkLink();
704 if ($articleExists && $action !="history") { $s .= $sep . $this->historyLink();}
705 $s.=$sep . $this->whatLinksHere();
707 if($wgOut->isArticle()) {
708 $s .= $sep . $this->watchPageLinksLink();
711 if ( Namespace::getUser() == $wgTitle->getNamespace()
712 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
715 $id=User
::idFromName($wgTitle->getText());
716 $ip=User
::isIP($wgTitle->getText());
719 $s .= $sep . $this->userContribsLink();
721 if ( 0 != $wgUser->getID() ) {
722 if($id) { # can only email real users
723 $s .= $sep . $this->emailUserLink();
727 $s .= "\n<br><hr class='sep'>";
730 if ( 0 != $wgUser->getID() ) {
731 $s .= $this->specialLink( "upload" ) . $sep;
733 $s .= $this->specialLink( "specialpages" )
734 . $sep . $this->bugReportsLink();
736 $s .= "\n<br></div>\n";
741 function specialPagesList()
743 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
746 $validSP = $wgLang->getValidSpecialPages();
748 foreach ( $validSP as $name => $desc ) {
749 if ( "" == $desc ) { continue; }
752 if ( $wgUser->isSysop() )
754 $sysopSP = $wgLang->getSysopSpecialPages();
756 foreach ( $sysopSP as $name => $desc ) {
757 if ( "" == $desc ) { continue; }
761 if ( $wgUser->isDeveloper() )
763 $devSP = $wgLang->getDeveloperSpecialPages();
765 foreach ( $devSP as $name => $desc ) {
766 if ( "" == $desc ) { continue; }
771 $sp = wfMsg( "specialpages" );
772 $spp = $wgLang->specialPage( "Specialpages" );
774 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
775 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
776 $s .= "<select name=\"wpDropdown\">\n";
777 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
779 foreach ( $a as $name => $desc ) {
780 $p = $wgLang->specialPage( $name );
781 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
784 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
789 function mainPageLink()
791 $mp = wfMsg( "mainpage" );
792 $s = $this->makeKnownLink( $mp, $mp );
796 function copyrightLink()
798 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
799 wfMsg( "copyrightpagename" ) );
805 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
806 wfMsg( "aboutwikipedia" ) );
810 function editThisPage()
812 global $wgOut, $wgTitle, $oldid, $redirect, $diff;
814 if ( ! $wgOut->isArticle() ||
$diff ) {
815 $s = wfMsg( "protectedpage" );
816 } else if ( $wgTitle->userCanEdit() ) {
817 $n = $wgTitle->getPrefixedText();
818 $t = wfMsg( "editthispage" );
821 if ( $redirect ) { $red = "&redirect={$redirect}"; }
822 if ( $oldid && ! isset( $diff ) ) {
823 $oid = "&oldid={$oldid}";
825 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
827 $s = wfMsg( "protectedpage" );
832 function deleteThisPage()
834 global $wgUser, $wgOut, $wgTitle, $diff;
836 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
837 $n = $wgTitle->getPrefixedText();
838 $t = wfMsg( "deletethispage" );
840 $s = $this->makeKnownLink( $n, $t, "action=delete" );
842 $s = wfMsg( "error" );
847 function protectThisPage()
849 global $wgUser, $wgOut, $wgTitle, $diff;
851 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
852 $n = $wgTitle->getPrefixedText();
854 if ( $wgTitle->isProtected() ) {
855 $t = wfMsg( "unprotectthispage" );
856 $q = "action=unprotect";
858 $t = wfMsg( "protectthispage" );
859 $q = "action=protect";
861 $s = $this->makeKnownLink( $n, $t, $q );
863 $s = wfMsg( "error" );
868 function watchThisPage()
870 global $wgUser, $wgOut, $wgTitle, $diff;
872 if ( $wgOut->isArticle() && ( ! $diff ) ) {
873 $n = $wgTitle->getPrefixedText();
875 if ( $wgTitle->userIsWatching() ) {
876 $t = wfMsg( "unwatchthispage" );
877 $q = "action=unwatch";
879 $t = wfMsg( "watchthispage" );
882 $s = $this->makeKnownLink( $n, $t, $q );
884 $s = wfMsg( "notanarticle" );
889 function moveThisPage()
891 global $wgTitle, $wgLang;
893 if ( $wgTitle->userCanEdit() ) {
894 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
895 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
896 } // no message if page is protected - would be redundant
900 function historyLink()
904 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
905 wfMsg( "history" ), "action=history" );
909 function whatLinksHere()
911 global $wgTitle, $wgLang;
913 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
914 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
918 function userContribsLink()
920 global $wgTitle, $wgLang;
922 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
923 wfMsg( "contributions" ), "target=" . $wgTitle->getURL() );
927 function emailUserLink()
929 global $wgTitle, $wgLang;
931 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
932 wfMsg( "emailuser" ), "target=" . $wgTitle->getURL() );
936 function watchPageLinksLink()
938 global $wgOut, $wgTitle, $wgLang;
940 if ( ! $wgOut->isArticle() ) {
941 $s = "(" . wfMsg( "notanarticle" ) . ")";
943 $s = $this->makeKnownLink( $wgLang->specialPage(
944 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
945 "target=" . $wgTitle->getPrefixedURL() );
950 function otherLanguages()
952 global $wgOut, $wgLang, $wgTitle , $wgUseNewInterlanguage ;
954 $a = $wgOut->getLanguageLinks();
955 if ( 0 == count( $a ) ) {
956 if ( !$wgUseNewInterlanguage ) return "";
957 $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
958 if ( $ns != 0 AND $ns != 1 ) return "" ;
960 $x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
961 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
962 wfMsg( "intl" ) , $x );
965 if ( !$wgUseNewInterlanguage ) {
966 $s = wfMsg( "otherlanguages" ) . ": ";
968 global $wgLanguageCode ;
969 $x = "mode=zoom&xt=".$wgTitle->getDBkey() ;
970 $x .= "&xl=".$wgLanguageCode ;
971 $s = $this->makeKnownLink( $wgLang->specialPage( "Intl" ),
972 wfMsg( "otherlanguages" ) , $x ) . ": " ;
976 if($wgLang->isRTL()) $s .= "<span dir='LTR'>";
977 foreach( $a as $l ) {
978 if ( ! $first ) { $s .= " | "; }
981 $nt = Title
::newFromText( $l );
982 $url = $nt->getFullURL();
983 $text = $wgLang->getLanguageName( $nt->getInterwiki() );
985 if ( "" == $text ) { $text = $l; }
986 $style = $this->getExternalLinkAttributes( $l, $text );
987 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
989 if($wgLang->isRTL()) $s .= "</span>";
993 function bugReportsLink()
995 $s = $this->makeKnownLink( wfMsg( "bugreportspage" ),
996 wfMsg( "bugreports" ) );
1002 global $wgLinkCache;
1003 $t1 = Title
::newFromText( gmdate( "F j" ) );
1004 $t2 = Title
::newFromText( gmdate( "Y" ) );
1006 $wgLinkCache->suspend();
1007 $id = $t1->getArticleID();
1008 $wgLinkCache->resume();
1011 $s = $this->makeBrokenLink( $t1->getText() );
1013 $s = $this->makeKnownLink( $t1->getText() );
1017 $wgLinkCache->suspend();
1018 $id = $t2->getArticleID();
1019 $wgLinkCache->resume();
1022 $s .= $this->makeBrokenLink( $t2->getText() );
1024 $s .= $this->makeKnownLink( $t2->getText() );
1031 global $wgLang, $wgTitle, $wgLinkCache;
1033 $tns = $wgTitle->getNamespace();
1034 if ( -1 == $tns ) { return ""; }
1036 $pn = $wgTitle->getText();
1037 $tp = wfMsg( "talkpage" );
1038 if ( Namespace::isTalk( $tns ) ) {
1039 $lns = Namespace::getSubject( $tns );
1042 $text = wfMsg("articlepage");
1045 $text = wfMsg("userpage");
1048 $text = wfMsg("wikipediapage");
1051 $text = wfMsg("imagepage");
1054 $text= wfMsg("articlepage");
1058 $lns = Namespace::getTalk( $tns );
1061 $n = $wgLang->getNsText( $lns );
1062 if ( "" == $n ) { $link = $pn; }
1063 else { $link = "{$n}:{$pn}"; }
1065 $wgLinkCache->suspend();
1066 $s = $this->makeLink( $link, $text );
1067 $wgLinkCache->resume();
1072 # After all the page content is transformed into HTML, it makes
1073 # a final pass through here for things like table backgrounds.
1075 function transformContent( $text )
1080 # Note: This function MUST call getArticleID() on the link,
1081 # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
1083 function makeLink( $title, $text= "", $query = "", $trail = "" )
1085 global $wgOut, $wgUser;
1087 $nt = Title
::newFromText( $title );
1089 if ( $nt->isExternal() ) {
1090 $u = $nt->getFullURL();
1091 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1092 $style = $this->getExternalLinkAttributes( $link, $text );
1095 if ( "" != $trail ) {
1096 if ( preg_match( "/^([a-z]+)(.*)$$/sD", $trail, $m ) ) {
1101 return "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1103 if ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
1104 return $this->makeKnownLink( $title, $text, $query, $trail );
1106 if ( ( -1 == $nt->getNamespace() ) ||
1107 ( Namespace::getImage() == $nt->getNamespace() ) ) {
1108 return $this->makeKnownLink( $title, $text, $query, $trail );
1110 $aid = $nt->getArticleID() ;
1112 return $this->makeBrokenLink( $title, $text, $query, $trail );
1114 $threshold = $wgUser->getOption("stubthreshold") ;
1115 if ( $threshold > 0 ) {
1116 $res = wfQuery ( "SELECT HIGH_PRIORITY length(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'" ) ;
1118 if ( wfNumRows( $res ) > 0 ) {
1119 $s = wfFetchObject( $res );
1121 if ( $s->cur_is_redirect
OR $s->cur_namespace
!= 0 )
1122 $size = $threshold*2 ; # Really big
1123 wfFreeResult( $res );
1124 } else $size = $threshold*2 ; # Really big
1127 if ( $size < $threshold )
1128 return $this->makeStubLink( $title, $text, $query, $trail );
1129 return $this->makeKnownLink( $title, $text, $query, $trail );
1133 function makeKnownLink( $title, $text = "", $query = "", $trail = "" )
1135 global $wgOut, $wgTitle;
1137 $nt = Title
::newFromText( $title );
1138 $link = $nt->getPrefixedURL();
1140 if ( "" == $link ) {
1142 if ( "" == $text ) { $text = $nt->getFragment(); }
1144 $u = wfLocalUrlE( $link, $query );
1146 if ( "" != $nt->getFragment() ) {
1147 $u .= "#" . wfEscapeHTML( $nt->getFragment() );
1149 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1150 $style = $this->getInternalLinkAttributes( $link, $text );
1153 if ( "" != $trail ) {
1154 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1159 $r = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1163 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" )
1165 global $wgOut, $wgUser;
1167 $nt = Title
::newFromText( $title );
1168 $link = $nt->getPrefixedURL();
1170 if ( "" == $query ) { $q = "action=edit"; }
1171 else { $q = "action=edit&{$query}"; }
1172 $u = wfLocalUrlE( $link, $q );
1174 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1175 $style = $this->getInternalLinkAttributes( $link, $text, "yes" );
1178 if ( "" != $trail ) {
1179 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1184 if ( $wgOut->isPrintable() ||
1185 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1186 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1188 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
1193 function makeStubLink( $title, $text = "", $query = "", $trail = "" )
1195 global $wgOut, $wgUser;
1197 $nt = Title
::newFromText( $title );
1198 $link = $nt->getPrefixedURL();
1200 $u = wfLocalUrlE( $link, $query );
1202 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1203 $style = $this->getInternalLinkAttributes( $link, $text, "stub" );
1206 if ( "" != $trail ) {
1207 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1212 if ( $wgOut->isPrintable() ||
1213 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1214 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1216 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1221 function fnamePart( $url )
1223 $basename = strrchr( $url, "/" );
1224 if ( false === $basename ) { $basename = $url; }
1225 else { $basename = substr( $basename, 1 ); }
1226 return wfEscapeHTML( $basename );
1229 function makeImage( $url, $alt = "" )
1233 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1234 $s = "<img src=\"{$url}\" alt=\"{$alt}\">";
1238 function makeImageLink( $name, $url, $alt = "" )
1240 global $wgOut, $wgTitle, $wgLang;
1242 $nt = Title
::newFromText( $wgLang->getNsText(
1243 Namespace::getImage() ) . ":{$name}" );
1244 $link = $nt->getPrefixedURL();
1245 if ( "" == $alt ) { $alt = $name; }
1247 $u = wfLocalUrlE( $link );
1248 $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
1249 "<img border=0 src=\"{$url}\" alt=\"{$alt}\"></a>";
1253 function makeMediaLink( $name, $url, $alt = "" )
1255 global $wgOut, $wgTitle;
1257 if ( "" == $alt ) { $alt = $name; }
1258 $u = wfEscapeHTML( $url );
1259 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1263 function specialLink( $name, $key = "" )
1267 if ( "" == $key ) { $key = strtolower( $name ); }
1268 $pn = $wgLang->ucfirst( $name );
1269 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1273 # Called by history lists and recent changes
1276 function beginRecentChangesList()
1278 $rc_cache = array() ;
1280 $this->lastdate
= "";
1284 function beginHistoryList()
1286 $this->lastdate
= $this->lastline
= "";
1287 $s = "\n<p>" . wfMsg( "histlegend" ) . "\n<ul>";
1291 function beginImageHistoryList()
1293 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1294 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul>";
1298 function endRecentChangesList()
1300 $s = $this->recentChangesBlock() ;
1305 function endHistoryList()
1307 $last = wfMsg( "last" );
1309 $s = preg_replace( "/!OLDID![0-9]+!/", $last, $this->lastline
);
1314 function endImageHistoryList()
1320 function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor )
1324 $artname = Title
::makeName( $ns, $ttl );
1325 $last = wfMsg( "last" );
1326 $cur = wfMsg( "cur" );
1327 $cr = wfMsg( "currentrev" );
1329 if ( $oid && $this->lastline
) {
1330 $ret = preg_replace( "/!OLDID!([0-9]+)!/", $this->makeKnownLink(
1331 $artname, $last, "diff=\\1&oldid={$oid}" ), $this->lastline
);
1335 $dt = $wgLang->timeanddate( $ts, true );
1337 if ( $oid ) { $q = "oldid={$oid}"; }
1339 $link = $this->makeKnownLink( $artname, $dt, $q );
1342 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1343 $ut, "target=" . $ut );
1344 } else { $ul = $this->makeLink( $wgLang->getNsText(
1345 Namespace::getUser() ) . ":{$ut}", $ut ); }
1349 $curlink = $this->makeKnownLink( $artname, $cur,
1350 "diff=0&oldid={$oid}" );
1354 $s .= "({$curlink}) (!OLDID!{$oid}!) . .";
1356 $M = wfMsg( "minoreditletter" );
1357 if ( $isminor ) { $s .= " <strong>{$M}</strong>"; }
1358 $s .= " {$link} . . {$ul}";
1360 if ( "" != $c && "*" != $c ) { $s .= " <em>(" . wfEscapeHTML($c) . ")</em>"; }
1363 $this->lastline
= $s;
1367 function recentChangesBlockLine ( $y ) {
1368 global $wgUploadPath ;
1370 $M = wfMsg( "minoreditletter" );
1371 $N = wfMsg( "newpageletter" );
1373 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>" ;
1375 if ( $y->isnew
) $r .= $N ;
1376 else $r .= " " ;
1377 if ( $y->isminor
) $r .= $M ;
1378 else $r .= " " ;
1379 $r .= " ".$y->timestamp
." " ;
1382 if ( $y->watched
) $link = "<strong>{$link}</strong>" ;
1388 $r .= $this->makeKnownLink( $y->secureName
, wfMsg( "hist" ), "action=history" );
1390 $r .= ") . . ".$y->userlink
;
1391 $r .= $y->usertalklink
;
1392 if ( $y->usercomment
!= "" )
1393 $r .= " <em>(".wfEscapeHTML($y->usercomment
).")</em>" ;
1398 function recentChangesBlockGroup ( $y ) {
1399 global $wgUploadPath ;
1402 $M = wfMsg( "minoreditletter" );
1403 $N = wfMsg( "newpageletter" );
1405 $userlinks = array () ;
1406 foreach ( $y AS $x ) {
1407 $oldid = $x->diffid
;
1408 if ( $x->isnew
) $isnew = true ;
1410 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1414 krsort ( $userlinks ) ;
1415 asort ( $userlinks ) ;
1417 $u = array_keys ( $userlinks ) ;
1418 foreach ( $u as $x ) {
1420 if ( $userlinks[$x] > 1 ) $z .= " ({$userlinks[$x]}×)" ;
1421 array_push ( $users , $z ) ;
1423 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1426 $e = array_shift ( $e ) ;
1429 $rci = "RCI{$this->rccc}" ;
1430 $rcl = "RCL{$this->rccc}" ;
1431 $rcm = "RCM{$this->rccc}" ;
1432 $tl = "<a href='javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")'>" ;
1433 $tl .= "<span id='{$rcm}'><img src='{$wgUploadPath}/Arr_r.png' width=12 height=12 border=0></span>" ;
1434 $tl .= "<span id='{$rcl}' style='display:none'><img src='{$wgUploadPath}/Arr_d.png' width=12 height=12 border=0></span>" ;
1440 if ( $isnew ) $r .= $N ;
1441 else $r .= " " ;
1442 $r .= " " ; # Minor
1443 $r .= " ".$e->timestamp
." " ;
1447 if ( $e->watched
) $link = "<strong>{$link}</strong>" ;
1451 $r .= " (".count($y)." " ;
1452 if ( $isnew ) $r .= wfMsg("changes");
1453 else $r .= $this->makeKnownLink( $e->secureName
, wfMsg("changes") , "diff=0&oldid=".$oldid ) ;
1455 $r .= $this->makeKnownLink( $e->secureName
, wfMsg( "history" ), "action=history" );
1463 $r .= "<div id='{$rci}' style='display:none'>" ;
1464 foreach ( $y AS $x )
1466 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>";
1467 $r .= "<tt> " ;
1468 if ( $x->isnew
) $r .= $N ;
1469 else $r .= " " ;
1470 if ( $x->isminor
) $r .= $M ;
1471 else $r .= " " ;
1475 if ( $x->oldid
!= 0 ) $o = "oldid=".$x->oldid
;
1476 if ( $x->islog
) $link = $x->timestamp
;
1477 else $link = $this->makeKnownLink( $x->secureName
, $x->timestamp
, $o ) ;
1478 $link = "<tt>{$link}</tt>" ;
1485 $r .= $x->lastlink
;
1486 $r .= ") . . ".$x->userlink
;
1487 $r .= $x->usertalklink
;
1488 if ( $x->usercomment
!= "" )
1489 $r .= " <em>(".wfEscapeHTML($x->usercomment
).")</em>" ;
1498 function recentChangesBlock ()
1500 global $wgUploadPath ;
1501 if ( count ( $this->rc_cache
) == 0 ) return "" ;
1502 $k = array_keys ( $this->rc_cache
) ;
1503 foreach ( $k AS $x )
1505 $y = $this->rc_cache
[$x] ;
1506 if ( count ( $y ) < 2 ) {
1507 $r .= $this->recentChangesBlockLine ( array_shift ( $y ) ) ;
1509 $r .= $this->recentChangesBlockGroup ( $y ) ;
1513 return "<div align=left>{$r}</div>" ;
1516 function recentChangesLine( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1519 $usenew = $wgUser->getOption( "usenewrc" );
1521 $r = $this->recentChangesLineNew ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1523 $r = $this->recentChangesLineOld ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1527 function recentChangesLineOld( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0, $diffid = 0 )
1529 global $wgTitle, $wgLang, $wgUser;
1531 $d = $wgLang->date( $ts, true);
1533 if ( $d != $this->lastdate
) {
1534 if ( "" != $this->lastdate
) { $s .= "</ul>\n"; }
1535 $s .= "<h4>{$d}</h4>\n<ul>";
1536 $this->lastdate
= $d;
1538 $h = $wgLang->time( $ts, true );
1539 $t = Title
::makeName( $ns, $ttl );
1540 $clink = $this->makeKnownLink( $t , "" );
1541 $nt = Title
::newFromText( $t );
1544 $clink = "<strong>{$clink}</strong>";
1546 $hlink = $this->makeKnownLink( $t, wfMsg( "hist" ), "action=history" );
1547 if ( $isnew ||
$nt->isLog() ) {
1548 $dlink = wfMsg( "diff" );
1550 $dlink = $this->makeKnownLink( $t, wfMsg( "diff" ),
1551 "diff={$oldid}&oldid={$diffid}" ); # Finagle's law
1554 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1555 $ut, "target=" . $ut );
1556 } else { $ul = $this->makeLink( $wgLang->getNsText(
1557 Namespace::getUser() ) . ":{$ut}", $ut ); }
1559 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1560 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1561 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1562 $cr = wfMsg( "currentrev" );
1564 $s .= "<li> ({$dlink}) ({$hlink}) . .";
1565 $M = wfMsg( "minoreditletter" );
1566 $N = wfMsg( "newpageletter" );
1567 if ( $isminor ) { $s .= " <strong>{$M}</strong>"; }
1568 if ( $isnew ) { $s .= "<strong>{$N}</strong>"; }
1569 $s .= " {$clink}; {$h} . . {$ul}";
1572 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1573 $blink = $this->makeKnownLink( $wgLang->specialPage(
1574 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1580 $utl = "({$utl} | {$blink})";
1584 if ( "" != $c && "*" != $c ) {
1585 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1592 function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1594 global $wgTitle, $wgLang, $wgUser;
1596 $rc = new RecentChangesClass
;
1598 $d = $wgLang->date( $ts, true);
1601 if ( $d != $this->lastdate
) {
1602 $ret = $this->recentChangesBlock () ;
1603 $this->rc_cache
= array() ;
1604 $ret .= "<h4>{$d}</h4>\n";
1605 $this->lastdate
= $d;
1607 $h = $wgLang->time( $ts, true );
1608 $t = Title
::makeName( $ns, $ttl );
1609 $clink = $this->makeKnownLink( $t, "" ) ;
1610 if ( $oldid == 0 ) $c2link = $clink ;
1611 else $c2link = $this->makeKnownLink( $t, "" , "oldid={$oldid}" );
1612 $nt = Title
::newFromText( $t );
1614 $rc->timestamp
= $h ;
1615 $rc->oldid
= $oldid ;
1616 $rc->diffid
= $diffid ;
1617 $rc->watched
= $watched ;
1618 $rc->isnew
= $isnew ;
1619 $rc->isminor
= $isminor ;
1620 $rc->secureName
= $t ;
1621 $rc->displayName
= $nt ;
1622 $rc->link
= $clink ;
1623 $rc->usercomment
= $c ;
1624 $rc->islog
= $nt->isLog() ;
1626 if ( ( $isnew && $oldid == 0 ) ||
$nt->isLog() ) {
1627 $dlink = wfMsg( "cur" );
1629 $dlink = $this->makeKnownLink( $t, wfMsg( "cur" ),
1630 "diff=0&oldid={$oldid}" );
1633 if ( $diffid == 0 ||
$nt->isLog() ) {
1634 $plink = wfMsg( "last" );
1636 $plink = $this->makeKnownLink( $t, wfMsg( "last" ),
1637 "diff={$oldid}&oldid={$diffid}" );
1641 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1642 $ut, "target=" . $ut );
1643 } else { $ul = $this->makeLink( $wgLang->getNsText(
1644 Namespace::getUser() ) . ":{$ut}", $ut ); }
1646 $rc->userlink
= $ul ;
1647 $rc->lastlink
= $plink ;
1648 $rc->curlink
= $dlink ;
1650 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1651 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1652 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1654 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1655 $blink = $this->makeKnownLink( $wgLang->specialPage(
1656 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1657 $rc->usertalklink
= " ({$utl} | {$blink})";
1659 $rc->usertalklink
=" ({$utl})";
1662 if ( !isset ( $this->rc_cache
[$t] ) ) $this->rc_cache
[$t] = array() ;
1663 array_push ( $this->rc_cache
[$t] , $rc ) ;
1668 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
1670 global $wgUser, $wgLang, $wgTitle;
1672 $dt = $wgLang->timeanddate( $ts, true );
1673 $del = wfMsg( "deleteimg" );
1674 $cur = wfMsg( "cur" );
1677 $url = wfImageUrl( $img );
1679 if ( $wgUser->isSysop() ) {
1680 $link = wfLocalUrlE( $wgTitle->getPrefixedText(), "image=" . $wgTitle->getURL() .
1682 $style = $this->getInternalLinkAttributes( $link, $del );
1684 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
1689 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
1690 if( $wgUser->getID() != 0 ) {
1691 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1692 wfMsg( "revertimg" ), "action=revert&oldimage=" .
1693 urlencode( $img ) );
1694 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1695 $del, "action=delete&oldimage=" . urlencode( $img ) );
1697 # Having live active links for non-logged in users
1698 # means that bots and spiders crawling our site can
1699 # inadvertently change content. Baaaad idea.
1700 $rlink = wfMsg( "revertimg" );
1704 if ( 0 == $u ) { $ul = $ut; }
1705 else { $ul = $this->makeLink( $wgLang->getNsText(
1706 Namespace::getUser() ) . ":{$ut}", $ut ); }
1708 $nb = str_replace( "$1", $size, wfMsg( "nbytes" ) );
1709 $style = $this->getInternalLinkAttributes( $url, $dt );
1711 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
1712 . " . . {$ul} ({$nb})";
1714 if ( "" != $c && "*" != $c ) {
1715 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1721 function tocIndent($level) {
1723 while($level-->0) $rv.="<div style=\"margin-left:2em;\">\n";
1728 function tocUnindent($level) {
1729 while($level-->0) $rv.="</div>\n";
1733 // parameter level defines if we are on an indentation level
1734 function tocLine($anchor,$tocline,$level) {
1738 return "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n";
1741 return "<div style=\"margin-bottom:0px;\">\n".
1742 "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n".
1748 function tocTable($toc) {
1749 // note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
1753 $hideline = " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>";
1756 "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
1757 "<b>".wfMsg("toc")."</b>" .
1759 "</td></tr><tr id='tocinside'><td align=\"left\">\n".
1760 $toc."</td></tr></table><P>\n";
1763 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
1764 function editSectionScript($section,$head) {
1766 global $wgTitle,$wgUser,$oldid;
1767 if($oldid) return $head;
1768 $url = wfLocalUrlE(urlencode($wgTitle->getPrefixedText()),"action=edit§ion=$section");
1769 return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
1772 function editSectionLink($section) {
1775 global $wgTitle,$wgUser,$oldid;
1776 if($oldid) return "";
1777 if ($printable) return "";
1778 $editurl="§ion={$section}";
1779 $url=$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
1780 return "<div style=\"float:right;margin-left:5px;\"><small>[".$url."]</small></div>";
1785 include_once( "SkinStandard.php" );
1786 include_once( "SkinNostalgia.php" );
1787 include_once( "SkinCologneBlue.php" );