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( $mp ) . "\"><img{$a} border=0 src=\""
605 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\"></a>";
611 global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
613 wfProfileIn( "Skin::quickBar" );
614 $tns=$wgTitle->getNamespace();
616 $s = "\n<div id='quickbar'>";
617 $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
620 $s .= $this->mainPageLink()
621 . $sep . $this->specialLink( "recentchanges" )
622 . $sep . $this->specialLink( "randompage" );
623 if ($wgUser->getID()) {
624 $s.= $sep . $this->specialLink( "watchlist" ) ;
625 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
626 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
629 // only show watchlist link if logged in
630 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
631 $s .= "\n<br><hr class='sep'>";
632 $articleExists = $wgTitle->getArticleId();
633 if ( $wgOut->isArticle() ||
$action =="edit" ||
$action =="history" ||
$wpPreview) {
635 if($wgOut->isArticle()) {
636 $s .= "<strong>" . $this->editThisPage() . "</strong>";
637 } else { # backlink to the article in edit or history mode
638 if($articleExists){ # no backlink if no article
641 $text = wfMsg("articlepage");
644 $text = wfMsg("viewtalkpage");
647 $text = wfMsg("userpage");
650 $text = wfMsg("viewtalkpage");
653 $text = wfMsg("wikipediapage");
656 $text = wfMsg("viewtalkpage");
659 $text = wfMsg("imagepage");
662 $text = wfMsg("viewtalkpage");
665 $text= wfMsg("articlepage");
668 $link = $wgTitle->getText();
669 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
670 $link = $nstext . ":" . $link ;
672 $s .= $this->makeLink($link, $text );
673 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
674 # we just throw in a "New page" text to tell the user that he's in edit mode,
675 # and to avoid messing with the separator that is prepended to the next item
676 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
682 if( $tns%2
&& $action!="edit" && !$wpPreview) {
683 $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
687 watching could cause problems in edit mode:
688 if user edits article, then loads "watch this article" in background and then saves
689 article with "Watch this article" checkbox disabled, the article is transparently
690 unwatched. Therefore we do not show the "Watch this page" link in edit mode
692 if ( 0 != $wgUser->getID() && $articleExists) {
693 if($action!="edit" && $action!="history" &&
694 $action != "submit" )
695 {$s .= $sep . $this->watchThisPage(); }
696 if ( $wgTitle->userCanEdit() ) $s .= $sep . $this->moveThisPage();
698 if ( $wgUser->isSysop() and $articleExists ) {
699 $s .= $sep . $this->deleteThisPage() .
700 $sep . $this->protectThisPage();
702 $s .= $sep . $this->talkLink();
703 if ($articleExists && $action !="history") { $s .= $sep . $this->historyLink();}
704 $s.=$sep . $this->whatLinksHere();
706 if($wgOut->isArticle()) {
707 $s .= $sep . $this->watchPageLinksLink();
710 if ( Namespace::getUser() == $wgTitle->getNamespace()
711 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
714 $id=User
::idFromName($wgTitle->getText());
715 $ip=User
::isIP($wgTitle->getText());
718 $s .= $sep . $this->userContribsLink();
720 if ( 0 != $wgUser->getID() ) {
721 if($id) { # can only email real users
722 $s .= $sep . $this->emailUserLink();
726 $s .= "\n<br><hr class='sep'>";
729 if ( 0 != $wgUser->getID() ) {
730 $s .= $this->specialLink( "upload" ) . $sep;
732 $s .= $this->specialLink( "specialpages" )
733 . $sep . $this->bugReportsLink();
735 $s .= "\n<br></div>\n";
740 function specialPagesList()
742 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
745 $validSP = $wgLang->getValidSpecialPages();
747 foreach ( $validSP as $name => $desc ) {
748 if ( "" == $desc ) { continue; }
751 if ( $wgUser->isSysop() )
753 $sysopSP = $wgLang->getSysopSpecialPages();
755 foreach ( $sysopSP as $name => $desc ) {
756 if ( "" == $desc ) { continue; }
760 if ( $wgUser->isDeveloper() )
762 $devSP = $wgLang->getDeveloperSpecialPages();
764 foreach ( $devSP as $name => $desc ) {
765 if ( "" == $desc ) { continue; }
770 $sp = wfMsg( "specialpages" );
771 $spp = $wgLang->specialPage( "Specialpages" );
773 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
774 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
775 $s .= "<select name=\"wpDropdown\">\n";
776 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
778 foreach ( $a as $name => $desc ) {
779 $p = $wgLang->specialPage( $name );
780 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
783 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
788 function mainPageLink()
790 $mp = wfMsg( "mainpage" );
791 $s = $this->makeKnownLink( $mp, $mp );
795 function copyrightLink()
797 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
798 wfMsg( "copyrightpagename" ) );
804 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
805 wfMsg( "aboutwikipedia" ) );
809 function editThisPage()
811 global $wgOut, $wgTitle, $oldid, $redirect, $diff;
813 if ( ! $wgOut->isArticle() ||
$diff ) {
814 $s = wfMsg( "protectedpage" );
815 } else if ( $wgTitle->userCanEdit() ) {
816 $n = $wgTitle->getPrefixedText();
817 $t = wfMsg( "editthispage" );
820 if ( $redirect ) { $red = "&redirect={$redirect}"; }
821 if ( $oldid && ! isset( $diff ) ) {
822 $oid = "&oldid={$oldid}";
824 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
826 $s = wfMsg( "protectedpage" );
831 function deleteThisPage()
833 global $wgUser, $wgOut, $wgTitle, $diff;
835 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
836 $n = $wgTitle->getPrefixedText();
837 $t = wfMsg( "deletethispage" );
839 $s = $this->makeKnownLink( $n, $t, "action=delete" );
841 $s = wfMsg( "error" );
846 function protectThisPage()
848 global $wgUser, $wgOut, $wgTitle, $diff;
850 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
851 $n = $wgTitle->getPrefixedText();
853 if ( $wgTitle->isProtected() ) {
854 $t = wfMsg( "unprotectthispage" );
855 $q = "action=unprotect";
857 $t = wfMsg( "protectthispage" );
858 $q = "action=protect";
860 $s = $this->makeKnownLink( $n, $t, $q );
862 $s = wfMsg( "error" );
867 function watchThisPage()
869 global $wgUser, $wgOut, $wgTitle, $diff;
871 if ( $wgOut->isArticle() && ( ! $diff ) ) {
872 $n = $wgTitle->getPrefixedText();
874 if ( $wgTitle->userIsWatching() ) {
875 $t = wfMsg( "unwatchthispage" );
876 $q = "action=unwatch";
878 $t = wfMsg( "watchthispage" );
881 $s = $this->makeKnownLink( $n, $t, $q );
883 $s = wfMsg( "notanarticle" );
888 function moveThisPage()
890 global $wgTitle, $wgLang;
892 if ( $wgTitle->userCanEdit() ) {
893 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
894 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
895 } // no message if page is protected - would be redundant
899 function historyLink()
903 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
904 wfMsg( "history" ), "action=history" );
908 function whatLinksHere()
910 global $wgTitle, $wgLang;
912 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
913 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
917 function userContribsLink()
919 global $wgTitle, $wgLang;
921 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
922 wfMsg( "contributions" ), "target=" . $wgTitle->getURL() );
926 function emailUserLink()
928 global $wgTitle, $wgLang;
930 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
931 wfMsg( "emailuser" ), "target=" . $wgTitle->getURL() );
935 function watchPageLinksLink()
937 global $wgOut, $wgTitle, $wgLang;
939 if ( ! $wgOut->isArticle() ) {
940 $s = "(" . wfMsg( "notanarticle" ) . ")";
942 $s = $this->makeKnownLink( $wgLang->specialPage(
943 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
944 "target=" . $wgTitle->getPrefixedURL() );
949 function otherLanguages()
951 global $wgOut, $wgLang, $wgTitle , $wgUseNewInterlanguage ;
953 $a = $wgOut->getLanguageLinks();
954 if ( 0 == count( $a ) ) {
955 if ( !$wgUseNewInterlanguage ) return "";
956 $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
957 if ( $ns != 0 AND $ns != 1 ) return "" ;
959 $x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
960 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
961 wfMsg( "intl" ) , $x );
964 if ( !$wgUseNewInterlanguage ) {
965 $s = wfMsg( "otherlanguages" ) . ": ";
967 global $wgLanguageCode ;
968 $x = "mode=zoom&xt=".$wgTitle->getDBkey() ;
969 $x .= "&xl=".$wgLanguageCode ;
970 $s = $this->makeKnownLink( $wgLang->specialPage( "Intl" ),
971 wfMsg( "otherlanguages" ) , $x ) . ": " ;
975 if($wgLang->isRTL()) $s .= "<span dir='LTR'>";
976 foreach( $a as $l ) {
977 if ( ! $first ) { $s .= " | "; }
980 $nt = Title
::newFromText( $l );
981 $url = $nt->getFullURL();
982 $text = $wgLang->getLanguageName( $nt->getInterwiki() );
984 if ( "" == $text ) { $text = $l; }
985 $style = $this->getExternalLinkAttributes( $l, $text );
986 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
988 if($wgLang->isRTL()) $s .= "</span>";
992 function bugReportsLink()
994 $s = $this->makeKnownLink( wfMsg( "bugreportspage" ),
995 wfMsg( "bugreports" ) );
1001 global $wgLinkCache;
1002 $t1 = Title
::newFromText( gmdate( "F j" ) );
1003 $t2 = Title
::newFromText( gmdate( "Y" ) );
1005 $wgLinkCache->suspend();
1006 $id = $t1->getArticleID();
1007 $wgLinkCache->resume();
1010 $s = $this->makeBrokenLink( $t1->getText() );
1012 $s = $this->makeKnownLink( $t1->getText() );
1016 $wgLinkCache->suspend();
1017 $id = $t2->getArticleID();
1018 $wgLinkCache->resume();
1021 $s .= $this->makeBrokenLink( $t2->getText() );
1023 $s .= $this->makeKnownLink( $t2->getText() );
1030 global $wgLang, $wgTitle, $wgLinkCache;
1032 $tns = $wgTitle->getNamespace();
1033 if ( -1 == $tns ) { return ""; }
1035 $pn = $wgTitle->getText();
1036 $tp = wfMsg( "talkpage" );
1037 if ( Namespace::isTalk( $tns ) ) {
1038 $lns = Namespace::getSubject( $tns );
1041 $text = wfMsg("articlepage");
1044 $text = wfMsg("userpage");
1047 $text = wfMsg("wikipediapage");
1050 $text = wfMsg("imagepage");
1053 $text= wfMsg("articlepage");
1057 $lns = Namespace::getTalk( $tns );
1060 $n = $wgLang->getNsText( $lns );
1061 if ( "" == $n ) { $link = $pn; }
1062 else { $link = "{$n}:{$pn}"; }
1064 $wgLinkCache->suspend();
1065 $s = $this->makeLink( $link, $text );
1066 $wgLinkCache->resume();
1071 # After all the page content is transformed into HTML, it makes
1072 # a final pass through here for things like table backgrounds.
1074 function transformContent( $text )
1079 # Note: This function MUST call getArticleID() on the link,
1080 # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
1082 function makeLink( $title, $text= "", $query = "", $trail = "" )
1084 global $wgOut, $wgUser;
1086 $nt = Title
::newFromText( $title );
1088 if ( $nt->isExternal() ) {
1089 $u = $nt->getFullURL();
1090 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1091 $style = $this->getExternalLinkAttributes( $link, $text );
1094 if ( "" != $trail ) {
1095 if ( preg_match( "/^([a-z]+)(.*)$$/sD", $trail, $m ) ) {
1100 return "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1102 if ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
1103 return $this->makeKnownLink( $title, $text, $query, $trail );
1105 if ( ( -1 == $nt->getNamespace() ) ||
1106 ( Namespace::getImage() == $nt->getNamespace() ) ) {
1107 return $this->makeKnownLink( $title, $text, $query, $trail );
1109 $aid = $nt->getArticleID() ;
1111 return $this->makeBrokenLink( $title, $text, $query, $trail );
1113 $threshold = $wgUser->getOption("stubthreshold") ;
1114 if ( $threshold > 0 ) {
1115 $res = wfQuery ( "SELECT HIGH_PRIORITY length(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'" ) ;
1117 if ( wfNumRows( $res ) > 0 ) {
1118 $s = wfFetchObject( $res );
1120 if ( $s->cur_is_redirect
OR $s->cur_namespace
!= 0 )
1121 $size = $threshold*2 ; # Really big
1122 wfFreeResult( $res );
1123 } else $size = $threshold*2 ; # Really big
1126 if ( $size < $threshold )
1127 return $this->makeStubLink( $title, $text, $query, $trail );
1128 return $this->makeKnownLink( $title, $text, $query, $trail );
1132 function makeKnownLink( $title, $text = "", $query = "", $trail = "" )
1134 global $wgOut, $wgTitle;
1136 $nt = Title
::newFromText( $title );
1137 $link = $nt->getPrefixedURL();
1139 if ( "" == $link ) {
1141 if ( "" == $text ) { $text = $nt->getFragment(); }
1143 $u = wfLocalUrlE( $link, $query );
1145 if ( "" != $nt->getFragment() ) {
1146 $u .= "#" . wfEscapeHTML( $nt->getFragment() );
1148 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1149 $style = $this->getInternalLinkAttributes( $link, $text );
1152 if ( "" != $trail ) {
1153 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1158 $r = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1162 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" )
1164 global $wgOut, $wgUser;
1166 $nt = Title
::newFromText( $title );
1167 $link = $nt->getPrefixedURL();
1169 if ( "" == $query ) { $q = "action=edit"; }
1170 else { $q = "action=edit&{$query}"; }
1171 $u = wfLocalUrlE( $link, $q );
1173 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1174 $style = $this->getInternalLinkAttributes( $link, $text, "yes" );
1177 if ( "" != $trail ) {
1178 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1183 if ( $wgOut->isPrintable() ||
1184 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1185 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1187 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
1192 function makeStubLink( $title, $text = "", $query = "", $trail = "" )
1194 global $wgOut, $wgUser;
1196 $nt = Title
::newFromText( $title );
1197 $link = $nt->getPrefixedURL();
1199 $u = wfLocalUrlE( $link, $query );
1201 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1202 $style = $this->getInternalLinkAttributes( $link, $text, "stub" );
1205 if ( "" != $trail ) {
1206 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1211 if ( $wgOut->isPrintable() ||
1212 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1213 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1215 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1220 function fnamePart( $url )
1222 $basename = strrchr( $url, "/" );
1223 if ( false === $basename ) { $basename = $url; }
1224 else { $basename = substr( $basename, 1 ); }
1225 return wfEscapeHTML( $basename );
1228 function makeImage( $url, $alt = "" )
1232 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1233 $s = "<img src=\"{$url}\" alt=\"{$alt}\">";
1237 function makeImageLink( $name, $url, $alt = "" )
1239 global $wgOut, $wgTitle, $wgLang;
1241 $nt = Title
::newFromText( $wgLang->getNsText(
1242 Namespace::getImage() ) . ":{$name}" );
1243 $link = $nt->getPrefixedURL();
1244 if ( "" == $alt ) { $alt = $name; }
1246 $u = wfLocalUrlE( $link );
1247 $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
1248 "<img border=0 src=\"{$url}\" alt=\"{$alt}\"></a>";
1252 function makeMediaLink( $name, $url, $alt = "" )
1254 global $wgOut, $wgTitle;
1256 if ( "" == $alt ) { $alt = $name; }
1257 $u = wfEscapeHTML( $url );
1258 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1262 function specialLink( $name, $key = "" )
1266 if ( "" == $key ) { $key = strtolower( $name ); }
1267 $pn = $wgLang->ucfirst( $name );
1268 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1272 # Called by history lists and recent changes
1275 function beginRecentChangesList()
1277 $rc_cache = array() ;
1279 $this->lastdate
= "";
1283 function beginHistoryList()
1285 $this->lastdate
= $this->lastline
= "";
1286 $s = "\n<p>" . wfMsg( "histlegend" ) . "\n<ul>";
1290 function beginImageHistoryList()
1292 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1293 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul>";
1297 function endRecentChangesList()
1299 $s = $this->recentChangesBlock() ;
1304 function endHistoryList()
1306 $last = wfMsg( "last" );
1308 $s = preg_replace( "/!OLDID![0-9]+!/", $last, $this->lastline
);
1313 function endImageHistoryList()
1319 function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor )
1323 $artname = Title
::makeName( $ns, $ttl );
1324 $last = wfMsg( "last" );
1325 $cur = wfMsg( "cur" );
1326 $cr = wfMsg( "currentrev" );
1328 if ( $oid && $this->lastline
) {
1329 $ret = preg_replace( "/!OLDID!([0-9]+)!/", $this->makeKnownLink(
1330 $artname, $last, "diff=\\1&oldid={$oid}" ), $this->lastline
);
1334 $dt = $wgLang->timeanddate( $ts, true );
1336 if ( $oid ) { $q = "oldid={$oid}"; }
1338 $link = $this->makeKnownLink( $artname, $dt, $q );
1341 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1342 $ut, "target=" . $ut );
1343 } else { $ul = $this->makeLink( $wgLang->getNsText(
1344 Namespace::getUser() ) . ":{$ut}", $ut ); }
1348 $curlink = $this->makeKnownLink( $artname, $cur,
1349 "diff=0&oldid={$oid}" );
1353 $s .= "({$curlink}) (!OLDID!{$oid}!) . .";
1355 $M = wfMsg( "minoreditletter" );
1356 if ( $isminor ) { $s .= " <strong>{$M}</strong>"; }
1357 $s .= " {$link} . . {$ul}";
1359 if ( "" != $c && "*" != $c ) { $s .= " <em>(" . wfEscapeHTML($c) . ")</em>"; }
1362 $this->lastline
= $s;
1366 function recentChangesBlockLine ( $y ) {
1367 global $wgUploadPath ;
1369 $M = wfMsg( "minoreditletter" );
1370 $N = wfMsg( "newpageletter" );
1372 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>" ;
1374 if ( $y->isnew
) $r .= $N ;
1375 else $r .= " " ;
1376 if ( $y->isminor
) $r .= $M ;
1377 else $r .= " " ;
1378 $r .= " ".$y->timestamp
." " ;
1381 if ( $y->watched
) $link = "<strong>{$link}</strong>" ;
1387 $r .= $this->makeKnownLink( $y->secureName
, wfMsg( "hist" ), "action=history" );
1389 $r .= ") . . ".$y->userlink
;
1390 $r .= $y->usertalklink
;
1391 if ( $y->usercomment
!= "" )
1392 $r .= " <em>(".wfEscapeHTML($y->usercomment
).")</em>" ;
1397 function recentChangesBlockGroup ( $y ) {
1398 global $wgUploadPath ;
1401 $M = wfMsg( "minoreditletter" );
1402 $N = wfMsg( "newpageletter" );
1404 $userlinks = array () ;
1405 foreach ( $y AS $x ) {
1406 $oldid = $x->diffid
;
1407 if ( $x->isnew
) $isnew = true ;
1409 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1413 krsort ( $userlinks ) ;
1414 asort ( $userlinks ) ;
1416 $u = array_keys ( $userlinks ) ;
1417 foreach ( $u as $x ) {
1419 if ( $userlinks[$x] > 1 ) $z .= " ({$userlinks[$x]}×)" ;
1420 array_push ( $users , $z ) ;
1422 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1425 $e = array_shift ( $e ) ;
1428 $rci = "RCI{$this->rccc}" ;
1429 $rcl = "RCL{$this->rccc}" ;
1430 $rcm = "RCM{$this->rccc}" ;
1431 $tl = "<a href='javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")'>" ;
1432 $tl .= "<span id='{$rcm}'><img src='{$wgUploadPath}/Arr_r.png' width=12 height=12 border=0></span>" ;
1433 $tl .= "<span id='{$rcl}' style='display:none'><img src='{$wgUploadPath}/Arr_d.png' width=12 height=12 border=0></span>" ;
1439 if ( $isnew ) $r .= $N ;
1440 else $r .= " " ;
1441 $r .= " " ; # Minor
1442 $r .= " ".$e->timestamp
." " ;
1446 if ( $e->watched
) $link = "<strong>{$link}</strong>" ;
1450 $r .= " (".count($y)." " ;
1451 if ( $isnew ) $r .= wfMsg("changes");
1452 else $r .= $this->makeKnownLink( $e->secureName
, wfMsg("changes") , "diff=0&oldid=".$oldid ) ;
1454 $r .= $this->makeKnownLink( $e->secureName
, wfMsg( "history" ), "action=history" );
1462 $r .= "<div id='{$rci}' style='display:none'>" ;
1463 foreach ( $y AS $x )
1465 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>";
1466 $r .= "<tt> " ;
1467 if ( $x->isnew
) $r .= $N ;
1468 else $r .= " " ;
1469 if ( $x->isminor
) $r .= $M ;
1470 else $r .= " " ;
1474 if ( $x->oldid
!= 0 ) $o = "oldid=".$x->oldid
;
1475 if ( $x->islog
) $link = $x->timestamp
;
1476 else $link = $this->makeKnownLink( $x->secureName
, $x->timestamp
, $o ) ;
1477 $link = "<tt>{$link}</tt>" ;
1484 $r .= $x->lastlink
;
1485 $r .= ") . . ".$x->userlink
;
1486 $r .= $x->usertalklink
;
1487 if ( $x->usercomment
!= "" )
1488 $r .= " <em>(".wfEscapeHTML($x->usercomment
).")</em>" ;
1497 function recentChangesBlock ()
1499 global $wgUploadPath ;
1500 if ( count ( $this->rc_cache
) == 0 ) return "" ;
1501 $k = array_keys ( $this->rc_cache
) ;
1502 foreach ( $k AS $x )
1504 $y = $this->rc_cache
[$x] ;
1505 if ( count ( $y ) < 2 ) {
1506 $r .= $this->recentChangesBlockLine ( array_shift ( $y ) ) ;
1508 $r .= $this->recentChangesBlockGroup ( $y ) ;
1512 return "<div align=left>{$r}</div>" ;
1515 function recentChangesLine( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1518 $usenew = $wgUser->getOption( "usenewrc" );
1520 $r = $this->recentChangesLineNew ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1522 $r = $this->recentChangesLineOld ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1526 function recentChangesLineOld( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0, $diffid = 0 )
1528 global $wgTitle, $wgLang, $wgUser;
1530 $d = $wgLang->date( $ts, true);
1532 if ( $d != $this->lastdate
) {
1533 if ( "" != $this->lastdate
) { $s .= "</ul>\n"; }
1534 $s .= "<h4>{$d}</h4>\n<ul>";
1535 $this->lastdate
= $d;
1537 $h = $wgLang->time( $ts, true );
1538 $t = Title
::makeName( $ns, $ttl );
1539 $clink = $this->makeKnownLink( $t , "" );
1540 $nt = Title
::newFromText( $t );
1543 $clink = "<strong>{$clink}</strong>";
1545 $hlink = $this->makeKnownLink( $t, wfMsg( "hist" ), "action=history" );
1546 if ( $isnew ||
$nt->isLog() ) {
1547 $dlink = wfMsg( "diff" );
1549 $dlink = $this->makeKnownLink( $t, wfMsg( "diff" ),
1550 "diff={$oldid}&oldid={$diffid}" ); # Finagle's law
1553 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1554 $ut, "target=" . $ut );
1555 } else { $ul = $this->makeLink( $wgLang->getNsText(
1556 Namespace::getUser() ) . ":{$ut}", $ut ); }
1558 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1559 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1560 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1561 $cr = wfMsg( "currentrev" );
1563 $s .= "<li> ({$dlink}) ({$hlink}) . .";
1564 $M = wfMsg( "minoreditletter" );
1565 $N = wfMsg( "newpageletter" );
1566 if ( $isminor ) { $s .= " <strong>{$M}</strong>"; }
1567 if ( $isnew ) { $s .= "<strong>{$N}</strong>"; }
1568 $s .= " {$clink}; {$h} . . {$ul}";
1571 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1572 $blink = $this->makeKnownLink( $wgLang->specialPage(
1573 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1579 $utl = "({$utl} | {$blink})";
1583 if ( "" != $c && "*" != $c ) {
1584 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1591 function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1593 global $wgTitle, $wgLang, $wgUser;
1595 $rc = new RecentChangesClass
;
1597 $d = $wgLang->date( $ts, true);
1600 if ( $d != $this->lastdate
) {
1601 $ret = $this->recentChangesBlock () ;
1602 $this->rc_cache
= array() ;
1603 $ret .= "<h4>{$d}</h4>\n";
1604 $this->lastdate
= $d;
1606 $h = $wgLang->time( $ts, true );
1607 $t = Title
::makeName( $ns, $ttl );
1608 $clink = $this->makeKnownLink( $t, "" ) ;
1609 if ( $oldid == 0 ) $c2link = $clink ;
1610 else $c2link = $this->makeKnownLink( $t, "" , "oldid={$oldid}" );
1611 $nt = Title
::newFromText( $t );
1613 $rc->timestamp
= $h ;
1614 $rc->oldid
= $oldid ;
1615 $rc->diffid
= $diffid ;
1616 $rc->watched
= $watched ;
1617 $rc->isnew
= $isnew ;
1618 $rc->isminor
= $isminor ;
1619 $rc->secureName
= $t ;
1620 $rc->displayName
= $nt ;
1621 $rc->link
= $clink ;
1622 $rc->usercomment
= $c ;
1623 $rc->islog
= $nt->isLog() ;
1625 if ( ( $isnew && $oldid == 0 ) ||
$nt->isLog() ) {
1626 $dlink = wfMsg( "cur" );
1628 $dlink = $this->makeKnownLink( $t, wfMsg( "cur" ),
1629 "diff=0&oldid={$oldid}" );
1632 if ( $diffid == 0 ||
$nt->isLog() ) {
1633 $plink = wfMsg( "last" );
1635 $plink = $this->makeKnownLink( $t, wfMsg( "last" ),
1636 "diff={$oldid}&oldid={$diffid}" );
1640 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1641 $ut, "target=" . $ut );
1642 } else { $ul = $this->makeLink( $wgLang->getNsText(
1643 Namespace::getUser() ) . ":{$ut}", $ut ); }
1645 $rc->userlink
= $ul ;
1646 $rc->lastlink
= $plink ;
1647 $rc->curlink
= $dlink ;
1649 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1650 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1651 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1653 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1654 $blink = $this->makeKnownLink( $wgLang->specialPage(
1655 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1656 $rc->usertalklink
= " ({$utl} | {$blink})";
1658 $rc->usertalklink
=" ({$utl})";
1661 if ( !isset ( $this->rc_cache
[$t] ) ) $this->rc_cache
[$t] = array() ;
1662 array_push ( $this->rc_cache
[$t] , $rc ) ;
1667 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
1669 global $wgUser, $wgLang, $wgTitle;
1671 $dt = $wgLang->timeanddate( $ts, true );
1672 $del = wfMsg( "deleteimg" );
1673 $cur = wfMsg( "cur" );
1676 $url = wfImageUrl( $img );
1678 if ( $wgUser->isSysop() ) {
1679 $link = wfLocalUrlE( $wgTitle->getPrefixedText(), "image=" . $wgTitle->getURL() .
1681 $style = $this->getInternalLinkAttributes( $link, $del );
1683 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
1688 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
1689 if( $wgUser->getID() != 0 ) {
1690 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1691 wfMsg( "revertimg" ), "action=revert&oldimage=" .
1692 urlencode( $img ) );
1693 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1694 $del, "action=delete&oldimage=" . urlencode( $img ) );
1696 # Having live active links for non-logged in users
1697 # means that bots and spiders crawling our site can
1698 # inadvertently change content. Baaaad idea.
1699 $rlink = wfMsg( "revertimg" );
1703 if ( 0 == $u ) { $ul = $ut; }
1704 else { $ul = $this->makeLink( $wgLang->getNsText(
1705 Namespace::getUser() ) . ":{$ut}", $ut ); }
1707 $nb = str_replace( "$1", $size, wfMsg( "nbytes" ) );
1708 $style = $this->getInternalLinkAttributes( $url, $dt );
1710 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
1711 . " . . {$ul} ({$nb})";
1713 if ( "" != $c && "*" != $c ) {
1714 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1720 function tocIndent($level) {
1722 while($level-->0) $rv.="<div style=\"margin-left:2em;\">\n";
1727 function tocUnindent($level) {
1728 while($level-->0) $rv.="</div>\n";
1732 // parameter level defines if we are on an indentation level
1733 function tocLine($anchor,$tocline,$level) {
1737 return "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n";
1740 return "<div style=\"margin-bottom:0px;\">\n".
1741 "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n".
1747 function tocTable($toc) {
1748 // note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
1752 $hideline = " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>";
1755 "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
1756 "<b>".wfMsg("toc")."</b>" .
1758 "</td></tr><tr id='tocinside'><td align=\"left\">\n".
1759 $toc."</td></tr></table><P>\n";
1762 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
1763 function editSectionScript($section,$head) {
1765 global $wgTitle,$wgUser,$oldid;
1766 if($oldid) return $head;
1767 $url = wfLocalUrlE(urlencode($wgTitle->getPrefixedText()),"action=edit§ion=$section");
1768 return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
1771 function editSectionLink($section) {
1774 global $wgTitle,$wgUser,$oldid;
1775 if($oldid) return "";
1776 if ($printable) return "";
1777 $editurl="§ion={$section}";
1778 $url=$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
1779 return "<div style=\"float:right;margin-left:5px;\"><small>[".$url."]</small></div>";
1784 include_once( "SkinStandard.php" );
1785 include_once( "SkinNostalgia.php" );
1786 include_once( "SkinCologneBlue.php" );