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" #, "Smarty", "Montparnasse"
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 $fname = "Skin::initPage";
74 wfProfileIn( $fname );
76 $wgOut->addLink( "shortcut icon", "", "/favicon.ico" );
77 if ( $wgOut->isPrintable() ) { $ss = "wikiprintable.css"; }
78 else { $ss = $this->getStylesheet(); }
79 $wgOut->addLink( "stylesheet", "", "{$wgStyleSheetPath}/{$ss}" );
80 wfProfileOut( $fname );
83 function outputPage( &$out ) {
84 wfProfileIn( "Skin::outputPage" );
86 $out->out( $out->headElement() );
88 $out->out( "\n<body" );
89 $ops = $this->getBodyOptions();
90 foreach ( $ops as $name => $val ) {
91 $out->out( " $name='$val'" );
94 if ( $wgDebugComments ) {
95 $out->out( "<!-- Wiki debugging output:\n" .
96 $out->mDebugtext
. "-->\n" );
98 $out->out( $this->beforeContent() );
100 $out->out( $out->mBodytext
);
102 $out->out( $this->afterContent() );
105 $out->out( $out->reportTime() );
107 $out->out( "\n</body></html>" );
110 function getHeadScripts() {
111 global $wgStyleSheetPath;
112 $r = "<script type=\"text/javascript\" src=\"{$wgStyleSheetPath}/wikibits.js\"></script>\n";
116 function getUserStyles()
118 $s = "<style type='text/css'><!--\n";
119 $s .= $this->doGetUserStyles();
120 $s .= "//--></style>\n";
124 function doGetUserStyles()
129 if ( 1 == $wgUser->getOption( "underline" ) ) {
130 # Don't override browser settings
134 $s .= "a.stub, a.new, a.internal, a.external { " .
135 "text-decoration: none; }\n";
137 if ( 1 == $wgUser->getOption( "highlightbroken" ) ) {
138 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
140 if ( 1 == $wgUser->getOption( "justify" ) ) {
141 $s .= "#article { text-align: justify; }\n";
146 function getBodyOptions()
148 global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $oldid, $redirect, $diff,$action;
150 if ( 0 != $wgTitle->getNamespace() ) {
151 $a = array( "bgcolor" => "#ffffec" );
153 else $a = array( "bgcolor" => "#FFFFFF" );
154 if($wgOut->isArticle() && $wgUser->getOption("editondblclick")
156 (!$wgTitle->isProtected() ||
$wgUser->isSysop())
159 $n = $wgTitle->getPrefixedURL();
160 $t = wfMsg( "editthispage" );
162 if ( $redirect ) { $red = "&redirect={$redirect}"; }
163 if ( $oldid && ! isset( $diff ) ) {
164 $oid = "&oldid={$oldid}";
166 $s = wfLocalUrlE($n,"action=edit{$oid}{$red}");
167 $s = "document.location = \"" .$s ."\";";
168 $a +
= array ("ondblclick" => $s);
171 $a['onload'] = $wgOut->getOnloadHandler();
175 function getExternalLinkAttributes( $link, $text )
177 global $wgUser, $wgOut, $wgLang;
179 $link = urldecode( $link );
180 $link = $wgLang->checkTitleEncoding( $link );
181 $link = str_replace( "_", " ", $link );
182 $link = wfEscapeHTML( $link );
184 if ( $wgOut->isPrintable() ) { $r = " class='printable'"; }
185 else { $r = " class='external'"; }
187 if ( 1 == $wgUser->getOption( "hover" ) ) {
188 $r .= " title=\"{$link}\"";
193 function getInternalLinkAttributes( $link, $text, $broken = false )
195 global $wgUser, $wgOut;
197 $link = urldecode( $link );
198 $link = str_replace( "_", " ", $link );
199 $link = wfEscapeHTML( $link );
201 if ( $wgOut->isPrintable() ) {
202 $r = " class='printable'";
203 } else if ( $broken == "stub" ) {
204 $r = " class='stub'";
205 } else if ( $broken == "yes" ) {
208 $r = " class='internal'";
211 if ( 1 == $wgUser->getOption( "hover" ) ) {
212 $r .= " title=\"{$link}\"";
217 function getInternalLinkAttributesObj( &$nt, $text, $broken = false )
219 global $wgUser, $wgOut;
221 if ( $wgOut->isPrintable() ) {
222 $r = " class='printable'";
223 } else if ( $broken == "stub" ) {
224 $r = " class='stub'";
225 } else if ( $broken == "yes" ) {
228 $r = " class='internal'";
231 if ( 1 == $wgUser->getOption( "hover" ) ) {
232 $r .= ' title ="' . $nt->getEscapedText() . '"';
243 # This will be called immediately after the <body> tag. Split into
244 # two functions to make it easier to subclass.
246 function beforeContent()
248 global $wgUser, $wgOut;
250 if ( $wgOut->isPrintable() ) {
251 $s = $this->pageTitle() . $this->pageSubtitle() . "\n";
252 $s .= "\n<div class='bodytext'>";
255 return $this->doBeforeContent();
258 function doBeforeContent()
260 global $wgUser, $wgOut, $wgTitle, $wgLang;
261 $fname = "Skin::doBeforeContent";
262 wfProfileIn( $fname );
265 $qb = $this->qbSetting();
267 if( $langlinks = $this->otherLanguages() ) {
273 $borderhack = "class='top'";
276 $s .= "\n<div id='content'>\n<div id='topbar'>" .
277 "<table width='98%' border=0 cellspacing=0><tr>";
280 $left = ($qb == 1 ||
$qb == 3);
281 if($wgLang->isRTL()) $left = !$left;
284 $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>" .
285 $this->logoText() . "</td>";
287 $s .= $this->getQuickbarCompensator( $rows );
289 $l = $wgLang->isRTL() ?
"right" : "left";
290 $s .= "<td {$borderhack} align='$l' valign='top'>";
292 $s .= $this->topLinks() ;
293 $s .= "<p class='subtitle'>" . $this->pageTitleLinks();
295 $r = $wgLang->isRTL() ?
"left" : "right";
296 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap>";
297 $s .= $this->nameAndLogin();
298 $s .= "\n<br>" . $this->searchForm() . "</td>";
301 $s .= "</tr>\n<tr><td class='top' colspan=\"2\">$langlinks</td>";
304 if ( $shove && !$left ) { # Right
305 $s .= $this->getQuickbarCompensator( $rows );
307 $s .= "</tr></table>\n</div>\n";
308 $s .= "\n<div id='article'>";
310 $s .= $this->pageTitle();
311 $s .= $this->pageSubtitle() ;
312 $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
314 wfProfileOut( $fname );
318 function getQuickbarCompensator( $rows = 1 )
320 return "<td width='152' rowspan='{$rows}'> </td>";
323 # This gets called immediately before the </body> tag.
325 function afterContent()
327 global $wgUser, $wgOut, $wgServer;
330 if ( $wgOut->isPrintable() ) {
333 $u = htmlspecialchars( $wgServer . $wgTitle->getFullURL() );
334 $u = "<a href=\"$u\">$u</a>";
335 $rf = wfMsg( "retrievedfrom", $u );
337 if ( $wgOut->isArticle() ) {
338 $lm = "<br>" . $this->lastModified();
341 $cr = wfMsg( "gnunote" );
342 $s .= "<p><em>{$rf}{$lm} {$cr}</em>\n";
345 return $this->doAfterContent();
348 function doAfterContent()
350 global $wgUser, $wgOut, $wgLang;
351 $fname = "Skin::doAfterContent";
352 wfProfileIn( $fname );
353 wfProfileIn( "$fname-1" );
355 $s = "\n</div><br clear=all>\n";
356 $s .= "\n<div id='footer'>";
357 $s .= "<table width='98%' border=0 cellspacing=0><tr>";
359 wfProfileOut( "$fname-1" );
360 wfProfileIn( "$fname-2" );
362 $qb = $this->qbSetting();
364 $left = ($qb == 1 ||
$qb == 3);
365 if($wgLang->isRTL()) $left = !$left;
367 if ( $shove && $left ) { # Left
368 $s .= $this->getQuickbarCompensator();
370 wfProfileOut( "$fname-2" );
371 wfProfileIn( "$fname-3" );
372 $l = $wgLang->isRTL() ?
"right" : "left";
373 $s .= "<td class='bottom' align='$l' valign='top'>";
375 $s .= $this->bottomLinks();
376 $s .= "\n<br>" . $this->mainPageLink()
377 . " | " . $this->aboutLink()
378 . " | " . $this->specialLink( "recentchanges" )
379 . " | " . $this->searchForm()
380 . "<br>" . $this->pageStats();
383 if ( $shove && !$left ) { # Right
384 $s .= $this->getQuickbarCompensator();
386 $s .= "</tr></table>\n</div>\n</div>\n";
388 wfProfileOut( "$fname-3" );
389 wfProfileIn( "$fname-4" );
390 if ( 0 != $qb ) { $s .= $this->quickBar(); }
391 wfProfileOut( "$fname-4" );
392 wfProfileOut( $fname );
396 function pageTitleLinks()
398 global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval ;
400 $s = $this->printableLink();
402 if ( $wgOut->isArticle() ) {
403 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
404 $name = $wgTitle->getDBkey();
405 $link = wfEscapeHTML( wfImageUrl( $name ) );
406 $style = $this->getInternalLinkAttributes( $link, $name );
407 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
409 # This will show the "Approve" link if $wgUseApproval=true;
410 if ( isset ( $wgUseApproval ) && $wgUseApproval )
412 $t = $wgTitle->getDBkey();
413 $name = "Approve this article" ;
414 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
415 #wfEscapeHTML( wfImageUrl( $name ) );
416 $style = $this->getExternalLinkAttributes( $link, $name );
417 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
419 if ( "history" == $action ||
isset( $diff ) ||
isset( $oldid ) ) {
420 $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
421 wfMsg( "currentrev" ) );
424 if ( $wgUser->getNewtalk() ) {
425 # do not show "You have new messages" text when we are viewing our
428 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
429 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
430 $n =$wgUser->getName();
431 $tl = $this->makeKnownLink( $wgLang->getNsText(
432 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
433 wfMsg("newmessageslink") );
434 $s.=" | <strong>". wfMsg( "newmessages", $tl ) . "</strong>";
437 if( $wgUser->isSysop() &&
438 (($wgTitle->getArticleId() == 0) ||
($action == "history")) &&
439 ($n = $wgTitle->isDeleted() ) ) {
440 $s .= " | " . wfMsg( "thisisdeleted",
441 $this->makeKnownLink(
442 $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
443 wfMsg( "restorelink", $n ) ) );
448 function printableLink()
450 global $wgOut, $wgTitle, $oldid, $action;
453 foreach( $_GET as $var => $val ) {
454 if( $var != "title" && $var != "printable" )
455 $q .= urlencode( $var ) . "=" . urlencode( $val );
457 if( !empty( $q ) ) $q .= "&";
459 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
460 WfMsg( "printableversion" ), "{$q}printable=yes" );
466 global $wgOut, $wgTitle, $wgUser;
468 $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
469 if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
473 function pageSubtitle()
475 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
477 $sub = $wgOut->getSubtitle();
479 global $wgExtraSubtitle;
480 $sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
482 if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
483 $ptext=$wgTitle->getPrefixedText();
484 if(preg_match("/\//",$ptext)) {
485 $sub.="</p><p class='subpages'>";
486 $links=explode("/",$ptext);
489 foreach($links as $link) {
491 if ($c<count($links)) {
492 $growinglink .= $link;
493 $getlink = $this->makeLink( $growinglink, $link );
494 if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
507 $s = "<p class='subtitle'>{$sub}\n";
511 function nameAndLogin()
513 global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader;
515 $li = $wgLang->specialPage( "Userlogin" );
516 $lo = $wgLang->specialPage( "Userlogout" );
519 if ( 0 == $wgUser->getID() ) {
520 if( $wgShowIPinHeader ) {
521 $n = getenv( "REMOTE_ADDR" );
523 $tl = $this->makeKnownLink( $wgLang->getNsText(
524 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
525 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
527 $s .= $n . " (".$tl.")";
529 $s .= wfMsg("notloggedin");
532 $rt = $wgTitle->getPrefixedURL();
533 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
535 } else { $q = "returnto={$rt}"; }
537 $s .= "\n<br>" . $this->makeKnownLink( $li,
538 wfMsg( "login" ), $q );
540 $n = $wgUser->getName();
541 $rt = $wgTitle->getPrefixedURL();
542 $tl = $this->makeKnownLink( $wgLang->getNsText(
543 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
544 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
548 $s .= $this->makeKnownLink( $wgLang->getNsText(
549 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br>" .
550 $this->makeKnownLink( $lo, wfMsg( "logout" ),
551 "returnto={$rt}" ) . " | " .
552 $this->specialLink( "preferences" );
554 $s .= " | " . $this->makeKnownLink( wfMsg( "helppage" ),
560 function searchForm()
564 $s = "<form name='search' class='inline' method=get action=\""
565 . wfLocalUrl( "" ) . "\">"
566 . "<input type=text name=\"search\" size=19 value=\""
567 . htmlspecialchars(substr($search,0,256)) . "\">\n"
568 . "<input type=submit name=\"go\" value=\"" . wfMsg ("go") . "\"> "
569 . "<input type=submit value=\"" . wfMsg ("search") . "\"></form>";
579 $s = $this->mainPageLink() . $sep
580 . $this->specialLink( "recentchanges" );
582 if ( $wgOut->isArticle() ) {
583 $s .= $sep . $this->editThisPage()
584 . $sep . $this->historyLink();
586 # Many people don't like this dropdown box
587 #$s .= $sep . $this->specialPagesList();
592 function bottomLinks()
594 global $wgOut, $wgUser, $wgTitle;
598 if ( $wgOut->isArticle() ) {
599 $s .= "<strong>" . $this->editThisPage() . "</strong>";
600 if ( 0 != $wgUser->getID() ) {
601 $s .= $sep . $this->watchThisPage();
603 $s .= $sep . $this->talkLink()
604 . $sep . $this->historyLink()
605 . $sep . $this->whatLinksHere()
606 . $sep . $this->watchPageLinksLink();
608 if ( $wgTitle->getNamespace() == Namespace::getUser()
609 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
612 $id=User
::idFromName($wgTitle->getText());
613 $ip=User
::isIP($wgTitle->getText());
615 if($id ||
$ip) { # both anons and non-anons have contri list
616 $s .= $sep . $this->userContribsLink();
618 if ( 0 != $wgUser->getID() ) { # show only to signed in users
619 if($id) { # can only email non-anons
620 $s .= $sep . $this->emailUserLink();
624 if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
625 $s .= "\n<br>" . $this->deleteThisPage() .
626 $sep . $this->protectThisPage() .
627 $sep . $this->moveThisPage();
629 $s .= "<br>\n" . $this->otherLanguages();
636 global $wgOut, $wgLang, $wgArticle;
637 global $oldid, $diff, $wgDisableCounters;
639 if ( ! $wgOut->isArticle() ) { return ""; }
640 if ( isset( $oldid ) ||
isset( $diff ) ) { return ""; }
641 if ( 0 == $wgArticle->getID() ) { return ""; }
643 if ( $wgDisableCounters ) {
646 $count = $wgArticle->getCount();
647 $s = wfMsg( "viewcount", $count );
649 $s .= $this->lastModified();
650 $s .= " " . wfMsg( "gnunote" );
651 return "<span id='pagestats'>{$s}</span>";
654 function lastModified()
656 global $wgLang, $wgArticle;
658 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
659 $s = " " . wfMsg( "lastmodified", $d );
663 function logoText( $align = "" )
665 if ( "" != $align ) { $a = " align='{$align}'"; }
668 $mp = wfMsg( "mainpage" );
669 $s = "<a href=\"" . wfLocalUrlE( urlencode( $mp ) )
670 . "\"><img{$a} border=0 src=\""
671 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\"></a>";
677 global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
678 global $wpPreview, $wgDisableUploads;
680 $fname = "Skin::quickBar";
681 wfProfileIn( $fname );
683 $tns=$wgTitle->getNamespace();
685 $s = "\n<div id='quickbar'>";
686 $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
689 $s .= $this->mainPageLink()
690 . $sep . $this->specialLink( "recentchanges" )
691 . $sep . $this->specialLink( "randompage" );
692 if ($wgUser->getID()) {
693 $s.= $sep . $this->specialLink( "watchlist" ) ;
694 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
695 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
698 // only show watchlist link if logged in
699 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
700 $s .= "\n<br><hr class='sep'>";
701 $articleExists = $wgTitle->getArticleId();
702 if ( $wgOut->isArticle() ||
$action =="edit" ||
$action =="history" ||
$wpPreview) {
703 if($wgOut->isArticle()) {
704 $s .= "<strong>" . $this->editThisPage() . "</strong>";
705 } else { # backlink to the article in edit or history mode
706 if($articleExists){ # no backlink if no article
709 $text = wfMsg("articlepage");
712 $text = wfMsg("viewtalkpage");
715 $text = wfMsg("userpage");
718 $text = wfMsg("viewtalkpage");
721 $text = wfMsg("wikipediapage");
724 $text = wfMsg("viewtalkpage");
727 $text = wfMsg("imagepage");
730 $text = wfMsg("viewtalkpage");
733 $text= wfMsg("articlepage");
736 $link = $wgTitle->getText();
737 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
738 $link = $nstext . ":" . $link ;
741 $s .= $this->makeLink( $link, $text );
742 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
743 # we just throw in a "New page" text to tell the user that he's in edit mode,
744 # and to avoid messing with the separator that is prepended to the next item
745 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
751 if( $tns%2
&& $action!="edit" && !$wpPreview) {
752 $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
756 watching could cause problems in edit mode:
757 if user edits article, then loads "watch this article" in background and then saves
758 article with "Watch this article" checkbox disabled, the article is transparently
759 unwatched. Therefore we do not show the "Watch this page" link in edit mode
761 if ( 0 != $wgUser->getID() && $articleExists) {
762 if($action!="edit" && $action!="history" &&
763 $action != "submit" )
765 $s .= $sep . $this->watchThisPage();
767 if ( $wgTitle->userCanEdit() )
768 $s .= $sep . $this->moveThisPage();
770 if ( $wgUser->isSysop() and $articleExists ) {
771 $s .= $sep . $this->deleteThisPage() .
772 $sep . $this->protectThisPage();
774 $s .= $sep . $this->talkLink();
775 if ($articleExists && $action !="history") {
776 $s .= $sep . $this->historyLink();
778 $s.=$sep . $this->whatLinksHere();
780 if($wgOut->isArticle()) {
781 $s .= $sep . $this->watchPageLinksLink();
784 if ( Namespace::getUser() == $wgTitle->getNamespace()
785 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
788 $id=User
::idFromName($wgTitle->getText());
789 $ip=User
::isIP($wgTitle->getText());
792 $s .= $sep . $this->userContribsLink();
794 if ( 0 != $wgUser->getID() ) {
795 if($id) { # can only email real users
796 $s .= $sep . $this->emailUserLink();
800 $s .= "\n<br><hr class='sep'>";
803 if ( 0 != $wgUser->getID() && !$wgDisableUploads ) {
804 $s .= $this->specialLink( "upload" ) . $sep;
806 $s .= $this->specialLink( "specialpages" )
807 . $sep . $this->bugReportsLink();
809 global $wgSiteSupportPage;
810 if( $wgSiteSupportPage ) {
811 $s .= "\n<br><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
812 "\" class=\"internal\">" . wfMsg( "sitesupport" ) . "</a>";
815 $s .= "\n<br></div>\n";
816 wfProfileOut( $fname );
820 function specialPagesList()
822 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
825 $validSP = $wgLang->getValidSpecialPages();
827 foreach ( $validSP as $name => $desc ) {
828 if ( "" == $desc ) { continue; }
831 if ( $wgUser->isSysop() )
833 $sysopSP = $wgLang->getSysopSpecialPages();
835 foreach ( $sysopSP as $name => $desc ) {
836 if ( "" == $desc ) { continue; }
840 if ( $wgUser->isDeveloper() )
842 $devSP = $wgLang->getDeveloperSpecialPages();
844 foreach ( $devSP as $name => $desc ) {
845 if ( "" == $desc ) { continue; }
850 $sp = wfMsg( "specialpages" );
851 $spp = $wgLang->specialPage( "Specialpages" );
853 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
854 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
855 $s .= "<select name=\"wpDropdown\">\n";
856 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
858 foreach ( $a as $name => $desc ) {
859 $p = $wgLang->specialPage( $name );
860 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
863 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
868 function mainPageLink()
870 $mp = wfMsg( "mainpage" );
871 $s = $this->makeKnownLink( $mp, $mp );
875 function copyrightLink()
877 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
878 wfMsg( "copyrightpagename" ) );
884 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
885 wfMsg( "aboutwikipedia" ) );
889 function editThisPage()
891 global $wgOut, $wgTitle, $oldid, $redirect, $diff;
893 if ( ! $wgOut->isArticle() ||
$diff ) {
894 $s = wfMsg( "protectedpage" );
895 } else if ( $wgTitle->userCanEdit() ) {
896 $n = $wgTitle->getPrefixedText();
897 $t = wfMsg( "editthispage" );
900 if ( $redirect ) { $red = "&redirect={$redirect}"; }
901 if ( $oldid && ! isset( $diff ) ) {
902 $oid = "&oldid={$oldid}";
904 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
906 $s = wfMsg( "protectedpage" );
911 function deleteThisPage()
913 global $wgUser, $wgOut, $wgTitle, $diff;
915 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
916 $n = $wgTitle->getPrefixedText();
917 $t = wfMsg( "deletethispage" );
919 $s = $this->makeKnownLink( $n, $t, "action=delete" );
926 function protectThisPage()
928 global $wgUser, $wgOut, $wgTitle, $diff;
930 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
931 $n = $wgTitle->getPrefixedText();
933 if ( $wgTitle->isProtected() ) {
934 $t = wfMsg( "unprotectthispage" );
935 $q = "action=unprotect";
937 $t = wfMsg( "protectthispage" );
938 $q = "action=protect";
940 $s = $this->makeKnownLink( $n, $t, $q );
947 function watchThisPage()
949 global $wgUser, $wgOut, $wgTitle, $diff;
951 if ( $wgOut->isArticle() && ( ! $diff ) ) {
952 $n = $wgTitle->getPrefixedText();
954 if ( $wgTitle->userIsWatching() ) {
955 $t = wfMsg( "unwatchthispage" );
956 $q = "action=unwatch";
958 $t = wfMsg( "watchthispage" );
961 $s = $this->makeKnownLink( $n, $t, $q );
963 $s = wfMsg( "notanarticle" );
968 function moveThisPage()
970 global $wgTitle, $wgLang;
972 if ( $wgTitle->userCanEdit() ) {
973 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
974 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
975 } // no message if page is protected - would be redundant
979 function historyLink()
983 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
984 wfMsg( "history" ), "action=history" );
988 function whatLinksHere()
990 global $wgTitle, $wgLang;
992 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
993 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
997 function userContribsLink()
999 global $wgTitle, $wgLang;
1001 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1002 wfMsg( "contributions" ), "target=" . $wgTitle->getURL() );
1006 function emailUserLink()
1008 global $wgTitle, $wgLang;
1010 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
1011 wfMsg( "emailuser" ), "target=" . $wgTitle->getURL() );
1015 function watchPageLinksLink()
1017 global $wgOut, $wgTitle, $wgLang;
1019 if ( ! $wgOut->isArticle() ) {
1020 $s = "(" . wfMsg( "notanarticle" ) . ")";
1022 $s = $this->makeKnownLink( $wgLang->specialPage(
1023 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
1024 "target=" . $wgTitle->getPrefixedURL() );
1029 function otherLanguages()
1031 global $wgOut, $wgLang, $wgTitle;
1033 $a = $wgOut->getLanguageLinks();
1035 if ( 0 == count( $a ) ) {
1036 if ( !$wgUseNewInterlanguage ) return "";
1037 $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
1038 if ( $ns != 0 AND $ns != 1 ) return "" ;
1040 $x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
1041 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1042 wfMsg( "intl" ) , $x );
1045 if ( !$wgUseNewInterlanguage ) {
1046 $s = wfMsg( "otherlanguages" ) . ": ";
1048 global $wgLanguageCode ;
1049 $x = "mode=zoom&xt=".$wgTitle->getDBkey() ;
1050 $x .= "&xl=".$wgLanguageCode ;
1051 $s = $this->makeKnownLink( $wgLang->specialPage( "Intl" ),
1052 wfMsg( "otherlanguages" ) , $x ) . ": " ;
1055 $s = wfMsg( "otherlanguages" ) . ": ";
1057 if($wgLang->isRTL()) $s .= "<span dir='LTR'>";
1058 foreach( $a as $l ) {
1059 if ( ! $first ) { $s .= " | "; }
1062 $nt = Title
::newFromText( $l );
1063 $url = $nt->getFullURL();
1064 $text = $wgLang->getLanguageName( $nt->getInterwiki() );
1066 if ( "" == $text ) { $text = $l; }
1067 $style = $this->getExternalLinkAttributes( $l, $text );
1068 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
1070 if($wgLang->isRTL()) $s .= "</span>";
1074 function bugReportsLink()
1076 $s = $this->makeKnownLink( wfMsg( "bugreportspage" ),
1077 wfMsg( "bugreports" ) );
1083 global $wgLinkCache;
1084 $t1 = Title
::newFromText( gmdate( "F j" ) );
1085 $t2 = Title
::newFromText( gmdate( "Y" ) );
1087 $wgLinkCache->suspend();
1088 $id = $t1->getArticleID();
1089 $wgLinkCache->resume();
1092 $s = $this->makeBrokenLink( $t1->getText() );
1094 $s = $this->makeKnownLink( $t1->getText() );
1098 $wgLinkCache->suspend();
1099 $id = $t2->getArticleID();
1100 $wgLinkCache->resume();
1103 $s .= $this->makeBrokenLink( $t2->getText() );
1105 $s .= $this->makeKnownLink( $t2->getText() );
1112 global $wgLang, $wgTitle, $wgLinkCache;
1114 $tns = $wgTitle->getNamespace();
1115 if ( -1 == $tns ) { return ""; }
1117 $pn = $wgTitle->getText();
1118 $tp = wfMsg( "talkpage" );
1119 if ( Namespace::isTalk( $tns ) ) {
1120 $lns = Namespace::getSubject( $tns );
1123 $text = wfMsg("articlepage");
1126 $text = wfMsg("userpage");
1129 $text = wfMsg("wikipediapage");
1132 $text = wfMsg("imagepage");
1135 $text= wfMsg("articlepage");
1139 $lns = Namespace::getTalk( $tns );
1142 $n = $wgLang->getNsText( $lns );
1143 if ( "" == $n ) { $link = $pn; }
1144 else { $link = "{$n}:{$pn}"; }
1146 $wgLinkCache->suspend();
1147 $s = $this->makeLink( $link, $text );
1148 $wgLinkCache->resume();
1153 function commentLink()
1155 global $wgLang, $wgTitle, $wgLinkCache;
1157 $tns = $wgTitle->getNamespace();
1158 if ( -1 == $tns ) { return ""; }
1160 $lns = ( Namespace::isTalk( $tns ) ) ?
$tns : Namespace::getTalk( $tns );
1162 # assert Namespace::isTalk( $lns )
1164 $n = $wgLang->getNsText( $lns );
1165 $pn = $wgTitle->getText();
1167 $link = "{$n}:{$pn}";
1169 $wgLinkCache->suspend();
1170 $s = $this->makeKnownLink($link, wfMsg("postcomment"), "action=edit§ion=new");
1171 $wgLinkCache->resume();
1176 # After all the page content is transformed into HTML, it makes
1177 # a final pass through here for things like table backgrounds.
1179 function transformContent( $text )
1184 # Note: This function MUST call getArticleID() on the link,
1185 # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
1187 function makeLink( $title, $text = "", $query = "", $trail = "" ) {
1188 wfProfileIn( "Skin::makeLink" );
1189 $nt = Title
::newFromText( $title );
1191 $result = $this->makeLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1193 wfDebug( "Invalid title passed to Skin::makeLink(): \"$title\"\n" );
1194 $result = $text == "" ?
$title : $text;
1197 wfProfileOut( "Skin::makeLink" );
1201 function makeKnownLink( $title, $text = "", $query = "", $trail = "" ) {
1202 $nt = Title
::newFromText( $title );
1204 return $this->makeKnownLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1206 wfDebug( "Invalid title passed to Skin::makeKnownLink(): \"$title\"\n" );
1207 return $text == "" ?
$title : $text;
1211 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" ) {
1212 $nt = Title
::newFromText( $title );
1214 return $this->makeBrokenLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1216 wfDebug( "Invalid title passed to Skin::makeBrokenLink(): \"$title\"\n" );
1217 return $text == "" ?
$title : $text;
1221 function makeStubLink( $title, $text = "", $query = "", $trail = "" ) {
1222 $nt = Title
::newFromText( $title );
1224 return $this->makeStubLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1226 wfDebug( "Invalid title passed to Skin::makeStubLink(): \"$title\"\n" );
1227 return $text == "" ?
$title : $text;
1231 # Pass a title object, not a title string
1232 function makeLinkObj( &$nt, $text= "", $query = "", $trail = "" )
1234 global $wgOut, $wgUser;
1235 if ( $nt->isExternal() ) {
1236 $u = $nt->getFullURL();
1237 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1238 $style = $this->getExternalLinkAttributes( $link, $text );
1241 if ( "" != $trail ) {
1242 if ( preg_match( "/^([a-z]+)(.*)$$/sD", $trail, $m ) ) {
1247 $retVal = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1248 } elseif ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
1249 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1250 } elseif ( ( -1 == $nt->getNamespace() ) ||
1251 ( Namespace::getImage() == $nt->getNamespace() ) ) {
1252 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1254 $aid = $nt->getArticleID() ;
1256 $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail );
1258 $threshold = $wgUser->getOption("stubthreshold") ;
1259 if ( $threshold > 0 ) {
1260 $res = wfQuery ( "SELECT HIGH_PRIORITY length(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ
) ;
1262 if ( wfNumRows( $res ) > 0 ) {
1263 $s = wfFetchObject( $res );
1265 if ( $s->cur_is_redirect
OR $s->cur_namespace
!= 0 ) {
1266 $size = $threshold*2 ; # Really big
1268 wfFreeResult( $res );
1270 $size = $threshold*2 ; # Really big
1275 if ( $size < $threshold ) {
1276 $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail );
1278 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1285 # Pass a title object, not a title string
1286 function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1288 global $wgOut, $wgTitle;
1290 $fname = "Skin::makeKnownLinkObj";
1291 wfProfileIn( $fname );
1293 $link = $nt->getPrefixedURL();
1295 if ( "" == $link ) {
1297 if ( "" == $text ) { $text = $nt->getFragment(); }
1299 $u = wfLocalUrlE( $link, $query );
1301 if ( "" != $nt->getFragment() ) {
1302 $u .= "#" . wfEscapeHTML( $nt->getFragment() );
1304 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1305 $style = $this->getInternalLinkAttributesObj( $nt, $text );
1308 if ( "" != $trail ) {
1309 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1314 $r = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1315 wfProfileOut( $fname );
1319 # Pass a title object, not a title string
1320 function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1322 global $wgOut, $wgUser;
1324 $fname = "Skin::makeBrokenLinkObj";
1325 wfProfileIn( $fname );
1327 $link = $nt->getPrefixedURL();
1329 if ( "" == $query ) { $q = "action=edit"; }
1330 else { $q = "action=edit&{$query}"; }
1331 $u = wfLocalUrlE( $link, $q );
1333 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1334 $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
1337 if ( "" != $trail ) {
1338 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1343 if ( $wgOut->isPrintable() ||
1344 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1345 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1347 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
1350 wfProfileOut( $fname );
1354 # Pass a title object, not a title string
1355 function makeStubLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1357 global $wgOut, $wgUser;
1359 $link = $nt->getPrefixedURL();
1361 $u = wfLocalUrlE( $link, $query );
1363 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1364 $style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
1367 if ( "" != $trail ) {
1368 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1373 if ( $wgOut->isPrintable() ||
1374 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1375 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1377 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1382 function fnamePart( $url )
1384 $basename = strrchr( $url, "/" );
1385 if ( false === $basename ) { $basename = $url; }
1386 else { $basename = substr( $basename, 1 ); }
1387 return wfEscapeHTML( $basename );
1390 function makeImage( $url, $alt = "" )
1394 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1395 $s = "<img src=\"{$url}\" alt=\"{$alt}\">";
1399 function makeImageLink( $name, $url, $alt = "" ) {
1400 $nt = Title
::makeTitle( Namespace::getImage(), $name );
1401 return $this->makeImageLinkObj( $nt, $alt );
1404 function makeImageLinkObj( $nt, $alt = "" ) {
1405 $link = $nt->getPrefixedURL();
1406 $name = $nt->getDBKey();
1407 $url = wfImageUrl( $name );
1408 if ( empty( $alt ) ) {
1409 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1411 $alt = htmlspecialchars( $alt );
1413 $u = wfLocalUrlE( $link );
1414 $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
1415 "<img border=\"0\" src=\"{$url}\" alt=\"{$alt}\"></a>";
1419 function makeMediaLink( $name, $url, $alt = "" ) {
1420 $nt = Title
::makeTitle( Namespace::getMedia(), $name );
1421 return $this->makeMediaLinkObj( $nt, $alt );
1424 function makeMediaLinkObj( $nt, $alt = "" )
1426 $name = $nt->getDBKey();
1427 $url = wfImageUrl( $name );
1428 if ( empty( $alt ) ) {
1429 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1432 $u = htmlspecialchars( $url );
1433 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1437 function specialLink( $name, $key = "" )
1441 if ( "" == $key ) { $key = strtolower( $name ); }
1442 $pn = $wgLang->ucfirst( $name );
1443 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1447 # Called by history lists and recent changes
1450 function beginRecentChangesList()
1452 $rc_cache = array() ;
1454 $this->lastdate
= "";
1458 function beginHistoryList()
1460 $this->lastdate
= $this->lastline
= "";
1461 $s = "\n<p>" . wfMsg( "histlegend" ) . "\n<ul>";
1465 function beginImageHistoryList()
1467 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1468 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul>";
1472 function endRecentChangesList()
1474 $s = $this->recentChangesBlock() ;
1479 function endHistoryList()
1481 $last = wfMsg( "last" );
1483 $s = preg_replace( "/!OLDID![0-9]+!/", $last, $this->lastline
);
1488 function endImageHistoryList()
1494 function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor )
1498 $artname = Title
::makeName( $ns, $ttl );
1499 $last = wfMsg( "last" );
1500 $cur = wfMsg( "cur" );
1501 $cr = wfMsg( "currentrev" );
1503 if ( $oid && $this->lastline
) {
1504 $ret = preg_replace( "/!OLDID!([0-9]+)!/", $this->makeKnownLink(
1505 $artname, $last, "diff=\\1&oldid={$oid}" ), $this->lastline
);
1509 $dt = $wgLang->timeanddate( $ts, true );
1511 if ( $oid ) { $q = "oldid={$oid}"; }
1513 $link = $this->makeKnownLink( $artname, $dt, $q );
1516 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1517 $ut, "target=" . $ut );
1519 $ul = $this->makeLink( $wgLang->getNsText(
1520 Namespace::getUser() ) . ":{$ut}", $ut ); }
1524 $curlink = $this->makeKnownLink( $artname, $cur,
1525 "diff=0&oldid={$oid}" );
1529 $s .= "({$curlink}) (!OLDID!{$oid}!) . .";
1531 $M = wfMsg( "minoreditletter" );
1532 if ( $isminor ) { $s .= " <strong>{$M}</strong>"; }
1533 $s .= " {$link} . . {$ul}";
1535 if ( "" != $c && "*" != $c ) { $s .= " <em>(" . wfEscapeHTML($c) . ")</em>"; }
1538 $this->lastline
= $s;
1542 function recentChangesBlockLine ( $y ) {
1543 global $wgUploadPath ;
1545 $M = wfMsg( "minoreditletter" );
1546 $N = wfMsg( "newpageletter" );
1548 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>" ;
1550 if ( $y->isnew
) $r .= $N ;
1551 else $r .= " " ;
1552 if ( $y->isminor
) $r .= $M ;
1553 else $r .= " " ;
1554 $r .= " ".$y->timestamp
." " ;
1557 if ( $y->watched
) $link = "<strong>{$link}</strong>" ;
1563 $r .= $this->makeKnownLink( $y->secureName
, wfMsg( "hist" ), "action=history" );
1565 $r .= ") . . ".$y->userlink
;
1566 $r .= $y->usertalklink
;
1567 if ( $y->usercomment
!= "" )
1568 $r .= " <em>(".wfEscapeHTML($y->usercomment
).")</em>" ;
1573 function recentChangesBlockGroup ( $y ) {
1574 global $wgUploadPath ;
1577 $M = wfMsg( "minoreditletter" );
1578 $N = wfMsg( "newpageletter" );
1580 $userlinks = array () ;
1581 foreach ( $y AS $x ) {
1582 $oldid = $x->diffid
;
1583 if ( $x->isnew
) $isnew = true ;
1585 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1589 krsort ( $userlinks ) ;
1590 asort ( $userlinks ) ;
1592 $u = array_keys ( $userlinks ) ;
1593 foreach ( $u as $x ) {
1595 if ( $userlinks[$x] > 1 ) $z .= " ({$userlinks[$x]}×)" ;
1596 array_push ( $users , $z ) ;
1598 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1601 $e = array_shift ( $e ) ;
1604 $rci = "RCI{$this->rccc}" ;
1605 $rcl = "RCL{$this->rccc}" ;
1606 $rcm = "RCM{$this->rccc}" ;
1607 $tl = "<a href='javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")'>" ;
1608 $tl .= "<span id='{$rcm}'><img src='{$wgUploadPath}/Arr_r.png' width=12 height=12 border=0></span>" ;
1609 $tl .= "<span id='{$rcl}' style='display:none'><img src='{$wgUploadPath}/Arr_d.png' width=12 height=12 border=0></span>" ;
1615 if ( $isnew ) $r .= $N ;
1616 else $r .= " " ;
1617 $r .= " " ; # Minor
1618 $r .= " ".$e->timestamp
." " ;
1622 if ( $e->watched
) $link = "<strong>{$link}</strong>" ;
1626 $r .= " (".count($y)." " ;
1627 if ( $isnew ) $r .= wfMsg("changes");
1628 else $r .= $this->makeKnownLink( $e->secureName
, wfMsg("changes") , "diff=0&oldid=".$oldid ) ;
1630 $r .= $this->makeKnownLink( $e->secureName
, wfMsg( "history" ), "action=history" );
1638 $r .= "<div id='{$rci}' style='display:none'>" ;
1639 foreach ( $y AS $x )
1641 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>";
1642 $r .= "<tt> " ;
1643 if ( $x->isnew
) $r .= $N ;
1644 else $r .= " " ;
1645 if ( $x->isminor
) $r .= $M ;
1646 else $r .= " " ;
1650 if ( $x->oldid
!= 0 ) $o = "oldid=".$x->oldid
;
1651 if ( $x->islog
) $link = $x->timestamp
;
1652 else $link = $this->makeKnownLink( $x->secureName
, $x->timestamp
, $o ) ;
1653 $link = "<tt>{$link}</tt>" ;
1660 $r .= $x->lastlink
;
1661 $r .= ") . . ".$x->userlink
;
1662 $r .= $x->usertalklink
;
1663 if ( $x->usercomment
!= "" )
1664 $r .= " <em>(".wfEscapeHTML($x->usercomment
).")</em>" ;
1673 function recentChangesBlock ()
1675 global $wgUploadPath ;
1676 if ( count ( $this->rc_cache
) == 0 ) return "" ;
1677 $k = array_keys ( $this->rc_cache
) ;
1678 foreach ( $k AS $x )
1680 $y = $this->rc_cache
[$x] ;
1681 if ( count ( $y ) < 2 ) {
1682 $r .= $this->recentChangesBlockLine ( array_shift ( $y ) ) ;
1684 $r .= $this->recentChangesBlockGroup ( $y ) ;
1688 return "<div align=left>{$r}</div>" ;
1691 function recentChangesLine( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1694 $usenew = $wgUser->getOption( "usenewrc" );
1696 $r = $this->recentChangesLineNew ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1698 $r = $this->recentChangesLineOld ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1702 function recentChangesLineOld( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0, $diffid = 0 )
1704 global $wgTitle, $wgLang, $wgUser;
1706 $d = $wgLang->date( $ts, true);
1708 if ( $d != $this->lastdate
) {
1709 if ( "" != $this->lastdate
) { $s .= "</ul>\n"; }
1710 $s .= "<h4>{$d}</h4>\n<ul>";
1711 $this->lastdate
= $d;
1713 $h = $wgLang->time( $ts, true );
1714 $t = Title
::makeName( $ns, $ttl );
1715 $clink = $this->makeKnownLink( $t , "" );
1716 $nt = Title
::newFromText( $t );
1719 $clink = "<strong>{$clink}</strong>";
1721 $hlink = $this->makeKnownLink( $t, wfMsg( "hist" ), "action=history" );
1722 if ( $isnew ||
$nt->isLog() ) {
1723 $dlink = wfMsg( "diff" );
1725 $dlink = $this->makeKnownLink( $t, wfMsg( "diff" ),
1726 "diff={$oldid}&oldid={$diffid}" ); # Finagle's law
1729 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1730 $ut, "target=" . $ut );
1732 $ul = $this->makeLink( $wgLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut );
1735 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1736 global $wgDisableAnonTalk;
1737 if( 0 == $u && $wgDisableAnonTalk ) {
1740 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1741 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1743 $cr = wfMsg( "currentrev" );
1745 $s .= "<li> ({$dlink}) ({$hlink}) . .";
1746 $M = wfMsg( "minoreditletter" );
1747 $N = wfMsg( "newpageletter" );
1748 if ( $isminor ) { $s .= " <strong>{$M}</strong>"; }
1749 if ( $isnew ) { $s .= "<strong>{$N}</strong>"; }
1750 $s .= " {$clink}; {$h} . . {$ul}";
1753 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1754 $blink = $this->makeKnownLink( $wgLang->specialPage(
1755 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1759 if($utl) $utl .= " | ";
1762 if($utl) $s.=" ({$utl})";
1764 if ( "" != $c && "*" != $c ) {
1765 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1772 function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1774 global $wgTitle, $wgLang, $wgUser;
1776 $rc = new RecentChangesClass
;
1778 $d = $wgLang->date( $ts, true);
1781 if ( $d != $this->lastdate
) {
1782 $ret = $this->recentChangesBlock () ;
1783 $this->rc_cache
= array() ;
1784 $ret .= "<h4>{$d}</h4>\n";
1785 $this->lastdate
= $d;
1787 $h = $wgLang->time( $ts, true );
1788 $t = Title
::makeName( $ns, $ttl );
1789 $clink = $this->makeKnownLink( $t, "" ) ;
1790 if ( $oldid == 0 ) $c2link = $clink ;
1791 else $c2link = $this->makeKnownLink( $t, "" , "oldid={$oldid}" );
1792 $nt = Title
::newFromText( $t );
1794 $rc->timestamp
= $h ;
1795 $rc->oldid
= $oldid ;
1796 $rc->diffid
= $diffid ;
1797 $rc->watched
= $watched ;
1798 $rc->isnew
= $isnew ;
1799 $rc->isminor
= $isminor ;
1800 $rc->secureName
= $t ;
1801 $rc->displayName
= $nt ;
1802 $rc->link
= $clink ;
1803 $rc->usercomment
= $c ;
1804 $rc->islog
= $nt->isLog() ;
1806 if ( ( $isnew && $oldid == 0 ) ||
$nt->isLog() ) {
1807 $dlink = wfMsg( "cur" );
1809 $dlink = $this->makeKnownLink( $t, wfMsg( "cur" ),
1810 "diff=0&oldid={$oldid}" );
1813 if ( $diffid == 0 ||
$nt->isLog() ) {
1814 $plink = wfMsg( "last" );
1816 $plink = $this->makeKnownLink( $t, wfMsg( "last" ),
1817 "diff={$oldid}&oldid={$diffid}" );
1821 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1822 $ut, "target=" . $ut );
1823 } else { $ul = $this->makeLink( $wgLang->getNsText(
1824 Namespace::getUser() ) . ":{$ut}", $ut ); }
1826 $rc->userlink
= $ul ;
1827 $rc->lastlink
= $plink ;
1828 $rc->curlink
= $dlink ;
1830 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1831 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1832 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1834 global $wgDisableAnonTalk;
1835 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1836 $blink = $this->makeKnownLink( $wgLang->specialPage(
1837 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1838 if( $wgDisableAnonTalk )
1839 $rc->usertalklink
= " ({$blink})";
1841 $rc->usertalklink
= " ({$utl} | {$blink})";
1843 if( $wgDisableAnonTalk && ($u == 0) )
1844 $rc->usertalklink
= "";
1846 $rc->usertalklink
= " ({$utl})";
1849 if ( !isset ( $this->rc_cache
[$t] ) ) $this->rc_cache
[$t] = array() ;
1850 array_push ( $this->rc_cache
[$t] , $rc ) ;
1855 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
1857 global $wgUser, $wgLang, $wgTitle;
1859 $dt = $wgLang->timeanddate( $ts, true );
1860 $del = wfMsg( "deleteimg" );
1861 $cur = wfMsg( "cur" );
1864 $url = wfImageUrl( $img );
1866 if ( $wgUser->isSysop() ) {
1867 $link = wfLocalUrlE( $wgTitle->getPrefixedText(), "image=" . $wgTitle->getURL() .
1869 $style = $this->getInternalLinkAttributes( $link, $del );
1871 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
1876 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
1877 if( $wgUser->getID() != 0 ) {
1878 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1879 wfMsg( "revertimg" ), "action=revert&oldimage=" .
1880 urlencode( $img ) );
1881 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1882 $del, "action=delete&oldimage=" . urlencode( $img ) );
1884 # Having live active links for non-logged in users
1885 # means that bots and spiders crawling our site can
1886 # inadvertently change content. Baaaad idea.
1887 $rlink = wfMsg( "revertimg" );
1891 if ( 0 == $u ) { $ul = $ut; }
1892 else { $ul = $this->makeLink( $wgLang->getNsText(
1893 Namespace::getUser() ) . ":{$ut}", $ut ); }
1895 $nb = wfMsg( "nbytes", $size );
1896 $style = $this->getInternalLinkAttributes( $url, $dt );
1898 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
1899 . " . . {$ul} ({$nb})";
1901 if ( "" != $c && "*" != $c ) {
1902 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1908 function tocIndent($level) {
1910 while($level-->0) $rv.="<div style=\"margin-left:2em;\">\n";
1915 function tocUnindent($level) {
1916 while($level-->0) $rv.="</div>\n";
1920 // parameter level defines if we are on an indentation level
1921 function tocLine($anchor,$tocline,$level) {
1925 return "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n";
1928 return "<div style=\"margin-bottom:0px;\">\n".
1929 "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n".
1935 function tocTable($toc) {
1936 // note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
1940 $hideline = " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>";
1943 "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
1944 "<b>".wfMsg("toc")."</b>" .
1946 "</td></tr><tr id='tocinside'><td align=\"left\">\n".
1947 $toc."</td></tr></table><P>\n";
1950 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
1951 function editSectionScript($section,$head) {
1953 global $wgTitle,$wgUser,$oldid;
1954 if($oldid) return $head;
1955 $url = wfLocalUrlE(urlencode($wgTitle->getPrefixedText()),"action=edit§ion=$section");
1956 return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
1959 function editSectionLink($section) {
1962 global $wgTitle,$wgUser,$oldid;
1963 if($oldid) return "";
1964 if ($printable) return "";
1965 $editurl="§ion={$section}";
1966 $url=$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
1967 return "<div style=\"float:right;margin-left:5px;\"><small>[".$url."]</small></div>";
1972 include_once( "SkinStandard.php" );
1973 include_once( "SkinNostalgia.php" );
1974 include_once( "SkinCologneBlue.php" );
1976 #include_once( "SkinSmarty.php" );