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
133 $s .= "a.stub, a.new, a.internal, a.external { " .
134 "text-decoration: none; }\n";
136 if ( 1 == $wgUser->getOption( "highlightbroken" ) ) {
137 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
139 if ( 1 == $wgUser->getOption( "justify" ) ) {
140 $s .= "#article { text-align: justify; }\n";
145 function getBodyOptions()
147 global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $oldid, $redirect, $diff,$action;
149 if ( 0 != $wgTitle->getNamespace() ) {
150 $a = array( "bgcolor" => "#ffffec" );
152 else $a = array( "bgcolor" => "#FFFFFF" );
153 if($wgOut->isArticle() && $wgUser->getOption("editondblclick")
155 (!$wgTitle->isProtected() ||
$wgUser->isSysop())
158 $n = $wgTitle->getPrefixedURL();
159 $t = wfMsg( "editthispage" );
161 if ( $redirect ) { $red = "&redirect={$redirect}"; }
162 if ( $oldid && ! isset( $diff ) ) {
163 $oid = "&oldid={$oldid}";
165 $s = wfLocalUrlE($n,"action=edit{$oid}{$red}");
166 $s = "document.location = \"" .$s ."\";";
167 $a +
= array ("ondblclick" => $s);
170 if($action=="edit") { # set focus in edit box
171 $foc = "document.editform.wpTextbox1.focus()";
173 $a['onload'] .= ";$foc";
181 function getExternalLinkAttributes( $link, $text )
183 global $wgUser, $wgOut, $wgLang;
185 $link = urldecode( $link );
186 $link = $wgLang->checkTitleEncoding( $link );
187 $link = str_replace( "_", " ", $link );
188 $link = wfEscapeHTML( $link );
190 if ( $wgOut->isPrintable() ) { $r = " class='printable'"; }
191 else { $r = " class='external'"; }
193 if ( 1 == $wgUser->getOption( "hover" ) ) {
194 $r .= " title=\"{$link}\"";
199 function getInternalLinkAttributes( $link, $text, $broken = false )
201 global $wgUser, $wgOut;
203 $link = urldecode( $link );
204 $link = str_replace( "_", " ", $link );
205 $link = wfEscapeHTML( $link );
207 if ( $wgOut->isPrintable() ) {
208 $r = " class='printable'";
209 } else if ( $broken == "stub" ) {
210 $r = " class='stub'";
211 } else if ( $broken == "yes" ) {
214 $r = " class='internal'";
217 if ( 1 == $wgUser->getOption( "hover" ) ) {
218 $r .= " title=\"{$link}\"";
223 function getInternalLinkAttributesObj( &$nt, $text, $broken = false )
225 global $wgUser, $wgOut;
226 $link = $nt->getEscapedText();
228 if ( $wgOut->isPrintable() ) {
229 $r = " class='printable'";
230 } else if ( $broken == "stub" ) {
231 $r = " class='stub'";
232 } else if ( $broken == "yes" ) {
235 $r = " class='internal'";
238 if ( 1 == $wgUser->getOption( "hover" ) ) {
239 $r .= ' title ="' . $nt->getEscapedText() . '"';
250 # This will be called immediately after the <body> tag. Split into
251 # two functions to make it easier to subclass.
253 function beforeContent()
255 global $wgUser, $wgOut;
257 if ( $wgOut->isPrintable() ) {
258 $s = $this->pageTitle() . $this->pageSubtitle() . "\n";
259 $s .= "\n<div class='bodytext'>";
262 return $this->doBeforeContent();
265 function doBeforeContent()
267 global $wgUser, $wgOut, $wgTitle, $wgLang;
268 $fname = "Skin::doBeforeContent";
269 wfProfileIn( $fname );
272 $qb = $this->qbSetting();
274 if( $langlinks = $this->otherLanguages() ) {
280 $borderhack = "class='top'";
283 $s .= "\n<div id='content'>\n<div id='topbar'>" .
284 "<table width='98%' border=0 cellspacing=0><tr>";
287 $left = ($qb == 1 ||
$qb == 3);
288 if($wgLang->isRTL()) $left = !$left;
291 $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>" .
292 $this->logoText() . "</td>";
294 $s .= $this->getQuickbarCompensator( $rows );
296 $l = $wgLang->isRTL() ?
"right" : "left";
297 $s .= "<td {$borderhack} align='$l' valign='top'>";
299 $s .= $this->topLinks() ;
300 $s .= "<p class='subtitle'>" . $this->pageTitleLinks();
302 $r = $wgLang->isRTL() ?
"left" : "right";
303 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap>";
304 $s .= $this->nameAndLogin();
305 $s .= "\n<br>" . $this->searchForm() . "</td>";
308 $s .= "</tr>\n<tr><td class='top' colspan=\"2\">$langlinks</td>";
311 if ( $shove && !$left ) { # Right
312 $s .= $this->getQuickbarCompensator( $rows );
314 $s .= "</tr></table>\n</div>\n";
315 $s .= "\n<div id='article'>";
317 $s .= $this->pageTitle();
318 $s .= $this->pageSubtitle() ;
319 $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
321 wfProfileOut( $fname );
325 function getQuickbarCompensator( $rows = 1 )
327 return "<td width='152' rowspan='{$rows}'> </td>";
330 # This gets called immediately before the </body> tag.
332 function afterContent()
334 global $wgUser, $wgOut, $wgServer, $HTTP_SERVER_VARS;
337 if ( $wgOut->isPrintable() ) {
340 $u = $wgServer . $wgTitle->getFullURL();
341 $rf = wfMsg( "retrievedfrom", $u );
343 if ( $wgOut->isArticle() ) {
344 $lm = "<br>" . $this->lastModified();
347 $cr = wfMsg( "gnunote" );
348 $s .= "<p><em>{$rf}{$lm} {$cr}</em>\n";
351 return $this->doAfterContent();
354 function doAfterContent()
356 global $wgUser, $wgOut, $wgLang;
357 $fname = "Skin::doAfterContent";
358 wfProfileIn( $fname );
359 wfProfileIn( "$fname-1" );
361 $s = "\n</div><br clear=all>\n";
362 $s .= "\n<div id='footer'>";
363 $s .= "<table width='98%' border=0 cellspacing=0><tr>";
365 wfProfileOut( "$fname-1" );
366 wfProfileIn( "$fname-2" );
368 $qb = $this->qbSetting();
370 $left = ($qb == 1 ||
$qb == 3);
371 if($wgLang->isRTL()) $left = !$left;
373 if ( $shove && $left ) { # Left
374 $s .= $this->getQuickbarCompensator();
376 wfProfileOut( "$fname-2" );
377 wfProfileIn( "$fname-3" );
378 $l = $wgLang->isRTL() ?
"right" : "left";
379 $s .= "<td class='bottom' align='$l' valign='top'>";
381 $s .= $this->bottomLinks();
382 $s .= "\n<br>" . $this->mainPageLink()
383 . " | " . $this->aboutLink()
384 . " | " . $this->specialLink( "recentchanges" )
385 . " | " . $this->searchForm()
386 . "<br>" . $this->pageStats();
389 if ( $shove && !$left ) { # Right
390 $s .= $this->getQuickbarCompensator();
392 $s .= "</tr></table>\n</div>\n</div>\n";
394 wfProfileOut( "$fname-3" );
395 wfProfileIn( "$fname-4" );
396 if ( 0 != $qb ) { $s .= $this->quickBar(); }
397 wfProfileOut( "$fname-4" );
398 wfProfileOut( $fname );
402 function pageTitleLinks()
404 global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval ;
406 $s = $this->printableLink();
408 if ( $wgOut->isArticle() ) {
409 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
410 $name = $wgTitle->getDBkey();
411 $link = wfEscapeHTML( wfImageUrl( $name ) );
412 $style = $this->getInternalLinkAttributes( $link, $name );
413 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
415 # This will show the "Approve" link if $wgUseApproval=true;
416 if ( isset ( $wgUseApproval ) && $wgUseApproval )
418 $t = $wgTitle->getDBkey();
419 $name = "Approve this article" ;
420 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
421 #wfEscapeHTML( wfImageUrl( $name ) );
422 $style = $this->getExternalLinkAttributes( $link, $name );
423 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
425 if ( "history" == $action ||
isset( $diff ) ||
isset( $oldid ) ) {
426 $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
427 wfMsg( "currentrev" ) );
430 if ( $wgUser->getNewtalk() ) {
431 # do not show "You have new messages" text when we are viewing our
434 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
435 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
436 $n =$wgUser->getName();
437 $tl = $this->makeKnownLink( $wgLang->getNsText(
438 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
439 wfMsg("newmessageslink") );
440 $s.=" | <strong>". str_replace( "$1", $tl, wfMsg("newmessages") ) . "</strong>";
443 if( $wgUser->isSysop() &&
444 (($wgTitle->getArticleId() == 0) ||
($action == "history")) &&
445 ($n = $wgTitle->isDeleted() ) ) {
446 $s .= " | " . wfMsg( "thisisdeleted",
447 $this->makeKnownLink(
448 $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
449 wfMsg( "restorelink", $n ) ) );
454 function printableLink()
456 global $wgOut, $wgTitle, $oldid, $action;
458 if ( "history" == $action ) { $q = "action=history&"; }
461 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
462 WfMsg( "printableversion" ), "{$q}printable=yes" );
468 global $wgOut, $wgTitle, $wgUser;
470 $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
471 if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
475 function pageSubtitle()
477 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
479 $sub = $wgOut->getSubtitle();
480 if ( "" == $sub ) { $sub = wfMsg( "fromwikipedia" ); }
481 if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
482 $ptext=$wgTitle->getPrefixedText();
483 if(preg_match("/\//",$ptext)) {
484 $sub.="</p><p class='subpages'>";
485 $links=explode("/",$ptext);
488 foreach($links as $link) {
490 if ($c<count($links)) {
492 $getlink=$this->makeLink( $growingLink, $link);
493 if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
506 $s = "<p class='subtitle'>{$sub}\n";
510 function nameAndLogin()
512 global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader;
514 $li = $wgLang->specialPage( "Userlogin" );
515 $lo = $wgLang->specialPage( "Userlogout" );
518 if ( 0 == $wgUser->getID() ) {
519 if( $wgShowIPinHeader ) {
520 $n = getenv( "REMOTE_ADDR" );
522 $tl = $this->makeKnownLink( $wgLang->getNsText(
523 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
524 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
526 $s .= $n . " (".$tl.")";
528 $s .= wfMsg("notloggedin");
531 $rt = $wgTitle->getPrefixedURL();
532 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
534 } else { $q = "returnto={$rt}"; }
536 $s .= "\n<br>" . $this->makeKnownLink( $li,
537 wfMsg( "login" ), $q );
539 $n = $wgUser->getName();
540 $rt = $wgTitle->getPrefixedURL();
541 $tl = $this->makeKnownLink( $wgLang->getNsText(
542 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
543 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
547 $s .= $this->makeKnownLink( $wgLang->getNsText(
548 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br>" .
549 $this->makeKnownLink( $lo, wfMsg( "logout" ),
550 "returnto={$rt}" ) . " | " .
551 $this->specialLink( "preferences" );
553 $s .= " | " . $this->makeKnownLink( wfMsg( "helppage" ),
559 function searchForm()
563 $s = "<form name='search' class='inline' method=get action=\""
564 . wfLocalUrl( "" ) . "\">"
565 . "<input type=text name=\"search\" size=19 value=\""
566 . htmlspecialchars(substr($search,0,256)) . "\">\n"
567 . "<input type=submit name=\"go\" value=\"" . wfMsg ("go") . "\"> "
568 . "<input type=submit value=\"" . wfMsg ("search") . "\"></form>";
578 $s = $this->mainPageLink() . $sep
579 . $this->specialLink( "recentchanges" );
581 if ( $wgOut->isArticle() ) {
582 $s .= $sep . $this->editThisPage()
583 . $sep . $this->historyLink();
585 # Many people don't like this dropdown box
586 #$s .= $sep . $this->specialPagesList();
591 function bottomLinks()
593 global $wgOut, $wgUser, $wgTitle;
597 if ( $wgOut->isArticle() ) {
598 $s .= "<strong>" . $this->editThisPage() . "</strong>";
599 if ( 0 != $wgUser->getID() ) {
600 $s .= $sep . $this->watchThisPage();
602 $s .= $sep . $this->talkLink()
603 . $sep . $this->historyLink()
604 . $sep . $this->whatLinksHere()
605 . $sep . $this->watchPageLinksLink();
607 if ( $wgTitle->getNamespace() == Namespace::getUser()
608 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
611 $id=User
::idFromName($wgTitle->getText());
612 $ip=User
::isIP($wgTitle->getText());
614 if($id ||
$ip) { # both anons and non-anons have contri list
615 $s .= $sep . $this->userContribsLink();
617 if ( 0 != $wgUser->getID() ) { # show only to signed in users
618 if($id) { # can only email non-anons
619 $s .= $sep . $this->emailUserLink();
623 if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
624 $s .= "\n<br>" . $this->deleteThisPage() .
625 $sep . $this->protectThisPage() .
626 $sep . $this->moveThisPage();
628 $s .= "<br>\n" . $this->otherLanguages();
635 global $wgOut, $wgLang, $wgArticle;
636 global $oldid, $diff, $wgDisableCounters;
638 if ( ! $wgOut->isArticle() ) { return ""; }
639 if ( isset( $oldid ) ||
isset( $diff ) ) { return ""; }
640 if ( 0 == $wgArticle->getID() ) { return ""; }
642 if ( $wgDisableCounters ) {
645 $count = $wgArticle->getCount();
646 $s = str_replace( "$1", $count, wfMsg( "viewcount" ) );
648 $s .= $this->lastModified();
649 $s .= " " . wfMsg( "gnunote" );
650 return "<span id='pagestats'>{$s}</span>";
653 function lastModified()
655 global $wgLang, $wgArticle;
657 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
658 $s = " " . str_replace( "$1", $d, wfMsg( "lastmodified" ) );
662 function logoText( $align = "" )
664 if ( "" != $align ) { $a = " align='{$align}'"; }
667 $mp = wfMsg( "mainpage" );
668 $s = "<a href=\"" . wfLocalUrlE( urlencode( $mp ) )
669 . "\"><img{$a} border=0 src=\""
670 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\"></a>";
676 global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
678 $fname = "Skin::quickBar";
679 wfProfileIn( $fname );
681 $tns=$wgTitle->getNamespace();
683 $s = "\n<div id='quickbar'>";
684 $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
687 $s .= $this->mainPageLink()
688 . $sep . $this->specialLink( "recentchanges" )
689 . $sep . $this->specialLink( "randompage" );
690 if ($wgUser->getID()) {
691 $s.= $sep . $this->specialLink( "watchlist" ) ;
692 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
693 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
696 // only show watchlist link if logged in
697 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
698 $s .= "\n<br><hr class='sep'>";
699 $articleExists = $wgTitle->getArticleId();
700 if ( $wgOut->isArticle() ||
$action =="edit" ||
$action =="history" ||
$wpPreview) {
701 if($wgOut->isArticle()) {
702 $s .= "<strong>" . $this->editThisPage() . "</strong>";
703 } else { # backlink to the article in edit or history mode
704 if($articleExists){ # no backlink if no article
707 $text = wfMsg("articlepage");
710 $text = wfMsg("viewtalkpage");
713 $text = wfMsg("userpage");
716 $text = wfMsg("viewtalkpage");
719 $text = wfMsg("wikipediapage");
722 $text = wfMsg("viewtalkpage");
725 $text = wfMsg("imagepage");
728 $text = wfMsg("viewtalkpage");
731 $text= wfMsg("articlepage");
734 $link = $wgTitle->getText();
735 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
736 $link = $nstext . ":" . $link ;
739 $s .= $this->makeLink( $link, $text );
740 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
741 # we just throw in a "New page" text to tell the user that he's in edit mode,
742 # and to avoid messing with the separator that is prepended to the next item
743 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
749 if( $tns%2
&& $action!="edit" && !$wpPreview) {
750 $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
754 watching could cause problems in edit mode:
755 if user edits article, then loads "watch this article" in background and then saves
756 article with "Watch this article" checkbox disabled, the article is transparently
757 unwatched. Therefore we do not show the "Watch this page" link in edit mode
759 if ( 0 != $wgUser->getID() && $articleExists) {
760 if($action!="edit" && $action!="history" &&
761 $action != "submit" )
762 {$s .= $sep . $this->watchThisPage(); }
763 if ( $wgTitle->userCanEdit() ) $s .= $sep . $this->moveThisPage();
765 if ( $wgUser->isSysop() and $articleExists ) {
766 $s .= $sep . $this->deleteThisPage() .
767 $sep . $this->protectThisPage();
769 $s .= $sep . $this->talkLink();
770 if ($articleExists && $action !="history") { $s .= $sep . $this->historyLink();}
771 $s.=$sep . $this->whatLinksHere();
773 if($wgOut->isArticle()) {
774 $s .= $sep . $this->watchPageLinksLink();
777 if ( Namespace::getUser() == $wgTitle->getNamespace()
778 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
781 $id=User
::idFromName($wgTitle->getText());
782 $ip=User
::isIP($wgTitle->getText());
785 $s .= $sep . $this->userContribsLink();
787 if ( 0 != $wgUser->getID() ) {
788 if($id) { # can only email real users
789 $s .= $sep . $this->emailUserLink();
793 $s .= "\n<br><hr class='sep'>";
796 if ( 0 != $wgUser->getID() ) {
797 $s .= $this->specialLink( "upload" ) . $sep;
799 $s .= $this->specialLink( "specialpages" )
800 . $sep . $this->bugReportsLink();
802 $s .= "\n<br></div>\n";
803 wfProfileOut( $fname );
807 function specialPagesList()
809 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
812 $validSP = $wgLang->getValidSpecialPages();
814 foreach ( $validSP as $name => $desc ) {
815 if ( "" == $desc ) { continue; }
818 if ( $wgUser->isSysop() )
820 $sysopSP = $wgLang->getSysopSpecialPages();
822 foreach ( $sysopSP as $name => $desc ) {
823 if ( "" == $desc ) { continue; }
827 if ( $wgUser->isDeveloper() )
829 $devSP = $wgLang->getDeveloperSpecialPages();
831 foreach ( $devSP as $name => $desc ) {
832 if ( "" == $desc ) { continue; }
837 $sp = wfMsg( "specialpages" );
838 $spp = $wgLang->specialPage( "Specialpages" );
840 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
841 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
842 $s .= "<select name=\"wpDropdown\">\n";
843 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
845 foreach ( $a as $name => $desc ) {
846 $p = $wgLang->specialPage( $name );
847 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
850 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
855 function mainPageLink()
857 $mp = wfMsg( "mainpage" );
858 $s = $this->makeKnownLink( $mp, $mp );
862 function copyrightLink()
864 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
865 wfMsg( "copyrightpagename" ) );
871 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
872 wfMsg( "aboutwikipedia" ) );
876 function editThisPage()
878 global $wgOut, $wgTitle, $oldid, $redirect, $diff;
880 if ( ! $wgOut->isArticle() ||
$diff ) {
881 $s = wfMsg( "protectedpage" );
882 } else if ( $wgTitle->userCanEdit() ) {
883 $n = $wgTitle->getPrefixedText();
884 $t = wfMsg( "editthispage" );
887 if ( $redirect ) { $red = "&redirect={$redirect}"; }
888 if ( $oldid && ! isset( $diff ) ) {
889 $oid = "&oldid={$oldid}";
891 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
893 $s = wfMsg( "protectedpage" );
898 function deleteThisPage()
900 global $wgUser, $wgOut, $wgTitle, $diff;
902 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
903 $n = $wgTitle->getPrefixedText();
904 $t = wfMsg( "deletethispage" );
906 $s = $this->makeKnownLink( $n, $t, "action=delete" );
908 $s = wfMsg( "error" );
913 function protectThisPage()
915 global $wgUser, $wgOut, $wgTitle, $diff;
917 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
918 $n = $wgTitle->getPrefixedText();
920 if ( $wgTitle->isProtected() ) {
921 $t = wfMsg( "unprotectthispage" );
922 $q = "action=unprotect";
924 $t = wfMsg( "protectthispage" );
925 $q = "action=protect";
927 $s = $this->makeKnownLink( $n, $t, $q );
929 $s = wfMsg( "error" );
934 function watchThisPage()
936 global $wgUser, $wgOut, $wgTitle, $diff;
938 if ( $wgOut->isArticle() && ( ! $diff ) ) {
939 $n = $wgTitle->getPrefixedText();
941 if ( $wgTitle->userIsWatching() ) {
942 $t = wfMsg( "unwatchthispage" );
943 $q = "action=unwatch";
945 $t = wfMsg( "watchthispage" );
948 $s = $this->makeKnownLink( $n, $t, $q );
950 $s = wfMsg( "notanarticle" );
955 function moveThisPage()
957 global $wgTitle, $wgLang;
959 if ( $wgTitle->userCanEdit() ) {
960 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
961 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
962 } // no message if page is protected - would be redundant
966 function historyLink()
970 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
971 wfMsg( "history" ), "action=history" );
975 function whatLinksHere()
977 global $wgTitle, $wgLang;
979 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
980 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
984 function userContribsLink()
986 global $wgTitle, $wgLang;
988 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
989 wfMsg( "contributions" ), "target=" . $wgTitle->getURL() );
993 function emailUserLink()
995 global $wgTitle, $wgLang;
997 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
998 wfMsg( "emailuser" ), "target=" . $wgTitle->getURL() );
1002 function watchPageLinksLink()
1004 global $wgOut, $wgTitle, $wgLang;
1006 if ( ! $wgOut->isArticle() ) {
1007 $s = "(" . wfMsg( "notanarticle" ) . ")";
1009 $s = $this->makeKnownLink( $wgLang->specialPage(
1010 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
1011 "target=" . $wgTitle->getPrefixedURL() );
1016 function otherLanguages()
1018 global $wgOut, $wgLang, $wgTitle , $wgUseNewInterlanguage ;
1020 $a = $wgOut->getLanguageLinks();
1021 if ( 0 == count( $a ) ) {
1022 if ( !$wgUseNewInterlanguage ) return "";
1023 $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
1024 if ( $ns != 0 AND $ns != 1 ) return "" ;
1026 $x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
1027 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1028 wfMsg( "intl" ) , $x );
1031 if ( !$wgUseNewInterlanguage ) {
1032 $s = wfMsg( "otherlanguages" ) . ": ";
1034 global $wgLanguageCode ;
1035 $x = "mode=zoom&xt=".$wgTitle->getDBkey() ;
1036 $x .= "&xl=".$wgLanguageCode ;
1037 $s = $this->makeKnownLink( $wgLang->specialPage( "Intl" ),
1038 wfMsg( "otherlanguages" ) , $x ) . ": " ;
1042 if($wgLang->isRTL()) $s .= "<span dir='LTR'>";
1043 foreach( $a as $l ) {
1044 if ( ! $first ) { $s .= " | "; }
1047 $nt = Title
::newFromText( $l );
1048 $url = $nt->getFullURL();
1049 $text = $wgLang->getLanguageName( $nt->getInterwiki() );
1051 if ( "" == $text ) { $text = $l; }
1052 $style = $this->getExternalLinkAttributes( $l, $text );
1053 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
1055 if($wgLang->isRTL()) $s .= "</span>";
1059 function bugReportsLink()
1061 $s = $this->makeKnownLink( wfMsg( "bugreportspage" ),
1062 wfMsg( "bugreports" ) );
1068 global $wgLinkCache;
1069 $t1 = Title
::newFromText( gmdate( "F j" ) );
1070 $t2 = Title
::newFromText( gmdate( "Y" ) );
1072 $wgLinkCache->suspend();
1073 $id = $t1->getArticleID();
1074 $wgLinkCache->resume();
1077 $s = $this->makeBrokenLink( $t1->getText() );
1079 $s = $this->makeKnownLink( $t1->getText() );
1083 $wgLinkCache->suspend();
1084 $id = $t2->getArticleID();
1085 $wgLinkCache->resume();
1088 $s .= $this->makeBrokenLink( $t2->getText() );
1090 $s .= $this->makeKnownLink( $t2->getText() );
1097 global $wgLang, $wgTitle, $wgLinkCache;
1099 $tns = $wgTitle->getNamespace();
1100 if ( -1 == $tns ) { return ""; }
1102 $pn = $wgTitle->getText();
1103 $tp = wfMsg( "talkpage" );
1104 if ( Namespace::isTalk( $tns ) ) {
1105 $lns = Namespace::getSubject( $tns );
1108 $text = wfMsg("articlepage");
1111 $text = wfMsg("userpage");
1114 $text = wfMsg("wikipediapage");
1117 $text = wfMsg("imagepage");
1120 $text= wfMsg("articlepage");
1124 $lns = Namespace::getTalk( $tns );
1127 $n = $wgLang->getNsText( $lns );
1128 if ( "" == $n ) { $link = $pn; }
1129 else { $link = "{$n}:{$pn}"; }
1131 $wgLinkCache->suspend();
1132 $s = $this->makeLink( $link, $text );
1133 $wgLinkCache->resume();
1138 # After all the page content is transformed into HTML, it makes
1139 # a final pass through here for things like table backgrounds.
1141 function transformContent( $text )
1146 # Note: This function MUST call getArticleID() on the link,
1147 # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
1149 function makeLink( $title, $text = "", $query = "", $trail = "" ) {
1150 wfProfileIn( "Skin::makeLink" );
1151 $result = $this->makeLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1152 wfProfileOut( "Skin::makeLink" );
1156 function makeKnownLink( $title, $text = "", $query = "", $trail = "" ) {
1157 return $this->makeKnownLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1160 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" ) {
1161 return $this->makeBrokenLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1164 function makeStubLink( $title, $text = "", $query = "", $trail = "" ) {
1165 return $this->makeStubLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1168 # Pass a title object, not a title string
1169 function makeLinkObj( &$nt, $text= "", $query = "", $trail = "" )
1171 global $wgOut, $wgUser;
1172 if ( $nt->isExternal() ) {
1173 $u = $nt->getFullURL();
1174 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1175 $style = $this->getExternalLinkAttributes( $link, $text );
1178 if ( "" != $trail ) {
1179 if ( preg_match( "/^([a-z]+)(.*)$$/sD", $trail, $m ) ) {
1184 $retVal = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1185 } elseif ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
1186 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1187 } elseif ( ( -1 == $nt->getNamespace() ) ||
1188 ( Namespace::getImage() == $nt->getNamespace() ) ) {
1189 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1191 $aid = $nt->getArticleID() ;
1193 $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail );
1195 $threshold = $wgUser->getOption("stubthreshold") ;
1196 if ( $threshold > 0 ) {
1197 $res = wfQuery ( "SELECT HIGH_PRIORITY length(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ
) ;
1199 if ( wfNumRows( $res ) > 0 ) {
1200 $s = wfFetchObject( $res );
1202 if ( $s->cur_is_redirect
OR $s->cur_namespace
!= 0 ) {
1203 $size = $threshold*2 ; # Really big
1205 wfFreeResult( $res );
1207 $size = $threshold*2 ; # Really big
1212 if ( $size < $threshold ) {
1213 $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail );
1215 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1222 # Pass a title object, not a title string
1223 function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1225 global $wgOut, $wgTitle;
1227 $fname = "Skin::makeKnownLinkObj";
1228 wfProfileIn( $fname );
1230 $link = $nt->getPrefixedURL();
1232 if ( "" == $link ) {
1234 if ( "" == $text ) { $text = $nt->getFragment(); }
1236 $u = wfLocalUrlE( $link, $query );
1238 if ( "" != $nt->getFragment() ) {
1239 $u .= "#" . wfEscapeHTML( $nt->getFragment() );
1241 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1242 $style = $this->getInternalLinkAttributesObj( $nt, $text );
1245 if ( "" != $trail ) {
1246 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1251 $r = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1252 wfProfileOut( $fname );
1256 # Pass a title object, not a title string
1257 function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1259 global $wgOut, $wgUser;
1261 $fname = "Skin::makeBrokenLinkObj";
1262 wfProfileIn( $fname );
1264 $link = $nt->getPrefixedURL();
1266 if ( "" == $query ) { $q = "action=edit"; }
1267 else { $q = "action=edit&{$query}"; }
1268 $u = wfLocalUrlE( $link, $q );
1270 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1271 $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
1274 if ( "" != $trail ) {
1275 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1280 if ( $wgOut->isPrintable() ||
1281 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1282 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1284 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
1287 wfProfileOut( $fname );
1291 # Pass a title object, not a title string
1292 function makeStubLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1294 global $wgOut, $wgUser;
1296 $link = $nt->getPrefixedURL();
1298 $u = wfLocalUrlE( $link, $query );
1300 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1301 $style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
1304 if ( "" != $trail ) {
1305 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1310 if ( $wgOut->isPrintable() ||
1311 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1312 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1314 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1319 function fnamePart( $url )
1321 $basename = strrchr( $url, "/" );
1322 if ( false === $basename ) { $basename = $url; }
1323 else { $basename = substr( $basename, 1 ); }
1324 return wfEscapeHTML( $basename );
1327 function makeImage( $url, $alt = "" )
1331 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1332 $s = "<img src=\"{$url}\" alt=\"{$alt}\">";
1336 function makeImageLink( $name, $url, $alt = "" )
1338 global $wgOut, $wgTitle, $wgLang;
1340 $nt = Title
::newFromText( $wgLang->getNsText(
1341 Namespace::getImage() ) . ":{$name}" );
1342 $link = $nt->getPrefixedURL();
1343 if ( "" == $alt ) { $alt = $name; }
1345 $u = wfLocalUrlE( $link );
1346 $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
1347 "<img border=0 src=\"{$url}\" alt=\"{$alt}\"></a>";
1351 function makeMediaLink( $name, $url, $alt = "" )
1353 global $wgOut, $wgTitle;
1355 if ( "" == $alt ) { $alt = $name; }
1356 $u = wfEscapeHTML( $url );
1357 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1361 function specialLink( $name, $key = "" )
1365 if ( "" == $key ) { $key = strtolower( $name ); }
1366 $pn = $wgLang->ucfirst( $name );
1367 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1371 # Called by history lists and recent changes
1374 function beginRecentChangesList()
1376 $rc_cache = array() ;
1378 $this->lastdate
= "";
1382 function beginHistoryList()
1384 $this->lastdate
= $this->lastline
= "";
1385 $s = "\n<p>" . wfMsg( "histlegend" ) . "\n<ul>";
1389 function beginImageHistoryList()
1391 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1392 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul>";
1396 function endRecentChangesList()
1398 $s = $this->recentChangesBlock() ;
1403 function endHistoryList()
1405 $last = wfMsg( "last" );
1407 $s = preg_replace( "/!OLDID![0-9]+!/", $last, $this->lastline
);
1412 function endImageHistoryList()
1418 function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor )
1422 $artname = Title
::makeName( $ns, $ttl );
1423 $last = wfMsg( "last" );
1424 $cur = wfMsg( "cur" );
1425 $cr = wfMsg( "currentrev" );
1427 if ( $oid && $this->lastline
) {
1428 $ret = preg_replace( "/!OLDID!([0-9]+)!/", $this->makeKnownLink(
1429 $artname, $last, "diff=\\1&oldid={$oid}" ), $this->lastline
);
1433 $dt = $wgLang->timeanddate( $ts, true );
1435 if ( $oid ) { $q = "oldid={$oid}"; }
1437 $link = $this->makeKnownLink( $artname, $dt, $q );
1440 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1441 $ut, "target=" . $ut );
1443 $ul = $this->makeLink( $wgLang->getNsText(
1444 Namespace::getUser() ) . ":{$ut}", $ut ); }
1448 $curlink = $this->makeKnownLink( $artname, $cur,
1449 "diff=0&oldid={$oid}" );
1453 $s .= "({$curlink}) (!OLDID!{$oid}!) . .";
1455 $M = wfMsg( "minoreditletter" );
1456 if ( $isminor ) { $s .= " <strong>{$M}</strong>"; }
1457 $s .= " {$link} . . {$ul}";
1459 if ( "" != $c && "*" != $c ) { $s .= " <em>(" . wfEscapeHTML($c) . ")</em>"; }
1462 $this->lastline
= $s;
1466 function recentChangesBlockLine ( $y ) {
1467 global $wgUploadPath ;
1469 $M = wfMsg( "minoreditletter" );
1470 $N = wfMsg( "newpageletter" );
1472 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>" ;
1474 if ( $y->isnew
) $r .= $N ;
1475 else $r .= " " ;
1476 if ( $y->isminor
) $r .= $M ;
1477 else $r .= " " ;
1478 $r .= " ".$y->timestamp
." " ;
1481 if ( $y->watched
) $link = "<strong>{$link}</strong>" ;
1487 $r .= $this->makeKnownLink( $y->secureName
, wfMsg( "hist" ), "action=history" );
1489 $r .= ") . . ".$y->userlink
;
1490 $r .= $y->usertalklink
;
1491 if ( $y->usercomment
!= "" )
1492 $r .= " <em>(".wfEscapeHTML($y->usercomment
).")</em>" ;
1497 function recentChangesBlockGroup ( $y ) {
1498 global $wgUploadPath ;
1501 $M = wfMsg( "minoreditletter" );
1502 $N = wfMsg( "newpageletter" );
1504 $userlinks = array () ;
1505 foreach ( $y AS $x ) {
1506 $oldid = $x->diffid
;
1507 if ( $x->isnew
) $isnew = true ;
1509 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1513 krsort ( $userlinks ) ;
1514 asort ( $userlinks ) ;
1516 $u = array_keys ( $userlinks ) ;
1517 foreach ( $u as $x ) {
1519 if ( $userlinks[$x] > 1 ) $z .= " ({$userlinks[$x]}×)" ;
1520 array_push ( $users , $z ) ;
1522 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1525 $e = array_shift ( $e ) ;
1528 $rci = "RCI{$this->rccc}" ;
1529 $rcl = "RCL{$this->rccc}" ;
1530 $rcm = "RCM{$this->rccc}" ;
1531 $tl = "<a href='javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")'>" ;
1532 $tl .= "<span id='{$rcm}'><img src='{$wgUploadPath}/Arr_r.png' width=12 height=12 border=0></span>" ;
1533 $tl .= "<span id='{$rcl}' style='display:none'><img src='{$wgUploadPath}/Arr_d.png' width=12 height=12 border=0></span>" ;
1539 if ( $isnew ) $r .= $N ;
1540 else $r .= " " ;
1541 $r .= " " ; # Minor
1542 $r .= " ".$e->timestamp
." " ;
1546 if ( $e->watched
) $link = "<strong>{$link}</strong>" ;
1550 $r .= " (".count($y)." " ;
1551 if ( $isnew ) $r .= wfMsg("changes");
1552 else $r .= $this->makeKnownLink( $e->secureName
, wfMsg("changes") , "diff=0&oldid=".$oldid ) ;
1554 $r .= $this->makeKnownLink( $e->secureName
, wfMsg( "history" ), "action=history" );
1562 $r .= "<div id='{$rci}' style='display:none'>" ;
1563 foreach ( $y AS $x )
1565 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>";
1566 $r .= "<tt> " ;
1567 if ( $x->isnew
) $r .= $N ;
1568 else $r .= " " ;
1569 if ( $x->isminor
) $r .= $M ;
1570 else $r .= " " ;
1574 if ( $x->oldid
!= 0 ) $o = "oldid=".$x->oldid
;
1575 if ( $x->islog
) $link = $x->timestamp
;
1576 else $link = $this->makeKnownLink( $x->secureName
, $x->timestamp
, $o ) ;
1577 $link = "<tt>{$link}</tt>" ;
1584 $r .= $x->lastlink
;
1585 $r .= ") . . ".$x->userlink
;
1586 $r .= $x->usertalklink
;
1587 if ( $x->usercomment
!= "" )
1588 $r .= " <em>(".wfEscapeHTML($x->usercomment
).")</em>" ;
1597 function recentChangesBlock ()
1599 global $wgUploadPath ;
1600 if ( count ( $this->rc_cache
) == 0 ) return "" ;
1601 $k = array_keys ( $this->rc_cache
) ;
1602 foreach ( $k AS $x )
1604 $y = $this->rc_cache
[$x] ;
1605 if ( count ( $y ) < 2 ) {
1606 $r .= $this->recentChangesBlockLine ( array_shift ( $y ) ) ;
1608 $r .= $this->recentChangesBlockGroup ( $y ) ;
1612 return "<div align=left>{$r}</div>" ;
1615 function recentChangesLine( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1618 $usenew = $wgUser->getOption( "usenewrc" );
1620 $r = $this->recentChangesLineNew ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1622 $r = $this->recentChangesLineOld ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1626 function recentChangesLineOld( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0, $diffid = 0 )
1628 global $wgTitle, $wgLang, $wgUser;
1630 $d = $wgLang->date( $ts, true);
1632 if ( $d != $this->lastdate
) {
1633 if ( "" != $this->lastdate
) { $s .= "</ul>\n"; }
1634 $s .= "<h4>{$d}</h4>\n<ul>";
1635 $this->lastdate
= $d;
1637 $h = $wgLang->time( $ts, true );
1638 $t = Title
::makeName( $ns, $ttl );
1639 $clink = $this->makeKnownLink( $t , "" );
1640 $nt = Title
::newFromText( $t );
1643 $clink = "<strong>{$clink}</strong>";
1645 $hlink = $this->makeKnownLink( $t, wfMsg( "hist" ), "action=history" );
1646 if ( $isnew ||
$nt->isLog() ) {
1647 $dlink = wfMsg( "diff" );
1649 $dlink = $this->makeKnownLink( $t, wfMsg( "diff" ),
1650 "diff={$oldid}&oldid={$diffid}" ); # Finagle's law
1653 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1654 $ut, "target=" . $ut );
1656 $ul = $this->makeLink( $wgLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut );
1659 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1660 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1661 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1662 $cr = wfMsg( "currentrev" );
1664 $s .= "<li> ({$dlink}) ({$hlink}) . .";
1665 $M = wfMsg( "minoreditletter" );
1666 $N = wfMsg( "newpageletter" );
1667 if ( $isminor ) { $s .= " <strong>{$M}</strong>"; }
1668 if ( $isnew ) { $s .= "<strong>{$N}</strong>"; }
1669 $s .= " {$clink}; {$h} . . {$ul}";
1672 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1673 $blink = $this->makeKnownLink( $wgLang->specialPage(
1674 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1680 $utl = "({$utl} | {$blink})";
1684 if ( "" != $c && "*" != $c ) {
1685 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1692 function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1694 global $wgTitle, $wgLang, $wgUser;
1696 $rc = new RecentChangesClass
;
1698 $d = $wgLang->date( $ts, true);
1701 if ( $d != $this->lastdate
) {
1702 $ret = $this->recentChangesBlock () ;
1703 $this->rc_cache
= array() ;
1704 $ret .= "<h4>{$d}</h4>\n";
1705 $this->lastdate
= $d;
1707 $h = $wgLang->time( $ts, true );
1708 $t = Title
::makeName( $ns, $ttl );
1709 $clink = $this->makeKnownLink( $t, "" ) ;
1710 if ( $oldid == 0 ) $c2link = $clink ;
1711 else $c2link = $this->makeKnownLink( $t, "" , "oldid={$oldid}" );
1712 $nt = Title
::newFromText( $t );
1714 $rc->timestamp
= $h ;
1715 $rc->oldid
= $oldid ;
1716 $rc->diffid
= $diffid ;
1717 $rc->watched
= $watched ;
1718 $rc->isnew
= $isnew ;
1719 $rc->isminor
= $isminor ;
1720 $rc->secureName
= $t ;
1721 $rc->displayName
= $nt ;
1722 $rc->link
= $clink ;
1723 $rc->usercomment
= $c ;
1724 $rc->islog
= $nt->isLog() ;
1726 if ( ( $isnew && $oldid == 0 ) ||
$nt->isLog() ) {
1727 $dlink = wfMsg( "cur" );
1729 $dlink = $this->makeKnownLink( $t, wfMsg( "cur" ),
1730 "diff=0&oldid={$oldid}" );
1733 if ( $diffid == 0 ||
$nt->isLog() ) {
1734 $plink = wfMsg( "last" );
1736 $plink = $this->makeKnownLink( $t, wfMsg( "last" ),
1737 "diff={$oldid}&oldid={$diffid}" );
1741 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1742 $ut, "target=" . $ut );
1743 } else { $ul = $this->makeLink( $wgLang->getNsText(
1744 Namespace::getUser() ) . ":{$ut}", $ut ); }
1746 $rc->userlink
= $ul ;
1747 $rc->lastlink
= $plink ;
1748 $rc->curlink
= $dlink ;
1750 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1751 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1752 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1754 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1755 $blink = $this->makeKnownLink( $wgLang->specialPage(
1756 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1757 $rc->usertalklink
= " ({$utl} | {$blink})";
1759 $rc->usertalklink
=" ({$utl})";
1762 if ( !isset ( $this->rc_cache
[$t] ) ) $this->rc_cache
[$t] = array() ;
1763 array_push ( $this->rc_cache
[$t] , $rc ) ;
1768 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
1770 global $wgUser, $wgLang, $wgTitle;
1772 $dt = $wgLang->timeanddate( $ts, true );
1773 $del = wfMsg( "deleteimg" );
1774 $cur = wfMsg( "cur" );
1777 $url = wfImageUrl( $img );
1779 if ( $wgUser->isSysop() ) {
1780 $link = wfLocalUrlE( $wgTitle->getPrefixedText(), "image=" . $wgTitle->getURL() .
1782 $style = $this->getInternalLinkAttributes( $link, $del );
1784 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
1789 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
1790 if( $wgUser->getID() != 0 ) {
1791 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1792 wfMsg( "revertimg" ), "action=revert&oldimage=" .
1793 urlencode( $img ) );
1794 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1795 $del, "action=delete&oldimage=" . urlencode( $img ) );
1797 # Having live active links for non-logged in users
1798 # means that bots and spiders crawling our site can
1799 # inadvertently change content. Baaaad idea.
1800 $rlink = wfMsg( "revertimg" );
1804 if ( 0 == $u ) { $ul = $ut; }
1805 else { $ul = $this->makeLink( $wgLang->getNsText(
1806 Namespace::getUser() ) . ":{$ut}", $ut ); }
1808 $nb = str_replace( "$1", $size, wfMsg( "nbytes" ) );
1809 $style = $this->getInternalLinkAttributes( $url, $dt );
1811 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
1812 . " . . {$ul} ({$nb})";
1814 if ( "" != $c && "*" != $c ) {
1815 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1821 function tocIndent($level) {
1823 while($level-->0) $rv.="<div style=\"margin-left:2em;\">\n";
1828 function tocUnindent($level) {
1829 while($level-->0) $rv.="</div>\n";
1833 // parameter level defines if we are on an indentation level
1834 function tocLine($anchor,$tocline,$level) {
1838 return "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n";
1841 return "<div style=\"margin-bottom:0px;\">\n".
1842 "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n".
1848 function tocTable($toc) {
1849 // note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
1853 $hideline = " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>";
1856 "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
1857 "<b>".wfMsg("toc")."</b>" .
1859 "</td></tr><tr id='tocinside'><td align=\"left\">\n".
1860 $toc."</td></tr></table><P>\n";
1863 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
1864 function editSectionScript($section,$head) {
1866 global $wgTitle,$wgUser,$oldid;
1867 if($oldid) return $head;
1868 $url = wfLocalUrlE(urlencode($wgTitle->getPrefixedText()),"action=edit§ion=$section");
1869 return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
1872 function editSectionLink($section) {
1875 global $wgTitle,$wgUser,$oldid;
1876 if($oldid) return "";
1877 if ($printable) return "";
1878 $editurl="§ion={$section}";
1879 $url=$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
1880 return "<div style=\"float:right;margin-left:5px;\"><small>[".$url."]</small></div>";
1885 include_once( "SkinStandard.php" );
1886 include_once( "SkinNostalgia.php" );
1887 include_once( "SkinCologneBlue.php" );
1889 #include_once( "SkinSmarty.php" );