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, $wgSiteNotice;
250 if ( $wgOut->isPrintable() ) {
251 $s = $this->pageTitle() . $this->pageSubtitle() . "\n";
252 $s .= "\n<div class='bodytext'>";
255 if( $wgSiteNotice ) {
256 $note = "\n<div id='notice' style='font-weight: bold; color: red; text-align: center'>$wgSiteNotice</div>\n";
260 return $this->doBeforeContent() . $note;
263 function doBeforeContent()
265 global $wgUser, $wgOut, $wgTitle, $wgLang;
266 $fname = "Skin::doBeforeContent";
267 wfProfileIn( $fname );
270 $qb = $this->qbSetting();
272 if( $langlinks = $this->otherLanguages() ) {
278 $borderhack = "class='top'";
281 $s .= "\n<div id='content'>\n<div id='topbar'>" .
282 "<table width='98%' border=0 cellspacing=0><tr>";
285 $left = ($qb == 1 ||
$qb == 3);
286 if($wgLang->isRTL()) $left = !$left;
289 $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>" .
290 $this->logoText() . "</td>";
292 $s .= $this->getQuickbarCompensator( $rows );
294 $l = $wgLang->isRTL() ?
"right" : "left";
295 $s .= "<td {$borderhack} align='$l' valign='top'>";
297 $s .= $this->topLinks() ;
298 $s .= "<p class='subtitle'>" . $this->pageTitleLinks();
300 $r = $wgLang->isRTL() ?
"left" : "right";
301 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap>";
302 $s .= $this->nameAndLogin();
303 $s .= "\n<br>" . $this->searchForm() . "</td>";
306 $s .= "</tr>\n<tr><td class='top' colspan=\"2\">$langlinks</td>";
309 if ( $shove && !$left ) { # Right
310 $s .= $this->getQuickbarCompensator( $rows );
312 $s .= "</tr></table>\n</div>\n";
313 $s .= "\n<div id='article'>";
315 $s .= $this->pageTitle();
316 $s .= $this->pageSubtitle() ;
317 $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
319 wfProfileOut( $fname );
323 function getQuickbarCompensator( $rows = 1 )
325 return "<td width='152' rowspan='{$rows}'> </td>";
328 # This gets called immediately before the </body> tag.
330 function afterContent()
332 global $wgUser, $wgOut, $wgServer;
335 if ( $wgOut->isPrintable() ) {
338 $u = htmlspecialchars( $wgServer . $wgTitle->getFullURL() );
339 $u = "<a href=\"$u\">$u</a>";
340 $rf = wfMsg( "retrievedfrom", $u );
342 if ( $wgOut->isArticle() ) {
343 $lm = "<br>" . $this->lastModified();
346 $cr = wfMsg( "gnunote" );
347 $s .= "<p><em>{$rf}{$lm} {$cr}</em>\n";
350 return $this->doAfterContent();
353 function doAfterContent()
355 global $wgUser, $wgOut, $wgLang;
356 $fname = "Skin::doAfterContent";
357 wfProfileIn( $fname );
358 wfProfileIn( "$fname-1" );
360 $s = "\n</div><br clear=all>\n";
361 $s .= "\n<div id='footer'>";
362 $s .= "<table width='98%' border=0 cellspacing=0><tr>";
364 wfProfileOut( "$fname-1" );
365 wfProfileIn( "$fname-2" );
367 $qb = $this->qbSetting();
369 $left = ($qb == 1 ||
$qb == 3);
370 if($wgLang->isRTL()) $left = !$left;
372 if ( $shove && $left ) { # Left
373 $s .= $this->getQuickbarCompensator();
375 wfProfileOut( "$fname-2" );
376 wfProfileIn( "$fname-3" );
377 $l = $wgLang->isRTL() ?
"right" : "left";
378 $s .= "<td class='bottom' align='$l' valign='top'>";
380 $s .= $this->bottomLinks();
381 $s .= "\n<br>" . $this->mainPageLink()
382 . " | " . $this->aboutLink()
383 . " | " . $this->specialLink( "recentchanges" )
384 . " | " . $this->searchForm()
385 . "<br>" . $this->pageStats();
388 if ( $shove && !$left ) { # Right
389 $s .= $this->getQuickbarCompensator();
391 $s .= "</tr></table>\n</div>\n</div>\n";
393 wfProfileOut( "$fname-3" );
394 wfProfileIn( "$fname-4" );
395 if ( 0 != $qb ) { $s .= $this->quickBar(); }
396 wfProfileOut( "$fname-4" );
397 wfProfileOut( $fname );
401 function pageTitleLinks()
403 global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval ;
405 $s = $this->printableLink();
407 if ( $wgOut->isArticle() ) {
408 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
409 $name = $wgTitle->getDBkey();
410 $link = wfEscapeHTML( wfImageUrl( $name ) );
411 $style = $this->getInternalLinkAttributes( $link, $name );
412 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
414 # This will show the "Approve" link if $wgUseApproval=true;
415 if ( isset ( $wgUseApproval ) && $wgUseApproval )
417 $t = $wgTitle->getDBkey();
418 $name = "Approve this article" ;
419 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
420 #wfEscapeHTML( wfImageUrl( $name ) );
421 $style = $this->getExternalLinkAttributes( $link, $name );
422 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
424 if ( "history" == $action ||
isset( $diff ) ||
isset( $oldid ) ) {
425 $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
426 wfMsg( "currentrev" ) );
429 if ( $wgUser->getNewtalk() ) {
430 # do not show "You have new messages" text when we are viewing our
433 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
434 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
435 $n =$wgUser->getName();
436 $tl = $this->makeKnownLink( $wgLang->getNsText(
437 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
438 wfMsg("newmessageslink") );
439 $s.=" | <strong>". wfMsg( "newmessages", $tl ) . "</strong>";
442 if( $wgUser->isSysop() &&
443 (($wgTitle->getArticleId() == 0) ||
($action == "history")) &&
444 ($n = $wgTitle->isDeleted() ) ) {
445 $s .= " | " . wfMsg( "thisisdeleted",
446 $this->makeKnownLink(
447 $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
448 wfMsg( "restorelink", $n ) ) );
453 function printableLink()
455 global $wgOut, $wgTitle, $oldid, $action;
458 foreach( $_GET as $var => $val ) {
459 if( $var != "title" && $var != "printable" )
460 $q .= urlencode( $var ) . "=" . urlencode( $val );
462 if( !empty( $q ) ) $q .= "&";
464 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
465 WfMsg( "printableversion" ), "{$q}printable=yes" );
471 global $wgOut, $wgTitle, $wgUser;
473 $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
474 if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
478 function pageSubtitle()
480 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
482 $sub = $wgOut->getSubtitle();
484 global $wgExtraSubtitle;
485 $sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
487 if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
488 $ptext=$wgTitle->getPrefixedText();
489 if(preg_match("/\//",$ptext)) {
490 $sub.="</p><p class='subpages'>";
491 $links=explode("/",$ptext);
494 foreach($links as $link) {
496 if ($c<count($links)) {
497 $growinglink .= $link;
498 $getlink = $this->makeLink( $growinglink, $link );
499 if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
512 $s = "<p class='subtitle'>{$sub}\n";
516 function nameAndLogin()
518 global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader;
520 $li = $wgLang->specialPage( "Userlogin" );
521 $lo = $wgLang->specialPage( "Userlogout" );
524 if ( 0 == $wgUser->getID() ) {
525 if( $wgShowIPinHeader ) {
526 $n = getenv( "REMOTE_ADDR" );
528 $tl = $this->makeKnownLink( $wgLang->getNsText(
529 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
530 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
532 $s .= $n . " (".$tl.")";
534 $s .= wfMsg("notloggedin");
537 $rt = $wgTitle->getPrefixedURL();
538 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
540 } else { $q = "returnto={$rt}"; }
542 $s .= "\n<br>" . $this->makeKnownLink( $li,
543 wfMsg( "login" ), $q );
545 $n = $wgUser->getName();
546 $rt = $wgTitle->getPrefixedURL();
547 $tl = $this->makeKnownLink( $wgLang->getNsText(
548 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
549 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
553 $s .= $this->makeKnownLink( $wgLang->getNsText(
554 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br>" .
555 $this->makeKnownLink( $lo, wfMsg( "logout" ),
556 "returnto={$rt}" ) . " | " .
557 $this->specialLink( "preferences" );
559 $s .= " | " . $this->makeKnownLink( wfMsg( "helppage" ),
565 function searchForm()
569 $s = "<form name='search' class='inline' method=get action=\""
570 . wfLocalUrl( "" ) . "\">"
571 . "<input type=text name=\"search\" size=19 value=\""
572 . htmlspecialchars(substr($search,0,256)) . "\">\n"
573 . "<input type=submit name=\"go\" value=\"" . wfMsg ("go") . "\"> "
574 . "<input type=submit value=\"" . wfMsg ("search") . "\"></form>";
584 $s = $this->mainPageLink() . $sep
585 . $this->specialLink( "recentchanges" );
587 if ( $wgOut->isArticle() ) {
588 $s .= $sep . $this->editThisPage()
589 . $sep . $this->historyLink();
591 # Many people don't like this dropdown box
592 #$s .= $sep . $this->specialPagesList();
597 function bottomLinks()
599 global $wgOut, $wgUser, $wgTitle;
603 if ( $wgOut->isArticle() ) {
604 $s .= "<strong>" . $this->editThisPage() . "</strong>";
605 if ( 0 != $wgUser->getID() ) {
606 $s .= $sep . $this->watchThisPage();
608 $s .= $sep . $this->talkLink()
609 . $sep . $this->historyLink()
610 . $sep . $this->whatLinksHere()
611 . $sep . $this->watchPageLinksLink();
613 if ( $wgTitle->getNamespace() == Namespace::getUser()
614 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
617 $id=User
::idFromName($wgTitle->getText());
618 $ip=User
::isIP($wgTitle->getText());
620 if($id ||
$ip) { # both anons and non-anons have contri list
621 $s .= $sep . $this->userContribsLink();
623 if ( 0 != $wgUser->getID() ) { # show only to signed in users
624 if($id) { # can only email non-anons
625 $s .= $sep . $this->emailUserLink();
629 if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
630 $s .= "\n<br>" . $this->deleteThisPage() .
631 $sep . $this->protectThisPage() .
632 $sep . $this->moveThisPage();
634 $s .= "<br>\n" . $this->otherLanguages();
641 global $wgOut, $wgLang, $wgArticle;
642 global $oldid, $diff, $wgDisableCounters;
644 if ( ! $wgOut->isArticle() ) { return ""; }
645 if ( isset( $oldid ) ||
isset( $diff ) ) { return ""; }
646 if ( 0 == $wgArticle->getID() ) { return ""; }
648 if ( $wgDisableCounters ) {
651 $count = $wgArticle->getCount();
652 $s = wfMsg( "viewcount", $count );
654 $s .= $this->lastModified();
655 $s .= " " . wfMsg( "gnunote" );
656 return "<span id='pagestats'>{$s}</span>";
659 function lastModified()
661 global $wgLang, $wgArticle;
663 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
664 $s = " " . wfMsg( "lastmodified", $d );
668 function logoText( $align = "" )
670 if ( "" != $align ) { $a = " align='{$align}'"; }
673 $mp = wfMsg( "mainpage" );
674 $s = "<a href=\"" . wfLocalUrlE( urlencode( $mp ) )
675 . "\"><img{$a} border=0 src=\""
676 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\"></a>";
682 global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
683 global $wpPreview, $wgDisableUploads;
685 $fname = "Skin::quickBar";
686 wfProfileIn( $fname );
688 $tns=$wgTitle->getNamespace();
690 $s = "\n<div id='quickbar'>";
691 $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
694 $s .= $this->mainPageLink()
695 . $sep . $this->specialLink( "recentchanges" )
696 . $sep . $this->specialLink( "randompage" );
697 if ($wgUser->getID()) {
698 $s.= $sep . $this->specialLink( "watchlist" ) ;
699 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
700 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
703 // only show watchlist link if logged in
704 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
705 $s .= "\n<br><hr class='sep'>";
706 $articleExists = $wgTitle->getArticleId();
707 if ( $wgOut->isArticle() ||
$action =="edit" ||
$action =="history" ||
$wpPreview) {
708 if($wgOut->isArticle()) {
709 $s .= "<strong>" . $this->editThisPage() . "</strong>";
710 } else { # backlink to the article in edit or history mode
711 if($articleExists){ # no backlink if no article
714 $text = wfMsg("articlepage");
717 $text = wfMsg("viewtalkpage");
720 $text = wfMsg("userpage");
723 $text = wfMsg("viewtalkpage");
726 $text = wfMsg("wikipediapage");
729 $text = wfMsg("viewtalkpage");
732 $text = wfMsg("imagepage");
735 $text = wfMsg("viewtalkpage");
738 $text= wfMsg("articlepage");
741 $link = $wgTitle->getText();
742 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
743 $link = $nstext . ":" . $link ;
746 $s .= $this->makeLink( $link, $text );
747 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
748 # we just throw in a "New page" text to tell the user that he's in edit mode,
749 # and to avoid messing with the separator that is prepended to the next item
750 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
756 if( $tns%2
&& $action!="edit" && !$wpPreview) {
757 $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
761 watching could cause problems in edit mode:
762 if user edits article, then loads "watch this article" in background and then saves
763 article with "Watch this article" checkbox disabled, the article is transparently
764 unwatched. Therefore we do not show the "Watch this page" link in edit mode
766 if ( 0 != $wgUser->getID() && $articleExists) {
767 if($action!="edit" && $action!="history" &&
768 $action != "submit" )
770 $s .= $sep . $this->watchThisPage();
772 if ( $wgTitle->userCanEdit() )
773 $s .= $sep . $this->moveThisPage();
775 if ( $wgUser->isSysop() and $articleExists ) {
776 $s .= $sep . $this->deleteThisPage() .
777 $sep . $this->protectThisPage();
779 $s .= $sep . $this->talkLink();
780 if ($articleExists && $action !="history") {
781 $s .= $sep . $this->historyLink();
783 $s.=$sep . $this->whatLinksHere();
785 if($wgOut->isArticle()) {
786 $s .= $sep . $this->watchPageLinksLink();
789 if ( Namespace::getUser() == $wgTitle->getNamespace()
790 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
793 $id=User
::idFromName($wgTitle->getText());
794 $ip=User
::isIP($wgTitle->getText());
797 $s .= $sep . $this->userContribsLink();
799 if ( 0 != $wgUser->getID() ) {
800 if($id) { # can only email real users
801 $s .= $sep . $this->emailUserLink();
805 $s .= "\n<br><hr class='sep'>";
808 if ( 0 != $wgUser->getID() && !$wgDisableUploads ) {
809 $s .= $this->specialLink( "upload" ) . $sep;
811 $s .= $this->specialLink( "specialpages" )
812 . $sep . $this->bugReportsLink();
814 global $wgSiteSupportPage;
815 if( $wgSiteSupportPage ) {
816 $s .= "\n<br><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
817 "\" class=\"internal\">" . wfMsg( "sitesupport" ) . "</a>";
820 $s .= "\n<br></div>\n";
821 wfProfileOut( $fname );
825 function specialPagesList()
827 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
830 $validSP = $wgLang->getValidSpecialPages();
832 foreach ( $validSP as $name => $desc ) {
833 if ( "" == $desc ) { continue; }
836 if ( $wgUser->isSysop() )
838 $sysopSP = $wgLang->getSysopSpecialPages();
840 foreach ( $sysopSP as $name => $desc ) {
841 if ( "" == $desc ) { continue; }
845 if ( $wgUser->isDeveloper() )
847 $devSP = $wgLang->getDeveloperSpecialPages();
849 foreach ( $devSP as $name => $desc ) {
850 if ( "" == $desc ) { continue; }
855 $sp = wfMsg( "specialpages" );
856 $spp = $wgLang->specialPage( "Specialpages" );
858 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
859 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
860 $s .= "<select name=\"wpDropdown\">\n";
861 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
863 foreach ( $a as $name => $desc ) {
864 $p = $wgLang->specialPage( $name );
865 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
868 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
873 function mainPageLink()
875 $mp = wfMsg( "mainpage" );
876 $s = $this->makeKnownLink( $mp, $mp );
880 function copyrightLink()
882 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
883 wfMsg( "copyrightpagename" ) );
889 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
890 wfMsg( "aboutwikipedia" ) );
894 function editThisPage()
896 global $wgOut, $wgTitle, $oldid, $redirect, $diff;
898 if ( ! $wgOut->isArticle() ||
$diff ) {
899 $s = wfMsg( "protectedpage" );
901 $n = $wgTitle->getPrefixedText();
902 if ( $wgTitle->userCanEdit() ) {
903 $t = wfMsg( "editthispage" );
905 #$t = wfMsg( "protectedpage" );
906 $t = wfMsg( "viewsource" );
910 if ( $redirect ) { $red = "&redirect={$redirect}"; }
911 if ( $oldid && ! isset( $diff ) ) {
912 $oid = "&oldid={$oldid}";
914 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
919 function deleteThisPage()
921 global $wgUser, $wgOut, $wgTitle, $diff;
923 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
924 $n = $wgTitle->getPrefixedText();
925 $t = wfMsg( "deletethispage" );
927 $s = $this->makeKnownLink( $n, $t, "action=delete" );
934 function protectThisPage()
936 global $wgUser, $wgOut, $wgTitle, $diff;
938 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
939 $n = $wgTitle->getPrefixedText();
941 if ( $wgTitle->isProtected() ) {
942 $t = wfMsg( "unprotectthispage" );
943 $q = "action=unprotect";
945 $t = wfMsg( "protectthispage" );
946 $q = "action=protect";
948 $s = $this->makeKnownLink( $n, $t, $q );
955 function watchThisPage()
957 global $wgUser, $wgOut, $wgTitle, $diff;
959 if ( $wgOut->isArticle() && ( ! $diff ) ) {
960 $n = $wgTitle->getPrefixedText();
962 if ( $wgTitle->userIsWatching() ) {
963 $t = wfMsg( "unwatchthispage" );
964 $q = "action=unwatch";
966 $t = wfMsg( "watchthispage" );
969 $s = $this->makeKnownLink( $n, $t, $q );
971 $s = wfMsg( "notanarticle" );
976 function moveThisPage()
978 global $wgTitle, $wgLang;
980 if ( $wgTitle->userCanEdit() ) {
981 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
982 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
983 } // no message if page is protected - would be redundant
987 function historyLink()
991 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
992 wfMsg( "history" ), "action=history" );
996 function whatLinksHere()
998 global $wgTitle, $wgLang;
1000 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
1001 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
1005 function userContribsLink()
1007 global $wgTitle, $wgLang;
1009 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1010 wfMsg( "contributions" ), "target=" . $wgTitle->getURL() );
1014 function emailUserLink()
1016 global $wgTitle, $wgLang;
1018 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
1019 wfMsg( "emailuser" ), "target=" . $wgTitle->getURL() );
1023 function watchPageLinksLink()
1025 global $wgOut, $wgTitle, $wgLang;
1027 if ( ! $wgOut->isArticle() ) {
1028 $s = "(" . wfMsg( "notanarticle" ) . ")";
1030 $s = $this->makeKnownLink( $wgLang->specialPage(
1031 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
1032 "target=" . $wgTitle->getPrefixedURL() );
1037 function otherLanguages()
1039 global $wgOut, $wgLang, $wgTitle;
1041 $a = $wgOut->getLanguageLinks();
1043 if ( 0 == count( $a ) ) {
1044 if ( !$wgUseNewInterlanguage ) return "";
1045 $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
1046 if ( $ns != 0 AND $ns != 1 ) return "" ;
1048 $x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
1049 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1050 wfMsg( "intl" ) , $x );
1053 if ( !$wgUseNewInterlanguage ) {
1054 $s = wfMsg( "otherlanguages" ) . ": ";
1056 global $wgLanguageCode ;
1057 $x = "mode=zoom&xt=".$wgTitle->getDBkey() ;
1058 $x .= "&xl=".$wgLanguageCode ;
1059 $s = $this->makeKnownLink( $wgLang->specialPage( "Intl" ),
1060 wfMsg( "otherlanguages" ) , $x ) . ": " ;
1063 $s = wfMsg( "otherlanguages" ) . ": ";
1065 if($wgLang->isRTL()) $s .= "<span dir='LTR'>";
1066 foreach( $a as $l ) {
1067 if ( ! $first ) { $s .= " | "; }
1070 $nt = Title
::newFromText( $l );
1071 $url = $nt->getFullURL();
1072 $text = $wgLang->getLanguageName( $nt->getInterwiki() );
1074 if ( "" == $text ) { $text = $l; }
1075 $style = $this->getExternalLinkAttributes( $l, $text );
1076 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
1078 if($wgLang->isRTL()) $s .= "</span>";
1082 function bugReportsLink()
1084 $s = $this->makeKnownLink( wfMsg( "bugreportspage" ),
1085 wfMsg( "bugreports" ) );
1091 global $wgLinkCache;
1092 $t1 = Title
::newFromText( gmdate( "F j" ) );
1093 $t2 = Title
::newFromText( gmdate( "Y" ) );
1095 $wgLinkCache->suspend();
1096 $id = $t1->getArticleID();
1097 $wgLinkCache->resume();
1100 $s = $this->makeBrokenLink( $t1->getText() );
1102 $s = $this->makeKnownLink( $t1->getText() );
1106 $wgLinkCache->suspend();
1107 $id = $t2->getArticleID();
1108 $wgLinkCache->resume();
1111 $s .= $this->makeBrokenLink( $t2->getText() );
1113 $s .= $this->makeKnownLink( $t2->getText() );
1120 global $wgLang, $wgTitle, $wgLinkCache;
1122 $tns = $wgTitle->getNamespace();
1123 if ( -1 == $tns ) { return ""; }
1125 $pn = $wgTitle->getText();
1126 $tp = wfMsg( "talkpage" );
1127 if ( Namespace::isTalk( $tns ) ) {
1128 $lns = Namespace::getSubject( $tns );
1131 $text = wfMsg("articlepage");
1134 $text = wfMsg("userpage");
1137 $text = wfMsg("wikipediapage");
1140 $text = wfMsg("imagepage");
1143 $text= wfMsg("articlepage");
1147 $lns = Namespace::getTalk( $tns );
1150 $n = $wgLang->getNsText( $lns );
1151 if ( "" == $n ) { $link = $pn; }
1152 else { $link = "{$n}:{$pn}"; }
1154 $wgLinkCache->suspend();
1155 $s = $this->makeLink( $link, $text );
1156 $wgLinkCache->resume();
1161 function commentLink()
1163 global $wgLang, $wgTitle, $wgLinkCache;
1165 $tns = $wgTitle->getNamespace();
1166 if ( -1 == $tns ) { return ""; }
1168 $lns = ( Namespace::isTalk( $tns ) ) ?
$tns : Namespace::getTalk( $tns );
1170 # assert Namespace::isTalk( $lns )
1172 $n = $wgLang->getNsText( $lns );
1173 $pn = $wgTitle->getText();
1175 $link = "{$n}:{$pn}";
1177 $wgLinkCache->suspend();
1178 $s = $this->makeKnownLink($link, wfMsg("postcomment"), "action=edit§ion=new");
1179 $wgLinkCache->resume();
1184 # After all the page content is transformed into HTML, it makes
1185 # a final pass through here for things like table backgrounds.
1187 function transformContent( $text )
1192 # Note: This function MUST call getArticleID() on the link,
1193 # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
1195 function makeLink( $title, $text = "", $query = "", $trail = "" ) {
1196 wfProfileIn( "Skin::makeLink" );
1197 $nt = Title
::newFromText( $title );
1199 $result = $this->makeLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1201 wfDebug( "Invalid title passed to Skin::makeLink(): \"$title\"\n" );
1202 $result = $text == "" ?
$title : $text;
1205 wfProfileOut( "Skin::makeLink" );
1209 function makeKnownLink( $title, $text = "", $query = "", $trail = "" ) {
1210 $nt = Title
::newFromText( $title );
1212 return $this->makeKnownLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1214 wfDebug( "Invalid title passed to Skin::makeKnownLink(): \"$title\"\n" );
1215 return $text == "" ?
$title : $text;
1219 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" ) {
1220 $nt = Title
::newFromText( $title );
1222 return $this->makeBrokenLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1224 wfDebug( "Invalid title passed to Skin::makeBrokenLink(): \"$title\"\n" );
1225 return $text == "" ?
$title : $text;
1229 function makeStubLink( $title, $text = "", $query = "", $trail = "" ) {
1230 $nt = Title
::newFromText( $title );
1232 return $this->makeStubLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1234 wfDebug( "Invalid title passed to Skin::makeStubLink(): \"$title\"\n" );
1235 return $text == "" ?
$title : $text;
1239 # Pass a title object, not a title string
1240 function makeLinkObj( &$nt, $text= "", $query = "", $trail = "" )
1242 global $wgOut, $wgUser;
1243 if ( $nt->isExternal() ) {
1244 $u = $nt->getFullURL();
1245 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1246 $style = $this->getExternalLinkAttributes( $link, $text );
1249 if ( "" != $trail ) {
1250 if ( preg_match( "/^([a-z]+)(.*)$$/sD", $trail, $m ) ) {
1255 $retVal = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1256 } elseif ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
1257 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1258 } elseif ( ( -1 == $nt->getNamespace() ) ||
1259 ( Namespace::getImage() == $nt->getNamespace() ) ) {
1260 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1262 $aid = $nt->getArticleID() ;
1264 $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail );
1266 $threshold = $wgUser->getOption("stubthreshold") ;
1267 if ( $threshold > 0 ) {
1268 $res = wfQuery ( "SELECT HIGH_PRIORITY length(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ
) ;
1270 if ( wfNumRows( $res ) > 0 ) {
1271 $s = wfFetchObject( $res );
1273 if ( $s->cur_is_redirect
OR $s->cur_namespace
!= 0 ) {
1274 $size = $threshold*2 ; # Really big
1276 wfFreeResult( $res );
1278 $size = $threshold*2 ; # Really big
1283 if ( $size < $threshold ) {
1284 $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail );
1286 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1293 # Pass a title object, not a title string
1294 function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1296 global $wgOut, $wgTitle;
1298 $fname = "Skin::makeKnownLinkObj";
1299 wfProfileIn( $fname );
1301 $link = $nt->getPrefixedURL();
1303 if ( "" == $link ) {
1305 if ( "" == $text ) { $text = $nt->getFragment(); }
1307 $u = wfLocalUrlE( $link, $query );
1309 if ( "" != $nt->getFragment() ) {
1310 $u .= "#" . wfEscapeHTML( $nt->getFragment() );
1312 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1313 $style = $this->getInternalLinkAttributesObj( $nt, $text );
1316 if ( "" != $trail ) {
1317 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1322 $r = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1323 wfProfileOut( $fname );
1327 # Pass a title object, not a title string
1328 function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1330 global $wgOut, $wgUser;
1332 $fname = "Skin::makeBrokenLinkObj";
1333 wfProfileIn( $fname );
1335 $link = $nt->getPrefixedURL();
1337 if ( "" == $query ) { $q = "action=edit"; }
1338 else { $q = "action=edit&{$query}"; }
1339 $u = wfLocalUrlE( $link, $q );
1341 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1342 $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
1345 if ( "" != $trail ) {
1346 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1351 if ( $wgOut->isPrintable() ||
1352 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1353 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1355 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
1358 wfProfileOut( $fname );
1362 # Pass a title object, not a title string
1363 function makeStubLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1365 global $wgOut, $wgUser;
1367 $link = $nt->getPrefixedURL();
1369 $u = wfLocalUrlE( $link, $query );
1371 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1372 $style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
1375 if ( "" != $trail ) {
1376 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1381 if ( $wgOut->isPrintable() ||
1382 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1383 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1385 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1390 function fnamePart( $url )
1392 $basename = strrchr( $url, "/" );
1393 if ( false === $basename ) { $basename = $url; }
1394 else { $basename = substr( $basename, 1 ); }
1395 return wfEscapeHTML( $basename );
1398 function makeImage( $url, $alt = "" )
1402 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1403 $s = "<img src=\"{$url}\" alt=\"{$alt}\">";
1407 function makeImageLink( $name, $url, $alt = "" ) {
1408 $nt = Title
::makeTitle( Namespace::getImage(), $name );
1409 return $this->makeImageLinkObj( $nt, $alt );
1412 function makeImageLinkObj( $nt, $alt = "" ) {
1413 $link = $nt->getPrefixedURL();
1414 $name = $nt->getDBKey();
1415 $url = wfImageUrl( $name );
1416 if ( empty( $alt ) ) {
1417 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1419 $alt = htmlspecialchars( $alt );
1421 $u = wfLocalUrlE( $link );
1422 $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
1423 "<img border=\"0\" src=\"{$url}\" alt=\"{$alt}\"></a>";
1427 function makeMediaLink( $name, $url, $alt = "" ) {
1428 $nt = Title
::makeTitle( Namespace::getMedia(), $name );
1429 return $this->makeMediaLinkObj( $nt, $alt );
1432 function makeMediaLinkObj( $nt, $alt = "" )
1434 $name = $nt->getDBKey();
1435 $url = wfImageUrl( $name );
1436 if ( empty( $alt ) ) {
1437 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1440 $u = htmlspecialchars( $url );
1441 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1445 function specialLink( $name, $key = "" )
1449 if ( "" == $key ) { $key = strtolower( $name ); }
1450 $pn = $wgLang->ucfirst( $name );
1451 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1455 # Called by history lists and recent changes
1458 function beginRecentChangesList()
1460 $rc_cache = array() ;
1462 $this->lastdate
= "";
1466 function beginImageHistoryList()
1468 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1469 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul>";
1473 function endRecentChangesList()
1475 $s = $this->recentChangesBlock() ;
1480 function endImageHistoryList()
1486 function recentChangesBlockLine ( $y ) {
1487 global $wgUploadPath ;
1489 $M = wfMsg( "minoreditletter" );
1490 $N = wfMsg( "newpageletter" );
1492 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>" ;
1494 if ( $y->isnew
) $r .= $N ;
1495 else $r .= " " ;
1496 if ( $y->isminor
) $r .= $M ;
1497 else $r .= " " ;
1498 $r .= " ".$y->timestamp
." " ;
1501 if ( $y->watched
) $link = "<strong>{$link}</strong>" ;
1507 $r .= $this->makeKnownLink( $y->secureName
, wfMsg( "hist" ), "action=history" );
1509 $r .= ") . . ".$y->userlink
;
1510 $r .= $y->usertalklink
;
1511 if ( $y->usercomment
!= "" )
1512 $r .= " <em>(".wfEscapeHTML($y->usercomment
).")</em>" ;
1517 function recentChangesBlockGroup ( $y ) {
1518 global $wgUploadPath ;
1521 $M = wfMsg( "minoreditletter" );
1522 $N = wfMsg( "newpageletter" );
1524 $userlinks = array () ;
1525 foreach ( $y AS $x ) {
1526 $oldid = $x->diffid
;
1527 if ( $x->isnew
) $isnew = true ;
1529 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1533 krsort ( $userlinks ) ;
1534 asort ( $userlinks ) ;
1536 $u = array_keys ( $userlinks ) ;
1537 foreach ( $u as $x ) {
1539 if ( $userlinks[$x] > 1 ) $z .= " ({$userlinks[$x]}×)" ;
1540 array_push ( $users , $z ) ;
1542 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1545 $e = array_shift ( $e ) ;
1548 $rci = "RCI{$this->rccc}" ;
1549 $rcl = "RCL{$this->rccc}" ;
1550 $rcm = "RCM{$this->rccc}" ;
1551 $tl = "<a href='javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")'>" ;
1552 $tl .= "<span id='{$rcm}'><img src='{$wgUploadPath}/Arr_r.png' width=12 height=12 border=0></span>" ;
1553 $tl .= "<span id='{$rcl}' style='display:none'><img src='{$wgUploadPath}/Arr_d.png' width=12 height=12 border=0></span>" ;
1559 if ( $isnew ) $r .= $N ;
1560 else $r .= " " ;
1561 $r .= " " ; # Minor
1562 $r .= " ".$e->timestamp
." " ;
1566 if ( $e->watched
) $link = "<strong>{$link}</strong>" ;
1570 $r .= " (".count($y)." " ;
1571 if ( $isnew ) $r .= wfMsg("changes");
1572 else $r .= $this->makeKnownLink( $e->secureName
, wfMsg("changes") , "diff=0&oldid=".$oldid ) ;
1574 $r .= $this->makeKnownLink( $e->secureName
, wfMsg( "history" ), "action=history" );
1582 $r .= "<div id='{$rci}' style='display:none'>" ;
1583 foreach ( $y AS $x )
1585 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>";
1586 $r .= "<tt> " ;
1587 if ( $x->isnew
) $r .= $N ;
1588 else $r .= " " ;
1589 if ( $x->isminor
) $r .= $M ;
1590 else $r .= " " ;
1594 if ( $x->oldid
!= 0 ) $o = "oldid=".$x->oldid
;
1595 if ( $x->islog
) $link = $x->timestamp
;
1596 else $link = $this->makeKnownLink( $x->secureName
, $x->timestamp
, $o ) ;
1597 $link = "<tt>{$link}</tt>" ;
1604 $r .= $x->lastlink
;
1605 $r .= ") . . ".$x->userlink
;
1606 $r .= $x->usertalklink
;
1607 if ( $x->usercomment
!= "" )
1608 $r .= " <em>(".wfEscapeHTML($x->usercomment
).")</em>" ;
1617 function recentChangesBlock ()
1619 global $wgUploadPath ;
1620 if ( count ( $this->rc_cache
) == 0 ) return "" ;
1621 $k = array_keys ( $this->rc_cache
) ;
1622 foreach ( $k AS $x )
1624 $y = $this->rc_cache
[$x] ;
1625 if ( count ( $y ) < 2 ) {
1626 $r .= $this->recentChangesBlockLine ( array_shift ( $y ) ) ;
1628 $r .= $this->recentChangesBlockGroup ( $y ) ;
1632 return "<div align=left>{$r}</div>" ;
1635 function recentChangesLine( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1638 $usenew = $wgUser->getOption( "usenewrc" );
1640 $r = $this->recentChangesLineNew ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1642 $r = $this->recentChangesLineOld ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1646 function recentChangesLineOld( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0, $diffid = 0 )
1648 global $wgTitle, $wgLang, $wgUser;
1650 $d = $wgLang->date( $ts, true);
1652 if ( $d != $this->lastdate
) {
1653 if ( "" != $this->lastdate
) { $s .= "</ul>\n"; }
1654 $s .= "<h4>{$d}</h4>\n<ul>";
1655 $this->lastdate
= $d;
1657 $h = $wgLang->time( $ts, true );
1658 $t = Title
::makeName( $ns, $ttl );
1659 $clink = $this->makeKnownLink( $t , "" );
1660 $nt = Title
::newFromText( $t );
1663 $clink = "<strong>{$clink}</strong>";
1665 $hlink = $this->makeKnownLink( $t, wfMsg( "hist" ), "action=history" );
1666 if ( $isnew ||
$nt->isLog() ) {
1667 $dlink = wfMsg( "diff" );
1669 $dlink = $this->makeKnownLink( $t, wfMsg( "diff" ),
1670 "diff={$oldid}&oldid={$diffid}" ); # Finagle's law
1673 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1674 $ut, "target=" . $ut );
1676 $ul = $this->makeLink( $wgLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut );
1679 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1680 global $wgDisableAnonTalk;
1681 if( 0 == $u && $wgDisableAnonTalk ) {
1684 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1685 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1687 $cr = wfMsg( "currentrev" );
1689 $s .= "<li> ({$dlink}) ({$hlink}) . .";
1690 $M = wfMsg( "minoreditletter" );
1691 $N = wfMsg( "newpageletter" );
1692 if ( $isminor ) { $s .= " <strong>{$M}</strong>"; }
1693 if ( $isnew ) { $s .= "<strong>{$N}</strong>"; }
1694 $s .= " {$clink}; {$h} . . {$ul}";
1697 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1698 $blink = $this->makeKnownLink( $wgLang->specialPage(
1699 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1703 if($utl) $utl .= " | ";
1706 if($utl) $s.=" ({$utl})";
1708 if ( "" != $c && "*" != $c ) {
1709 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1716 function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1718 global $wgTitle, $wgLang, $wgUser;
1720 $rc = new RecentChangesClass
;
1722 $d = $wgLang->date( $ts, true);
1725 if ( $d != $this->lastdate
) {
1726 $ret = $this->recentChangesBlock () ;
1727 $this->rc_cache
= array() ;
1728 $ret .= "<h4>{$d}</h4>\n";
1729 $this->lastdate
= $d;
1731 $h = $wgLang->time( $ts, true );
1732 $t = Title
::makeName( $ns, $ttl );
1733 $clink = $this->makeKnownLink( $t, "" ) ;
1734 if ( $oldid == 0 ) $c2link = $clink ;
1735 else $c2link = $this->makeKnownLink( $t, "" , "oldid={$oldid}" );
1736 $nt = Title
::newFromText( $t );
1738 $rc->timestamp
= $h ;
1739 $rc->oldid
= $oldid ;
1740 $rc->diffid
= $diffid ;
1741 $rc->watched
= $watched ;
1742 $rc->isnew
= $isnew ;
1743 $rc->isminor
= $isminor ;
1744 $rc->secureName
= $t ;
1745 $rc->displayName
= $nt ;
1746 $rc->link
= $clink ;
1747 $rc->usercomment
= $c ;
1748 $rc->islog
= $nt->isLog() ;
1750 if ( ( $isnew && $oldid == 0 ) ||
$nt->isLog() ) {
1751 $dlink = wfMsg( "cur" );
1753 $dlink = $this->makeKnownLink( $t, wfMsg( "cur" ),
1754 "diff=0&oldid={$oldid}" );
1757 if ( $diffid == 0 ||
$nt->isLog() ) {
1758 $plink = wfMsg( "last" );
1760 $plink = $this->makeKnownLink( $t, wfMsg( "last" ),
1761 "diff={$oldid}&oldid={$diffid}" );
1765 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1766 $ut, "target=" . $ut );
1767 } else { $ul = $this->makeLink( $wgLang->getNsText(
1768 Namespace::getUser() ) . ":{$ut}", $ut ); }
1770 $rc->userlink
= $ul ;
1771 $rc->lastlink
= $plink ;
1772 $rc->curlink
= $dlink ;
1774 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1775 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1776 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1778 global $wgDisableAnonTalk;
1779 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1780 $blink = $this->makeKnownLink( $wgLang->specialPage(
1781 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1782 if( $wgDisableAnonTalk )
1783 $rc->usertalklink
= " ({$blink})";
1785 $rc->usertalklink
= " ({$utl} | {$blink})";
1787 if( $wgDisableAnonTalk && ($u == 0) )
1788 $rc->usertalklink
= "";
1790 $rc->usertalklink
= " ({$utl})";
1793 if ( !isset ( $this->rc_cache
[$t] ) ) $this->rc_cache
[$t] = array() ;
1794 array_push ( $this->rc_cache
[$t] , $rc ) ;
1799 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
1801 global $wgUser, $wgLang, $wgTitle;
1803 $dt = $wgLang->timeanddate( $ts, true );
1804 $del = wfMsg( "deleteimg" );
1805 $cur = wfMsg( "cur" );
1808 $url = wfImageUrl( $img );
1810 if ( $wgUser->isSysop() ) {
1811 $link = wfLocalUrlE( $wgTitle->getPrefixedText(), "image=" . $wgTitle->getURL() .
1813 $style = $this->getInternalLinkAttributes( $link, $del );
1815 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
1820 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
1821 if( $wgUser->getID() != 0 ) {
1822 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1823 wfMsg( "revertimg" ), "action=revert&oldimage=" .
1824 urlencode( $img ) );
1825 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1826 $del, "action=delete&oldimage=" . urlencode( $img ) );
1828 # Having live active links for non-logged in users
1829 # means that bots and spiders crawling our site can
1830 # inadvertently change content. Baaaad idea.
1831 $rlink = wfMsg( "revertimg" );
1835 if ( 0 == $u ) { $ul = $ut; }
1836 else { $ul = $this->makeLink( $wgLang->getNsText(
1837 Namespace::getUser() ) . ":{$ut}", $ut ); }
1839 $nb = wfMsg( "nbytes", $size );
1840 $style = $this->getInternalLinkAttributes( $url, $dt );
1842 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
1843 . " . . {$ul} ({$nb})";
1845 if ( "" != $c && "*" != $c ) {
1846 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1852 function tocIndent($level) {
1854 while($level-->0) $rv.="<div style=\"margin-left:2em;\">\n";
1859 function tocUnindent($level) {
1860 while($level-->0) $rv.="</div>\n";
1864 // parameter level defines if we are on an indentation level
1865 function tocLine($anchor,$tocline,$level) {
1869 return "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n";
1872 return "<div style=\"margin-bottom:0px;\">\n".
1873 "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n".
1879 function tocTable($toc) {
1880 // note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
1884 $hideline = " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>";
1887 "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
1888 "<b>".wfMsg("toc")."</b>" .
1890 "</td></tr><tr id='tocinside'><td align=\"left\">\n".
1891 $toc."</td></tr></table><P>\n";
1894 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
1895 function editSectionScript($section,$head) {
1897 global $wgTitle,$wgUser,$oldid;
1898 if($oldid) return $head;
1899 $url = wfLocalUrlE(urlencode($wgTitle->getPrefixedText()),"action=edit§ion=$section");
1900 return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
1903 function editSectionLink($section) {
1906 global $wgTitle,$wgUser,$oldid;
1907 if($oldid) return "";
1908 if ($printable) return "";
1909 $editurl="§ion={$section}";
1910 $url=$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
1911 return "<div style=\"float:right;margin-left:5px;\"><small>[".$url."]</small></div>";
1916 include_once( "SkinStandard.php" );
1917 include_once( "SkinNostalgia.php" );
1918 include_once( "SkinCologneBlue.php" );
1920 #include_once( "SkinSmarty.php" );