proper CSS class for sitesupport link
[lhc/web/wiklou.git] / includes / Skin.php
1 <?
2 # See skin.doc
3
4 # These are the INTERNAL names, which get mapped
5 # directly to class names. For display purposes, the
6 # Language class has internationalized names
7 #
8 /* private */ $wgValidSkinNames = array(
9 "Standard", "Nostalgia", "CologneBlue" #, "Smarty", "Montparnasse"
10 );
11
12 # For some odd PHP bug, this function can't be part of a class
13 function getCategories ()
14 {
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() ;
20 $s = "" ;
21 $s .= "\n<br>\n";
22 $s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ;
23 $t = implode ( " | " , $wgOut->mCategoryLinks ) ;
24 if ( $t != "" ) $s .= " : " ;
25 $s .= $t ;
26 return $s ;
27 }
28
29
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 ;
35 } ;
36
37 class Skin {
38
39 /* private */ var $lastdate, $lastline;
40
41 var $rc_cache ; # Cache for Enhanced Recent Changes
42 var $rccc ; # Recent Changes Cache Counter for visibility toggle
43
44
45 function Skin()
46 {
47 }
48
49 function getSkinNames()
50 {
51 global $wgValidSkinNames;
52 return $wgValidSkinNames;
53 }
54
55 function getStylesheet()
56 {
57 return "wikistandard.css";
58 }
59
60 function qbSetting()
61 {
62 global $wgOut, $wgUser;
63
64 if ( $wgOut->isQuickbarSupressed() ) { return 0; }
65 $q = $wgUser->getOption( "quickbar" );
66 if ( "" == $q ) { $q = 0; }
67 return $q;
68 }
69
70 function initPage()
71 {
72 global $wgOut, $wgStyleSheetPath;
73 $fname = "Skin::initPage";
74 wfProfileIn( $fname );
75
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 );
81 }
82
83 function outputPage( &$out ) {
84 wfProfileIn( "Skin::outputPage" );
85 $this->initPage();
86 $out->out( $out->headElement() );
87
88 $out->out( "\n<body" );
89 $ops = $this->getBodyOptions();
90 foreach ( $ops as $name => $val ) {
91 $out->out( " $name='$val'" );
92 }
93 $out->out( ">\n" );
94 if ( $wgDebugComments ) {
95 $out->out( "<!-- Wiki debugging output:\n" .
96 $out->mDebugtext . "-->\n" );
97 }
98 $out->out( $this->beforeContent() );
99
100 $out->out( $out->mBodytext );
101
102 $out->out( $this->afterContent() );
103
104 wfProfileClose();
105 $out->out( $out->reportTime() );
106
107 $out->out( "\n</body></html>" );
108 }
109
110 function getHeadScripts() {
111 global $wgStyleSheetPath;
112 $r = "<script type=\"text/javascript\" src=\"{$wgStyleSheetPath}/wikibits.js\"></script>\n";
113 return $r;
114 }
115
116 function getUserStyles()
117 {
118 $s = "<style type='text/css'><!--\n";
119 $s .= $this->doGetUserStyles();
120 $s .= "//--></style>\n";
121 return $s;
122 }
123
124 function doGetUserStyles()
125 {
126 global $wgUser;
127
128 $s = "";
129 if ( 1 == $wgUser->getOption( "underline" ) ) {
130 # Don't override browser settings
131 } else {
132 # CHECK MERGE @@@
133 # Force no underline
134 $s .= "a.stub, a.new, a.internal, a.external { " .
135 "text-decoration: none; }\n";
136 }
137 if ( 1 == $wgUser->getOption( "highlightbroken" ) ) {
138 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
139 }
140 if ( 1 == $wgUser->getOption( "justify" ) ) {
141 $s .= "#article { text-align: justify; }\n";
142 }
143 return $s;
144 }
145
146 function getBodyOptions()
147 {
148 global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $oldid, $redirect, $diff,$action;
149
150 if ( 0 != $wgTitle->getNamespace() ) {
151 $a = array( "bgcolor" => "#ffffec" );
152 }
153 else $a = array( "bgcolor" => "#FFFFFF" );
154 if($wgOut->isArticle() && $wgUser->getOption("editondblclick")
155 &&
156 (!$wgTitle->isProtected() || $wgUser->isSysop())
157
158 ) {
159 $n = $wgTitle->getPrefixedURL();
160 $t = wfMsg( "editthispage" );
161 $oid = $red = "";
162 if ( $redirect ) { $red = "&redirect={$redirect}"; }
163 if ( $oldid && ! isset( $diff ) ) {
164 $oid = "&oldid={$oldid}";
165 }
166 $s = wfLocalUrlE($n,"action=edit{$oid}{$red}");
167 $s = "document.location = \"" .$s ."\";";
168 $a += array ("ondblclick" => $s);
169
170 }
171 if($action=="edit") { # set focus in edit box
172 $foc = "document.editform.wpTextbox1.focus()";
173 if($a['onload']) {
174 $a['onload'] .= ";$foc";
175 } else {
176 $a['onload'] = $foc;
177 }
178 }
179 return $a;
180 }
181
182 function getExternalLinkAttributes( $link, $text )
183 {
184 global $wgUser, $wgOut, $wgLang;
185
186 $link = urldecode( $link );
187 $link = $wgLang->checkTitleEncoding( $link );
188 $link = str_replace( "_", " ", $link );
189 $link = wfEscapeHTML( $link );
190
191 if ( $wgOut->isPrintable() ) { $r = " class='printable'"; }
192 else { $r = " class='external'"; }
193
194 if ( 1 == $wgUser->getOption( "hover" ) ) {
195 $r .= " title=\"{$link}\"";
196 }
197 return $r;
198 }
199
200 function getInternalLinkAttributes( $link, $text, $broken = false )
201 {
202 global $wgUser, $wgOut;
203
204 $link = urldecode( $link );
205 $link = str_replace( "_", " ", $link );
206 $link = wfEscapeHTML( $link );
207
208 if ( $wgOut->isPrintable() ) {
209 $r = " class='printable'";
210 } else if ( $broken == "stub" ) {
211 $r = " class='stub'";
212 } else if ( $broken == "yes" ) {
213 $r = " class='new'";
214 } else {
215 $r = " class='internal'";
216 }
217
218 if ( 1 == $wgUser->getOption( "hover" ) ) {
219 $r .= " title=\"{$link}\"";
220 }
221 return $r;
222 }
223
224 function getInternalLinkAttributesObj( &$nt, $text, $broken = false )
225 {
226 global $wgUser, $wgOut;
227
228 if ( $wgOut->isPrintable() ) {
229 $r = " class='printable'";
230 } else if ( $broken == "stub" ) {
231 $r = " class='stub'";
232 } else if ( $broken == "yes" ) {
233 $r = " class='new'";
234 } else {
235 $r = " class='internal'";
236 }
237
238 if ( 1 == $wgUser->getOption( "hover" ) ) {
239 $r .= ' title ="' . $nt->getEscapedText() . '"';
240 }
241 return $r;
242 }
243
244 function getLogo()
245 {
246 global $wgLogo;
247 return $wgLogo;
248 }
249
250 # This will be called immediately after the <body> tag. Split into
251 # two functions to make it easier to subclass.
252 #
253 function beforeContent()
254 {
255 global $wgUser, $wgOut;
256
257 if ( $wgOut->isPrintable() ) {
258 $s = $this->pageTitle() . $this->pageSubtitle() . "\n";
259 $s .= "\n<div class='bodytext'>";
260 return $s;
261 }
262 return $this->doBeforeContent();
263 }
264
265 function doBeforeContent()
266 {
267 global $wgUser, $wgOut, $wgTitle, $wgLang;
268 $fname = "Skin::doBeforeContent";
269 wfProfileIn( $fname );
270
271 $s = "";
272 $qb = $this->qbSetting();
273
274 if( $langlinks = $this->otherLanguages() ) {
275 $rows = 2;
276 $borderhack = "";
277 } else {
278 $rows = 1;
279 $langlinks = false;
280 $borderhack = "class='top'";
281 }
282
283 $s .= "\n<div id='content'>\n<div id='topbar'>" .
284 "<table width='98%' border=0 cellspacing=0><tr>";
285
286 $shove = ($qb != 0);
287 $left = ($qb == 1 || $qb == 3);
288 if($wgLang->isRTL()) $left = !$left;
289
290 if ( !$shove ) {
291 $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>" .
292 $this->logoText() . "</td>";
293 } elseif( $left ) {
294 $s .= $this->getQuickbarCompensator( $rows );
295 }
296 $l = $wgLang->isRTL() ? "right" : "left";
297 $s .= "<td {$borderhack} align='$l' valign='top'>";
298
299 $s .= $this->topLinks() ;
300 $s .= "<p class='subtitle'>" . $this->pageTitleLinks();
301
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>";
306
307 if ( $langlinks ) {
308 $s .= "</tr>\n<tr><td class='top' colspan=\"2\">$langlinks</td>";
309 }
310
311 if ( $shove && !$left ) { # Right
312 $s .= $this->getQuickbarCompensator( $rows );
313 }
314 $s .= "</tr></table>\n</div>\n";
315 $s .= "\n<div id='article'>";
316
317 $s .= $this->pageTitle();
318 $s .= $this->pageSubtitle() ;
319 $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
320 $s .= "\n<p>";
321 wfProfileOut( $fname );
322 return $s;
323 }
324
325 function getQuickbarCompensator( $rows = 1 )
326 {
327 return "<td width='152' rowspan='{$rows}'>&nbsp;</td>";
328 }
329
330 # This gets called immediately before the </body> tag.
331 #
332 function afterContent()
333 {
334 global $wgUser, $wgOut, $wgServer;
335 global $wgTitle;
336
337 if ( $wgOut->isPrintable() ) {
338 $s = "\n</div>\n";
339
340 $u = htmlspecialchars( $wgServer . $wgTitle->getFullURL() );
341 $u = "<a href=\"$u\">$u</a>";
342 $rf = wfMsg( "retrievedfrom", $u );
343
344 if ( $wgOut->isArticle() ) {
345 $lm = "<br>" . $this->lastModified();
346 } else { $lm = ""; }
347
348 $cr = wfMsg( "gnunote" );
349 $s .= "<p><em>{$rf}{$lm} {$cr}</em>\n";
350 return $s;
351 }
352 return $this->doAfterContent();
353 }
354
355 function doAfterContent()
356 {
357 global $wgUser, $wgOut, $wgLang;
358 $fname = "Skin::doAfterContent";
359 wfProfileIn( $fname );
360 wfProfileIn( "$fname-1" );
361
362 $s = "\n</div><br clear=all>\n";
363 $s .= "\n<div id='footer'>";
364 $s .= "<table width='98%' border=0 cellspacing=0><tr>";
365
366 wfProfileOut( "$fname-1" );
367 wfProfileIn( "$fname-2" );
368
369 $qb = $this->qbSetting();
370 $shove = ($qb != 0);
371 $left = ($qb == 1 || $qb == 3);
372 if($wgLang->isRTL()) $left = !$left;
373
374 if ( $shove && $left ) { # Left
375 $s .= $this->getQuickbarCompensator();
376 }
377 wfProfileOut( "$fname-2" );
378 wfProfileIn( "$fname-3" );
379 $l = $wgLang->isRTL() ? "right" : "left";
380 $s .= "<td class='bottom' align='$l' valign='top'>";
381
382 $s .= $this->bottomLinks();
383 $s .= "\n<br>" . $this->mainPageLink()
384 . " | " . $this->aboutLink()
385 . " | " . $this->specialLink( "recentchanges" )
386 . " | " . $this->searchForm()
387 . "<br>" . $this->pageStats();
388
389 $s .= "</td>";
390 if ( $shove && !$left ) { # Right
391 $s .= $this->getQuickbarCompensator();
392 }
393 $s .= "</tr></table>\n</div>\n</div>\n";
394
395 wfProfileOut( "$fname-3" );
396 wfProfileIn( "$fname-4" );
397 if ( 0 != $qb ) { $s .= $this->quickBar(); }
398 wfProfileOut( "$fname-4" );
399 wfProfileOut( $fname );
400 return $s;
401 }
402
403 function pageTitleLinks()
404 {
405 global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval ;
406
407 $s = $this->printableLink();
408
409 if ( $wgOut->isArticle() ) {
410 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
411 $name = $wgTitle->getDBkey();
412 $link = wfEscapeHTML( wfImageUrl( $name ) );
413 $style = $this->getInternalLinkAttributes( $link, $name );
414 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
415 }
416 # This will show the "Approve" link if $wgUseApproval=true;
417 if ( isset ( $wgUseApproval ) && $wgUseApproval )
418 {
419 $t = $wgTitle->getDBkey();
420 $name = "Approve this article" ;
421 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
422 #wfEscapeHTML( wfImageUrl( $name ) );
423 $style = $this->getExternalLinkAttributes( $link, $name );
424 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
425 } }
426 if ( "history" == $action || isset( $diff ) || isset( $oldid ) ) {
427 $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
428 wfMsg( "currentrev" ) );
429 }
430
431 if ( $wgUser->getNewtalk() ) {
432 # do not show "You have new messages" text when we are viewing our
433 # own talk page
434
435 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
436 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
437 $n =$wgUser->getName();
438 $tl = $this->makeKnownLink( $wgLang->getNsText(
439 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
440 wfMsg("newmessageslink") );
441 $s.=" | <strong>". wfMsg( "newmessages", $tl ) . "</strong>";
442 }
443 }
444 if( $wgUser->isSysop() &&
445 (($wgTitle->getArticleId() == 0) || ($action == "history")) &&
446 ($n = $wgTitle->isDeleted() ) ) {
447 $s .= " | " . wfMsg( "thisisdeleted",
448 $this->makeKnownLink(
449 $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
450 wfMsg( "restorelink", $n ) ) );
451 }
452 return $s;
453 }
454
455 function printableLink()
456 {
457 global $wgOut, $wgTitle, $oldid, $action;
458
459 $q = "";
460 foreach( $_GET as $var => $val ) {
461 if( $var != "title" && $var != "printable" )
462 $q .= urlencode( $var ) . "=" . urlencode( $val );
463 }
464 if( !empty( $q ) ) $q .= "&";
465
466 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
467 WfMsg( "printableversion" ), "{$q}printable=yes" );
468 return $s;
469 }
470
471 function pageTitle()
472 {
473 global $wgOut, $wgTitle, $wgUser;
474
475 $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
476 if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
477 return $s;
478 }
479
480 function pageSubtitle()
481 {
482 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
483
484 $sub = $wgOut->getSubtitle();
485 if ( "" == $sub ) {
486 global $wgExtraSubtitle;
487 $sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
488 }
489 if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
490 $ptext=$wgTitle->getPrefixedText();
491 if(preg_match("/\//",$ptext)) {
492 $sub.="</p><p class='subpages'>";
493 $links=explode("/",$ptext);
494 $c=0;
495 $growinglink="";
496 foreach($links as $link) {
497 $c++;
498 if ($c<count($links)) {
499 $growinglink .= $link;
500 $getlink = $this->makeLink( $growinglink, $link );
501 if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
502 if ($c>1) {
503 $sub .= " | ";
504 } else {
505 $sub .="&lt; ";
506 }
507 $sub .= $getlink;
508 $growinglink.="/";
509 }
510
511 }
512 }
513 }
514 $s = "<p class='subtitle'>{$sub}\n";
515 return $s;
516 }
517
518 function nameAndLogin()
519 {
520 global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader;
521
522 $li = $wgLang->specialPage( "Userlogin" );
523 $lo = $wgLang->specialPage( "Userlogout" );
524
525 $s = "";
526 if ( 0 == $wgUser->getID() ) {
527 if( $wgShowIPinHeader ) {
528 $n = getenv( "REMOTE_ADDR" );
529
530 $tl = $this->makeKnownLink( $wgLang->getNsText(
531 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
532 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
533
534 $s .= $n . " (".$tl.")";
535 } else {
536 $s .= wfMsg("notloggedin");
537 }
538
539 $rt = $wgTitle->getPrefixedURL();
540 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
541 $q = "";
542 } else { $q = "returnto={$rt}"; }
543
544 $s .= "\n<br>" . $this->makeKnownLink( $li,
545 wfMsg( "login" ), $q );
546 } else {
547 $n = $wgUser->getName();
548 $rt = $wgTitle->getPrefixedURL();
549 $tl = $this->makeKnownLink( $wgLang->getNsText(
550 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
551 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
552
553 $tl = " ({$tl})";
554
555 $s .= $this->makeKnownLink( $wgLang->getNsText(
556 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br>" .
557 $this->makeKnownLink( $lo, wfMsg( "logout" ),
558 "returnto={$rt}" ) . " | " .
559 $this->specialLink( "preferences" );
560 }
561 $s .= " | " . $this->makeKnownLink( wfMsg( "helppage" ),
562 wfMsg( "help" ) );
563
564 return $s;
565 }
566
567 function searchForm()
568 {
569 global $search;
570
571 $s = "<form name='search' class='inline' method=get action=\""
572 . wfLocalUrl( "" ) . "\">"
573 . "<input type=text name=\"search\" size=19 value=\""
574 . htmlspecialchars(substr($search,0,256)) . "\">\n"
575 . "<input type=submit name=\"go\" value=\"" . wfMsg ("go") . "\">&nbsp;"
576 . "<input type=submit value=\"" . wfMsg ("search") . "\"></form>";
577
578 return $s;
579 }
580
581 function topLinks()
582 {
583 global $wgOut;
584 $sep = " |\n";
585
586 $s = $this->mainPageLink() . $sep
587 . $this->specialLink( "recentchanges" );
588
589 if ( $wgOut->isArticle() ) {
590 $s .= $sep . $this->editThisPage()
591 . $sep . $this->historyLink();
592 }
593 # Many people don't like this dropdown box
594 #$s .= $sep . $this->specialPagesList();
595
596 return $s;
597 }
598
599 function bottomLinks()
600 {
601 global $wgOut, $wgUser, $wgTitle;
602 $sep = " |\n";
603
604 $s = "";
605 if ( $wgOut->isArticle() ) {
606 $s .= "<strong>" . $this->editThisPage() . "</strong>";
607 if ( 0 != $wgUser->getID() ) {
608 $s .= $sep . $this->watchThisPage();
609 }
610 $s .= $sep . $this->talkLink()
611 . $sep . $this->historyLink()
612 . $sep . $this->whatLinksHere()
613 . $sep . $this->watchPageLinksLink();
614
615 if ( $wgTitle->getNamespace() == Namespace::getUser()
616 || $wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
617
618 {
619 $id=User::idFromName($wgTitle->getText());
620 $ip=User::isIP($wgTitle->getText());
621
622 if($id || $ip) { # both anons and non-anons have contri list
623 $s .= $sep . $this->userContribsLink();
624 }
625 if ( 0 != $wgUser->getID() ) { # show only to signed in users
626 if($id) { # can only email non-anons
627 $s .= $sep . $this->emailUserLink();
628 }
629 }
630 }
631 if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
632 $s .= "\n<br>" . $this->deleteThisPage() .
633 $sep . $this->protectThisPage() .
634 $sep . $this->moveThisPage();
635 }
636 $s .= "<br>\n" . $this->otherLanguages();
637 }
638 return $s;
639 }
640
641 function pageStats()
642 {
643 global $wgOut, $wgLang, $wgArticle;
644 global $oldid, $diff, $wgDisableCounters;
645
646 if ( ! $wgOut->isArticle() ) { return ""; }
647 if ( isset( $oldid ) || isset( $diff ) ) { return ""; }
648 if ( 0 == $wgArticle->getID() ) { return ""; }
649
650 if ( $wgDisableCounters ) {
651 $s = "";
652 } else {
653 $count = $wgArticle->getCount();
654 $s = wfMsg( "viewcount", $count );
655 }
656 $s .= $this->lastModified();
657 $s .= " " . wfMsg( "gnunote" );
658 return "<span id='pagestats'>{$s}</span>";
659 }
660
661 function lastModified()
662 {
663 global $wgLang, $wgArticle;
664
665 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
666 $s = " " . wfMsg( "lastmodified", $d );
667 return $s;
668 }
669
670 function logoText( $align = "" )
671 {
672 if ( "" != $align ) { $a = " align='{$align}'"; }
673 else { $a = ""; }
674
675 $mp = wfMsg( "mainpage" );
676 $s = "<a href=\"" . wfLocalUrlE( urlencode( $mp ) )
677 . "\"><img{$a} border=0 src=\""
678 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\"></a>";
679 return $s;
680 }
681
682 function quickBar()
683 {
684 global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
685 global $wpPreview;
686 $fname = "Skin::quickBar";
687 wfProfileIn( $fname );
688
689 $tns=$wgTitle->getNamespace();
690
691 $s = "\n<div id='quickbar'>";
692 $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
693
694 $sep = "\n<br>";
695 $s .= $this->mainPageLink()
696 . $sep . $this->specialLink( "recentchanges" )
697 . $sep . $this->specialLink( "randompage" );
698 if ($wgUser->getID()) {
699 $s.= $sep . $this->specialLink( "watchlist" ) ;
700 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
701 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
702
703 }
704 // only show watchlist link if logged in
705 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
706 $s .= "\n<br><hr class='sep'>";
707 $articleExists = $wgTitle->getArticleId();
708 if ( $wgOut->isArticle() || $action =="edit" || $action =="history" || $wpPreview) {
709 if($wgOut->isArticle()) {
710 $s .= "<strong>" . $this->editThisPage() . "</strong>";
711 } else { # backlink to the article in edit or history mode
712 if($articleExists){ # no backlink if no article
713 switch($tns) {
714 case 0:
715 $text = wfMsg("articlepage");
716 break;
717 case 1:
718 $text = wfMsg("viewtalkpage");
719 break;
720 case 2:
721 $text = wfMsg("userpage");
722 break;
723 case 3:
724 $text = wfMsg("viewtalkpage");
725 break;
726 case 4:
727 $text = wfMsg("wikipediapage");
728 break;
729 case 5:
730 $text = wfMsg("viewtalkpage");
731 break;
732 case 6:
733 $text = wfMsg("imagepage");
734 break;
735 case 7:
736 $text = wfMsg("viewtalkpage");
737 break;
738 default:
739 $text= wfMsg("articlepage");
740 }
741
742 $link = $wgTitle->getText();
743 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
744 $link = $nstext . ":" . $link ;
745 }
746
747 $s .= $this->makeLink( $link, $text );
748 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
749 # we just throw in a "New page" text to tell the user that he's in edit mode,
750 # and to avoid messing with the separator that is prepended to the next item
751 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
752 }
753
754 }
755
756
757 if( $tns%2 && $action!="edit" && !$wpPreview) {
758 $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit&section=new");
759 }
760
761 /*
762 watching could cause problems in edit mode:
763 if user edits article, then loads "watch this article" in background and then saves
764 article with "Watch this article" checkbox disabled, the article is transparently
765 unwatched. Therefore we do not show the "Watch this page" link in edit mode
766 */
767 if ( 0 != $wgUser->getID() && $articleExists) {
768 if($action!="edit" && $action!="history" &&
769 $action != "submit" )
770 {
771 $s .= $sep . $this->watchThisPage();
772 }
773 if ( $wgTitle->userCanEdit() )
774 $s .= $sep . $this->moveThisPage();
775 }
776 if ( $wgUser->isSysop() and $articleExists ) {
777 $s .= $sep . $this->deleteThisPage() .
778 $sep . $this->protectThisPage();
779 }
780 $s .= $sep . $this->talkLink();
781 if ($articleExists && $action !="history") {
782 $s .= $sep . $this->historyLink();
783 }
784 $s.=$sep . $this->whatLinksHere();
785
786 if($wgOut->isArticle()) {
787 $s .= $sep . $this->watchPageLinksLink();
788 }
789
790 if ( Namespace::getUser() == $wgTitle->getNamespace()
791 || $wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
792 ) {
793
794 $id=User::idFromName($wgTitle->getText());
795 $ip=User::isIP($wgTitle->getText());
796
797 if($id||$ip) {
798 $s .= $sep . $this->userContribsLink();
799 }
800 if ( 0 != $wgUser->getID() ) {
801 if($id) { # can only email real users
802 $s .= $sep . $this->emailUserLink();
803 }
804 }
805 }
806 $s .= "\n<br><hr class='sep'>";
807 }
808
809 if ( 0 != $wgUser->getID() ) {
810 $s .= $this->specialLink( "upload" ) . $sep;
811 }
812 $s .= $this->specialLink( "specialpages" )
813 . $sep . $this->bugReportsLink();
814
815 global $wgSiteSupportPage;
816 if( $wgSiteSupportPage ) {
817 $s .= "\n<br><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
818 "\" class=\"internal\">" . wfMsg( "sitesupport" ) . "</a>";
819 }
820
821 $s .= "\n<br></div>\n";
822 wfProfileOut( $fname );
823 return $s;
824 }
825
826 function specialPagesList()
827 {
828 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
829 $a = array();
830
831 $validSP = $wgLang->getValidSpecialPages();
832
833 foreach ( $validSP as $name => $desc ) {
834 if ( "" == $desc ) { continue; }
835 $a[$name] = $desc;
836 }
837 if ( $wgUser->isSysop() )
838 {
839 $sysopSP = $wgLang->getSysopSpecialPages();
840
841 foreach ( $sysopSP as $name => $desc ) {
842 if ( "" == $desc ) { continue; }
843 $a[$name] = $desc ;
844 }
845 }
846 if ( $wgUser->isDeveloper() )
847 {
848 $devSP = $wgLang->getDeveloperSpecialPages();
849
850 foreach ( $devSP as $name => $desc ) {
851 if ( "" == $desc ) { continue; }
852 $a[$name] = $desc ;
853 }
854 }
855 $go = wfMsg( "go" );
856 $sp = wfMsg( "specialpages" );
857 $spp = $wgLang->specialPage( "Specialpages" );
858
859 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
860 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
861 $s .= "<select name=\"wpDropdown\">\n";
862 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
863
864 foreach ( $a as $name => $desc ) {
865 $p = $wgLang->specialPage( $name );
866 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
867 }
868 $s .= "</select>\n";
869 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
870 $s .= "</form>\n";
871 return $s;
872 }
873
874 function mainPageLink()
875 {
876 $mp = wfMsg( "mainpage" );
877 $s = $this->makeKnownLink( $mp, $mp );
878 return $s;
879 }
880
881 function copyrightLink()
882 {
883 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
884 wfMsg( "copyrightpagename" ) );
885 return $s;
886 }
887
888 function aboutLink()
889 {
890 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
891 wfMsg( "aboutwikipedia" ) );
892 return $s;
893 }
894
895 function editThisPage()
896 {
897 global $wgOut, $wgTitle, $oldid, $redirect, $diff;
898
899 if ( ! $wgOut->isArticle() || $diff ) {
900 $s = wfMsg( "protectedpage" );
901 } else if ( $wgTitle->userCanEdit() ) {
902 $n = $wgTitle->getPrefixedText();
903 $t = wfMsg( "editthispage" );
904 $oid = $red = "";
905
906 if ( $redirect ) { $red = "&redirect={$redirect}"; }
907 if ( $oldid && ! isset( $diff ) ) {
908 $oid = "&oldid={$oldid}";
909 }
910 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
911 } else {
912 $s = wfMsg( "protectedpage" );
913 }
914 return $s;
915 }
916
917 function deleteThisPage()
918 {
919 global $wgUser, $wgOut, $wgTitle, $diff;
920
921 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
922 $n = $wgTitle->getPrefixedText();
923 $t = wfMsg( "deletethispage" );
924
925 $s = $this->makeKnownLink( $n, $t, "action=delete" );
926 } else {
927 $s = "";
928 }
929 return $s;
930 }
931
932 function protectThisPage()
933 {
934 global $wgUser, $wgOut, $wgTitle, $diff;
935
936 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
937 $n = $wgTitle->getPrefixedText();
938
939 if ( $wgTitle->isProtected() ) {
940 $t = wfMsg( "unprotectthispage" );
941 $q = "action=unprotect";
942 } else {
943 $t = wfMsg( "protectthispage" );
944 $q = "action=protect";
945 }
946 $s = $this->makeKnownLink( $n, $t, $q );
947 } else {
948 $s = "";
949 }
950 return $s;
951 }
952
953 function watchThisPage()
954 {
955 global $wgUser, $wgOut, $wgTitle, $diff;
956
957 if ( $wgOut->isArticle() && ( ! $diff ) ) {
958 $n = $wgTitle->getPrefixedText();
959
960 if ( $wgTitle->userIsWatching() ) {
961 $t = wfMsg( "unwatchthispage" );
962 $q = "action=unwatch";
963 } else {
964 $t = wfMsg( "watchthispage" );
965 $q = "action=watch";
966 }
967 $s = $this->makeKnownLink( $n, $t, $q );
968 } else {
969 $s = wfMsg( "notanarticle" );
970 }
971 return $s;
972 }
973
974 function moveThisPage()
975 {
976 global $wgTitle, $wgLang;
977
978 if ( $wgTitle->userCanEdit() ) {
979 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
980 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
981 } // no message if page is protected - would be redundant
982 return $s;
983 }
984
985 function historyLink()
986 {
987 global $wgTitle;
988
989 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
990 wfMsg( "history" ), "action=history" );
991 return $s;
992 }
993
994 function whatLinksHere()
995 {
996 global $wgTitle, $wgLang;
997
998 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
999 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
1000 return $s;
1001 }
1002
1003 function userContribsLink()
1004 {
1005 global $wgTitle, $wgLang;
1006
1007 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1008 wfMsg( "contributions" ), "target=" . $wgTitle->getURL() );
1009 return $s;
1010 }
1011
1012 function emailUserLink()
1013 {
1014 global $wgTitle, $wgLang;
1015
1016 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
1017 wfMsg( "emailuser" ), "target=" . $wgTitle->getURL() );
1018 return $s;
1019 }
1020
1021 function watchPageLinksLink()
1022 {
1023 global $wgOut, $wgTitle, $wgLang;
1024
1025 if ( ! $wgOut->isArticle() ) {
1026 $s = "(" . wfMsg( "notanarticle" ) . ")";
1027 } else {
1028 $s = $this->makeKnownLink( $wgLang->specialPage(
1029 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
1030 "target=" . $wgTitle->getPrefixedURL() );
1031 }
1032 return $s;
1033 }
1034
1035 function otherLanguages()
1036 {
1037 global $wgOut, $wgLang, $wgTitle;
1038
1039 $a = $wgOut->getLanguageLinks();
1040 # TEST THIS @@@
1041 if ( 0 == count( $a ) ) {
1042 if ( !$wgUseNewInterlanguage ) return "";
1043 $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
1044 if ( $ns != 0 AND $ns != 1 ) return "" ;
1045 $pn = "Intl" ;
1046 $x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
1047 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1048 wfMsg( "intl" ) , $x );
1049 }
1050
1051 if ( !$wgUseNewInterlanguage ) {
1052 $s = wfMsg( "otherlanguages" ) . ": ";
1053 } else {
1054 global $wgLanguageCode ;
1055 $x = "mode=zoom&xt=".$wgTitle->getDBkey() ;
1056 $x .= "&xl=".$wgLanguageCode ;
1057 $s = $this->makeKnownLink( $wgLang->specialPage( "Intl" ),
1058 wfMsg( "otherlanguages" ) , $x ) . ": " ;
1059 }
1060
1061 $s = wfMsg( "otherlanguages" ) . ": ";
1062 $first = true;
1063 if($wgLang->isRTL()) $s .= "<span dir='LTR'>";
1064 foreach( $a as $l ) {
1065 if ( ! $first ) { $s .= " | "; }
1066 $first = false;
1067
1068 $nt = Title::newFromText( $l );
1069 $url = $nt->getFullURL();
1070 $text = $wgLang->getLanguageName( $nt->getInterwiki() );
1071
1072 if ( "" == $text ) { $text = $l; }
1073 $style = $this->getExternalLinkAttributes( $l, $text );
1074 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
1075 }
1076 if($wgLang->isRTL()) $s .= "</span>";
1077 return $s;
1078 }
1079
1080 function bugReportsLink()
1081 {
1082 $s = $this->makeKnownLink( wfMsg( "bugreportspage" ),
1083 wfMsg( "bugreports" ) );
1084 return $s;
1085 }
1086
1087 function dateLink()
1088 {
1089 global $wgLinkCache;
1090 $t1 = Title::newFromText( gmdate( "F j" ) );
1091 $t2 = Title::newFromText( gmdate( "Y" ) );
1092
1093 $wgLinkCache->suspend();
1094 $id = $t1->getArticleID();
1095 $wgLinkCache->resume();
1096
1097 if ( 0 == $id ) {
1098 $s = $this->makeBrokenLink( $t1->getText() );
1099 } else {
1100 $s = $this->makeKnownLink( $t1->getText() );
1101 }
1102 $s .= ", ";
1103
1104 $wgLinkCache->suspend();
1105 $id = $t2->getArticleID();
1106 $wgLinkCache->resume();
1107
1108 if ( 0 == $id ) {
1109 $s .= $this->makeBrokenLink( $t2->getText() );
1110 } else {
1111 $s .= $this->makeKnownLink( $t2->getText() );
1112 }
1113 return $s;
1114 }
1115
1116 function talkLink()
1117 {
1118 global $wgLang, $wgTitle, $wgLinkCache;
1119
1120 $tns = $wgTitle->getNamespace();
1121 if ( -1 == $tns ) { return ""; }
1122
1123 $pn = $wgTitle->getText();
1124 $tp = wfMsg( "talkpage" );
1125 if ( Namespace::isTalk( $tns ) ) {
1126 $lns = Namespace::getSubject( $tns );
1127 switch($tns) {
1128 case 1:
1129 $text = wfMsg("articlepage");
1130 break;
1131 case 3:
1132 $text = wfMsg("userpage");
1133 break;
1134 case 5:
1135 $text = wfMsg("wikipediapage");
1136 break;
1137 case 7:
1138 $text = wfMsg("imagepage");
1139 break;
1140 default:
1141 $text= wfMsg("articlepage");
1142 }
1143 } else {
1144
1145 $lns = Namespace::getTalk( $tns );
1146 $text=$tp;
1147 }
1148 $n = $wgLang->getNsText( $lns );
1149 if ( "" == $n ) { $link = $pn; }
1150 else { $link = "{$n}:{$pn}"; }
1151
1152 $wgLinkCache->suspend();
1153 $s = $this->makeLink( $link, $text );
1154 $wgLinkCache->resume();
1155
1156 return $s;
1157 }
1158
1159 function commentLink()
1160 {
1161 global $wgLang, $wgTitle, $wgLinkCache;
1162
1163 $tns = $wgTitle->getNamespace();
1164 if ( -1 == $tns ) { return ""; }
1165
1166 $lns = ( Namespace::isTalk( $tns ) ) ? $tns : Namespace::getTalk( $tns );
1167
1168 # assert Namespace::isTalk( $lns )
1169
1170 $n = $wgLang->getNsText( $lns );
1171 $pn = $wgTitle->getText();
1172
1173 $link = "{$n}:{$pn}";
1174
1175 $wgLinkCache->suspend();
1176 $s = $this->makeKnownLink($link, wfMsg("postcomment"), "action=edit&section=new");
1177 $wgLinkCache->resume();
1178
1179 return $s;
1180 }
1181
1182 # After all the page content is transformed into HTML, it makes
1183 # a final pass through here for things like table backgrounds.
1184 #
1185 function transformContent( $text )
1186 {
1187 return $text;
1188 }
1189
1190 # Note: This function MUST call getArticleID() on the link,
1191 # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
1192 #
1193 function makeLink( $title, $text = "", $query = "", $trail = "" ) {
1194 wfProfileIn( "Skin::makeLink" );
1195 $nt = Title::newFromText( $title );
1196 if ($nt) {
1197 $result = $this->makeLinkObj( Title::newFromText( $title ), $text, $query, $trail );
1198 } else {
1199 wfDebug( "Invalid title passed to Skin::makeLink(): \"$title\"\n" );
1200 $result = $text == "" ? $title : $text;
1201 }
1202
1203 wfProfileOut( "Skin::makeLink" );
1204 return $result;
1205 }
1206
1207 function makeKnownLink( $title, $text = "", $query = "", $trail = "" ) {
1208 $nt = Title::newFromText( $title );
1209 if ($nt) {
1210 return $this->makeKnownLinkObj( Title::newFromText( $title ), $text, $query, $trail );
1211 } else {
1212 wfDebug( "Invalid title passed to Skin::makeKnownLink(): \"$title\"\n" );
1213 return $text == "" ? $title : $text;
1214 }
1215 }
1216
1217 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" ) {
1218 $nt = Title::newFromText( $title );
1219 if ($nt) {
1220 return $this->makeBrokenLinkObj( Title::newFromText( $title ), $text, $query, $trail );
1221 } else {
1222 wfDebug( "Invalid title passed to Skin::makeBrokenLink(): \"$title\"\n" );
1223 return $text == "" ? $title : $text;
1224 }
1225 }
1226
1227 function makeStubLink( $title, $text = "", $query = "", $trail = "" ) {
1228 $nt = Title::newFromText( $title );
1229 if ($nt) {
1230 return $this->makeStubLinkObj( Title::newFromText( $title ), $text, $query, $trail );
1231 } else {
1232 wfDebug( "Invalid title passed to Skin::makeStubLink(): \"$title\"\n" );
1233 return $text == "" ? $title : $text;
1234 }
1235 }
1236
1237 # Pass a title object, not a title string
1238 function makeLinkObj( &$nt, $text= "", $query = "", $trail = "" )
1239 {
1240 global $wgOut, $wgUser;
1241 if ( $nt->isExternal() ) {
1242 $u = $nt->getFullURL();
1243 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1244 $style = $this->getExternalLinkAttributes( $link, $text );
1245
1246 $inside = "";
1247 if ( "" != $trail ) {
1248 if ( preg_match( "/^([a-z]+)(.*)$$/sD", $trail, $m ) ) {
1249 $inside = $m[1];
1250 $trail = $m[2];
1251 }
1252 }
1253 $retVal = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1254 } elseif ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
1255 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1256 } elseif ( ( -1 == $nt->getNamespace() ) ||
1257 ( Namespace::getImage() == $nt->getNamespace() ) ) {
1258 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1259 } else {
1260 $aid = $nt->getArticleID() ;
1261 if ( 0 == $aid ) {
1262 $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail );
1263 } else {
1264 $threshold = $wgUser->getOption("stubthreshold") ;
1265 if ( $threshold > 0 ) {
1266 $res = wfQuery ( "SELECT HIGH_PRIORITY length(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ ) ;
1267
1268 if ( wfNumRows( $res ) > 0 ) {
1269 $s = wfFetchObject( $res );
1270 $size = $s->x;
1271 if ( $s->cur_is_redirect OR $s->cur_namespace != 0 ) {
1272 $size = $threshold*2 ; # Really big
1273 }
1274 wfFreeResult( $res );
1275 } else {
1276 $size = $threshold*2 ; # Really big
1277 }
1278 } else {
1279 $size = 1 ;
1280 }
1281 if ( $size < $threshold ) {
1282 $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail );
1283 } else {
1284 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail );
1285 }
1286 }
1287 }
1288 return $retVal;
1289 }
1290
1291 # Pass a title object, not a title string
1292 function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1293 {
1294 global $wgOut, $wgTitle;
1295
1296 $fname = "Skin::makeKnownLinkObj";
1297 wfProfileIn( $fname );
1298
1299 $link = $nt->getPrefixedURL();
1300
1301 if ( "" == $link ) {
1302 $u = "";
1303 if ( "" == $text ) { $text = $nt->getFragment(); }
1304 } else {
1305 $u = wfLocalUrlE( $link, $query );
1306 }
1307 if ( "" != $nt->getFragment() ) {
1308 $u .= "#" . wfEscapeHTML( $nt->getFragment() );
1309 }
1310 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1311 $style = $this->getInternalLinkAttributesObj( $nt, $text );
1312
1313 $inside = "";
1314 if ( "" != $trail ) {
1315 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1316 $inside = $m[1];
1317 $trail = $m[2];
1318 }
1319 }
1320 $r = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1321 wfProfileOut( $fname );
1322 return $r;
1323 }
1324
1325 # Pass a title object, not a title string
1326 function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1327 {
1328 global $wgOut, $wgUser;
1329
1330 $fname = "Skin::makeBrokenLinkObj";
1331 wfProfileIn( $fname );
1332
1333 $link = $nt->getPrefixedURL();
1334
1335 if ( "" == $query ) { $q = "action=edit"; }
1336 else { $q = "action=edit&{$query}"; }
1337 $u = wfLocalUrlE( $link, $q );
1338
1339 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1340 $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
1341
1342 $inside = "";
1343 if ( "" != $trail ) {
1344 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1345 $inside = $m[1];
1346 $trail = $m[2];
1347 }
1348 }
1349 if ( $wgOut->isPrintable() ||
1350 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1351 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1352 } else {
1353 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
1354 }
1355
1356 wfProfileOut( $fname );
1357 return $s;
1358 }
1359
1360 # Pass a title object, not a title string
1361 function makeStubLinkObj( &$nt, $text = "", $query = "", $trail = "" )
1362 {
1363 global $wgOut, $wgUser;
1364
1365 $link = $nt->getPrefixedURL();
1366
1367 $u = wfLocalUrlE( $link, $query );
1368
1369 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1370 $style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
1371
1372 $inside = "";
1373 if ( "" != $trail ) {
1374 if ( preg_match( wfMsg("linktrail"), $trail, $m ) ) {
1375 $inside = $m[1];
1376 $trail = $m[2];
1377 }
1378 }
1379 if ( $wgOut->isPrintable() ||
1380 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1381 $s = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1382 } else {
1383 $s = "{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1384 }
1385 return $s;
1386 }
1387
1388 function fnamePart( $url )
1389 {
1390 $basename = strrchr( $url, "/" );
1391 if ( false === $basename ) { $basename = $url; }
1392 else { $basename = substr( $basename, 1 ); }
1393 return wfEscapeHTML( $basename );
1394 }
1395
1396 function makeImage( $url, $alt = "" )
1397 {
1398 global $wgOut;
1399
1400 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1401 $s = "<img src=\"{$url}\" alt=\"{$alt}\">";
1402 return $s;
1403 }
1404
1405 function makeImageLink( $name, $url, $alt = "" ) {
1406 $nt = Title::makeTitle( Namespace::getImage(), $name );
1407 return $this->makeImageLinkObj( $nt, $alt );
1408 }
1409
1410 function makeImageLinkObj( $nt, $alt = "" ) {
1411 $link = $nt->getPrefixedURL();
1412 $name = $nt->getDBKey();
1413 $url = wfImageUrl( $name );
1414 if ( empty( $alt ) ) {
1415 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1416 }
1417 $alt = htmlspecialchars( $alt );
1418
1419 $u = wfLocalUrlE( $link );
1420 $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
1421 "<img border=\"0\" src=\"{$url}\" alt=\"{$alt}\"></a>";
1422 return $s;
1423 }
1424
1425 function makeMediaLink( $name, $url, $alt = "" ) {
1426 $nt = Title::makeTitle( Namespace::getMedia(), $name );
1427 return $this->makeMediaLinkObj( $nt, $alt );
1428 }
1429
1430 function makeMediaLinkObj( $nt, $alt = "" )
1431 {
1432 $name = $nt->getDBKey();
1433 $url = wfImageUrl( $name );
1434 if ( empty( $alt ) ) {
1435 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1436 }
1437
1438 $u = htmlspecialchars( $url );
1439 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1440 return $s;
1441 }
1442
1443 function specialLink( $name, $key = "" )
1444 {
1445 global $wgLang;
1446
1447 if ( "" == $key ) { $key = strtolower( $name ); }
1448 $pn = $wgLang->ucfirst( $name );
1449 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1450 wfMsg( $key ) );
1451 }
1452
1453 # Called by history lists and recent changes
1454 #
1455
1456 function beginRecentChangesList()
1457 {
1458 $rc_cache = array() ;
1459 $rccc = 0 ;
1460 $this->lastdate = "";
1461 return "";
1462 }
1463
1464 function beginHistoryList()
1465 {
1466 $this->lastdate = $this->lastline = "";
1467 $s = "\n<p>" . wfMsg( "histlegend" ) . "\n<ul>";
1468 return $s;
1469 }
1470
1471 function beginImageHistoryList()
1472 {
1473 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1474 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul>";
1475 return $s;
1476 }
1477
1478 function endRecentChangesList()
1479 {
1480 $s = $this->recentChangesBlock() ;
1481 $s .= "</ul>\n";
1482 return $s;
1483 }
1484
1485 function endHistoryList()
1486 {
1487 $last = wfMsg( "last" );
1488
1489 $s = preg_replace( "/!OLDID![0-9]+!/", $last, $this->lastline );
1490 $s .= "</ul>\n";
1491 return $s;
1492 }
1493
1494 function endImageHistoryList()
1495 {
1496 $s = "</ul>\n";
1497 return $s;
1498 }
1499
1500 function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor )
1501 {
1502 global $wgLang;
1503
1504 $artname = Title::makeName( $ns, $ttl );
1505 $last = wfMsg( "last" );
1506 $cur = wfMsg( "cur" );
1507 $cr = wfMsg( "currentrev" );
1508
1509 if ( $oid && $this->lastline ) {
1510 $ret = preg_replace( "/!OLDID!([0-9]+)!/", $this->makeKnownLink(
1511 $artname, $last, "diff=\\1&oldid={$oid}" ), $this->lastline );
1512 } else {
1513 $ret = "";
1514 }
1515 $dt = $wgLang->timeanddate( $ts, true );
1516
1517 if ( $oid ) { $q = "oldid={$oid}"; }
1518 else { $q = ""; }
1519 $link = $this->makeKnownLink( $artname, $dt, $q );
1520
1521 if ( 0 == $u ) {
1522 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1523 $ut, "target=" . $ut );
1524 } else {
1525 $ul = $this->makeLink( $wgLang->getNsText(
1526 Namespace::getUser() ) . ":{$ut}", $ut ); }
1527
1528 $s = "<li>";
1529 if ( $oid ) {
1530 $curlink = $this->makeKnownLink( $artname, $cur,
1531 "diff=0&oldid={$oid}" );
1532 } else {
1533 $curlink = $cur;
1534 }
1535 $s .= "({$curlink}) (!OLDID!{$oid}!) . .";
1536
1537 $M = wfMsg( "minoreditletter" );
1538 if ( $isminor ) { $s .= " <strong>{$M}</strong>"; }
1539 $s .= " {$link} . . {$ul}";
1540
1541 if ( "" != $c && "*" != $c ) { $s .= " <em>(" . wfEscapeHTML($c) . ")</em>"; }
1542 $s .= "</li>\n";
1543
1544 $this->lastline = $s;
1545 return $ret;
1546 }
1547
1548 function recentChangesBlockLine ( $y ) {
1549 global $wgUploadPath ;
1550
1551 $M = wfMsg( "minoreditletter" );
1552 $N = wfMsg( "newpageletter" );
1553 $r = "" ;
1554 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>" ;
1555 $r .= "<tt>" ;
1556 if ( $y->isnew ) $r .= $N ;
1557 else $r .= "&nbsp;" ;
1558 if ( $y->isminor ) $r .= $M ;
1559 else $r .= "&nbsp;" ;
1560 $r .= " ".$y->timestamp." " ;
1561 $r .= "</tt>" ;
1562 $link = $y->link ;
1563 if ( $y->watched ) $link = "<strong>{$link}</strong>" ;
1564 $r .= $link ;
1565
1566 $r .= " (" ;
1567 $r .= $y->curlink ;
1568 $r .= "; " ;
1569 $r .= $this->makeKnownLink( $y->secureName, wfMsg( "hist" ), "action=history" );
1570
1571 $r .= ") . . ".$y->userlink ;
1572 $r .= $y->usertalklink ;
1573 if ( $y->usercomment != "" )
1574 $r .= " <em>(".wfEscapeHTML($y->usercomment).")</em>" ;
1575 $r .= "<br>\n" ;
1576 return $r ;
1577 }
1578
1579 function recentChangesBlockGroup ( $y ) {
1580 global $wgUploadPath ;
1581
1582 $r = "" ;
1583 $M = wfMsg( "minoreditletter" );
1584 $N = wfMsg( "newpageletter" );
1585 $isnew = false ;
1586 $userlinks = array () ;
1587 foreach ( $y AS $x ) {
1588 $oldid = $x->diffid ;
1589 if ( $x->isnew ) $isnew = true ;
1590 $u = $x->userlink ;
1591 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1592 $userlinks[$u]++ ;
1593 }
1594
1595 krsort ( $userlinks ) ;
1596 asort ( $userlinks ) ;
1597 $users = array () ;
1598 $u = array_keys ( $userlinks ) ;
1599 foreach ( $u as $x ) {
1600 $z = $x ;
1601 if ( $userlinks[$x] > 1 ) $z .= " ({$userlinks[$x]}&times;)" ;
1602 array_push ( $users , $z ) ;
1603 }
1604 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1605
1606 $e = $y ;
1607 $e = array_shift ( $e ) ;
1608
1609 # Arrow
1610 $rci = "RCI{$this->rccc}" ;
1611 $rcl = "RCL{$this->rccc}" ;
1612 $rcm = "RCM{$this->rccc}" ;
1613 $tl = "<a href='javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")'>" ;
1614 $tl .= "<span id='{$rcm}'><img src='{$wgUploadPath}/Arr_r.png' width=12 height=12 border=0></span>" ;
1615 $tl .= "<span id='{$rcl}' style='display:none'><img src='{$wgUploadPath}/Arr_d.png' width=12 height=12 border=0></span>" ;
1616 $tl .= "</a>" ;
1617 $r .= $tl ;
1618
1619 # Main line
1620 $r .= "<tt>" ;
1621 if ( $isnew ) $r .= $N ;
1622 else $r .= "&nbsp;" ;
1623 $r .= "&nbsp;" ; # Minor
1624 $r .= " ".$e->timestamp." " ;
1625 $r .= "</tt>" ;
1626
1627 $link = $e->link ;
1628 if ( $e->watched ) $link = "<strong>{$link}</strong>" ;
1629 $r .= $link ;
1630
1631 if ( !$e->islog ) {
1632 $r .= " (".count($y)." " ;
1633 if ( $isnew ) $r .= wfMsg("changes");
1634 else $r .= $this->makeKnownLink( $e->secureName , wfMsg("changes") , "diff=0&oldid=".$oldid ) ;
1635 $r .= "; " ;
1636 $r .= $this->makeKnownLink( $e->secureName, wfMsg( "history" ), "action=history" );
1637 $r .= ")" ;
1638 }
1639
1640 $r .= $users ;
1641 $r .= "<br>\n" ;
1642
1643 # Sub-entries
1644 $r .= "<div id='{$rci}' style='display:none'>" ;
1645 foreach ( $y AS $x )
1646 {
1647 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>";
1648 $r .= "<tt>&nbsp; &nbsp; &nbsp; &nbsp;" ;
1649 if ( $x->isnew ) $r .= $N ;
1650 else $r .= "&nbsp;" ;
1651 if ( $x->isminor ) $r .= $M ;
1652 else $r .= "&nbsp;" ;
1653 $r .= "</tt>" ;
1654
1655 $o = "" ;
1656 if ( $x->oldid != 0 ) $o = "oldid=".$x->oldid ;
1657 if ( $x->islog ) $link = $x->timestamp ;
1658 else $link = $this->makeKnownLink( $x->secureName, $x->timestamp , $o ) ;
1659 $link = "<tt>{$link}</tt>" ;
1660
1661
1662 $r .= $link ;
1663 $r .= " (" ;
1664 $r .= $x->curlink ;
1665 $r .= "; " ;
1666 $r .= $x->lastlink ;
1667 $r .= ") . . ".$x->userlink ;
1668 $r .= $x->usertalklink ;
1669 if ( $x->usercomment != "" )
1670 $r .= " <em>(".wfEscapeHTML($x->usercomment).")</em>" ;
1671 $r .= "<br>\n" ;
1672 }
1673 $r .= "</div>\n" ;
1674
1675 $this->rccc++ ;
1676 return $r ;
1677 }
1678
1679 function recentChangesBlock ()
1680 {
1681 global $wgUploadPath ;
1682 if ( count ( $this->rc_cache ) == 0 ) return "" ;
1683 $k = array_keys ( $this->rc_cache ) ;
1684 foreach ( $k AS $x )
1685 {
1686 $y = $this->rc_cache[$x] ;
1687 if ( count ( $y ) < 2 ) {
1688 $r .= $this->recentChangesBlockLine ( array_shift ( $y ) ) ;
1689 } else {
1690 $r .= $this->recentChangesBlockGroup ( $y ) ;
1691 }
1692 }
1693
1694 return "<div align=left>{$r}</div>" ;
1695 }
1696
1697 function recentChangesLine( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1698 {
1699 global $wgUser ;
1700 $usenew = $wgUser->getOption( "usenewrc" );
1701 if ( $usenew )
1702 $r = $this->recentChangesLineNew ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1703 else
1704 $r = $this->recentChangesLineOld ( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched , $oldid , $diffid ) ;
1705 return $r ;
1706 }
1707
1708 function recentChangesLineOld( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0, $diffid = 0 )
1709 {
1710 global $wgTitle, $wgLang, $wgUser;
1711
1712 $d = $wgLang->date( $ts, true);
1713 $s = "";
1714 if ( $d != $this->lastdate ) {
1715 if ( "" != $this->lastdate ) { $s .= "</ul>\n"; }
1716 $s .= "<h4>{$d}</h4>\n<ul>";
1717 $this->lastdate = $d;
1718 }
1719 $h = $wgLang->time( $ts, true );
1720 $t = Title::makeName( $ns, $ttl );
1721 $clink = $this->makeKnownLink( $t , "" );
1722 $nt = Title::newFromText( $t );
1723
1724 if ( $watched ) {
1725 $clink = "<strong>{$clink}</strong>";
1726 }
1727 $hlink = $this->makeKnownLink( $t, wfMsg( "hist" ), "action=history" );
1728 if ( $isnew || $nt->isLog() ) {
1729 $dlink = wfMsg( "diff" );
1730 } else {
1731 $dlink = $this->makeKnownLink( $t, wfMsg( "diff" ),
1732 "diff={$oldid}&oldid={$diffid}" ); # Finagle's law
1733 }
1734 if ( 0 == $u ) {
1735 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1736 $ut, "target=" . $ut );
1737 } else {
1738 $ul = $this->makeLink( $wgLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut );
1739 }
1740
1741 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1742 global $wgDisableAnonTalk;
1743 if( 0 == $u && $wgDisableAnonTalk ) {
1744 $utl = "";
1745 } else {
1746 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1747 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1748 }
1749 $cr = wfMsg( "currentrev" );
1750
1751 $s .= "<li> ({$dlink}) ({$hlink}) . .";
1752 $M = wfMsg( "minoreditletter" );
1753 $N = wfMsg( "newpageletter" );
1754 if ( $isminor ) { $s .= " <strong>{$M}</strong>"; }
1755 if ( $isnew ) { $s .= "<strong>{$N}</strong>"; }
1756 $s .= " {$clink}; {$h} . . {$ul}";
1757
1758 $blink="";
1759 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1760 $blink = $this->makeKnownLink( $wgLang->specialPage(
1761 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1762
1763 }
1764 if($blink) {
1765 if($utl) $utl .= " | ";
1766 $utl .= $blink;
1767 }
1768 if($utl) $s.=" ({$utl})";
1769
1770 if ( "" != $c && "*" != $c ) {
1771 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1772 }
1773 $s .= "</li>\n";
1774
1775 return $s;
1776 }
1777
1778 function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
1779 {
1780 global $wgTitle, $wgLang, $wgUser;
1781
1782 $rc = new RecentChangesClass ;
1783
1784 $d = $wgLang->date( $ts, true);
1785 $s = "";
1786 $ret = "" ;
1787 if ( $d != $this->lastdate ) {
1788 $ret = $this->recentChangesBlock () ;
1789 $this->rc_cache = array() ;
1790 $ret .= "<h4>{$d}</h4>\n";
1791 $this->lastdate = $d;
1792 }
1793 $h = $wgLang->time( $ts, true );
1794 $t = Title::makeName( $ns, $ttl );
1795 $clink = $this->makeKnownLink( $t, "" ) ;
1796 if ( $oldid == 0 ) $c2link = $clink ;
1797 else $c2link = $this->makeKnownLink( $t, "" , "oldid={$oldid}" );
1798 $nt = Title::newFromText( $t );
1799
1800 $rc->timestamp = $h ;
1801 $rc->oldid = $oldid ;
1802 $rc->diffid = $diffid ;
1803 $rc->watched = $watched ;
1804 $rc->isnew = $isnew ;
1805 $rc->isminor = $isminor ;
1806 $rc->secureName = $t ;
1807 $rc->displayName = $nt ;
1808 $rc->link = $clink ;
1809 $rc->usercomment = $c ;
1810 $rc->islog = $nt->isLog() ;
1811
1812 if ( ( $isnew && $oldid == 0 ) || $nt->isLog() ) {
1813 $dlink = wfMsg( "cur" );
1814 } else {
1815 $dlink = $this->makeKnownLink( $t, wfMsg( "cur" ),
1816 "diff=0&oldid={$oldid}" );
1817 }
1818
1819 if ( $diffid == 0 || $nt->isLog() ) {
1820 $plink = wfMsg( "last" );
1821 } else {
1822 $plink = $this->makeKnownLink( $t, wfMsg( "last" ),
1823 "diff={$oldid}&oldid={$diffid}" );
1824 }
1825
1826 if ( 0 == $u ) {
1827 $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1828 $ut, "target=" . $ut );
1829 } else { $ul = $this->makeLink( $wgLang->getNsText(
1830 Namespace::getUser() ) . ":{$ut}", $ut ); }
1831
1832 $rc->userlink = $ul ;
1833 $rc->lastlink = $plink ;
1834 $rc->curlink = $dlink ;
1835
1836 $utns=$wgLang->getNsText(Namespace::getTalk(Namespace::getUser()));
1837 $talkname=$wgLang->getNsText(Namespace::getTalk(0)); # use the shorter name
1838 $utl= $this->makeLink($utns . ":{$ut}", $talkname );
1839
1840 global $wgDisableAnonTalk;
1841 if ( ( 0 == $u ) && $wgUser->isSysop() ) {
1842 $blink = $this->makeKnownLink( $wgLang->specialPage(
1843 "Blockip" ), wfMsg( "blocklink" ), "ip={$ut}" );
1844 if( $wgDisableAnonTalk )
1845 $rc->usertalklink = " ({$blink})";
1846 else
1847 $rc->usertalklink = " ({$utl} | {$blink})";
1848 } else {
1849 if( $wgDisableAnonTalk && ($u == 0) )
1850 $rc->usertalklink = "";
1851 else
1852 $rc->usertalklink = " ({$utl})";
1853 }
1854
1855 if ( !isset ( $this->rc_cache[$t] ) ) $this->rc_cache[$t] = array() ;
1856 array_push ( $this->rc_cache[$t] , $rc ) ;
1857 return $ret;
1858 }
1859
1860
1861 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
1862 {
1863 global $wgUser, $wgLang, $wgTitle;
1864
1865 $dt = $wgLang->timeanddate( $ts, true );
1866 $del = wfMsg( "deleteimg" );
1867 $cur = wfMsg( "cur" );
1868
1869 if ( $iscur ) {
1870 $url = wfImageUrl( $img );
1871 $rlink = $cur;
1872 if ( $wgUser->isSysop() ) {
1873 $link = wfLocalUrlE( $wgTitle->getPrefixedText(), "image=" . $wgTitle->getURL() .
1874 "&action=delete" );
1875 $style = $this->getInternalLinkAttributes( $link, $del );
1876
1877 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
1878 } else {
1879 $dlink = $del;
1880 }
1881 } else {
1882 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
1883 if( $wgUser->getID() != 0 ) {
1884 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1885 wfMsg( "revertimg" ), "action=revert&oldimage=" .
1886 urlencode( $img ) );
1887 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1888 $del, "action=delete&oldimage=" . urlencode( $img ) );
1889 } else {
1890 # Having live active links for non-logged in users
1891 # means that bots and spiders crawling our site can
1892 # inadvertently change content. Baaaad idea.
1893 $rlink = wfMsg( "revertimg" );
1894 $dlink = $del;
1895 }
1896 }
1897 if ( 0 == $u ) { $ul = $ut; }
1898 else { $ul = $this->makeLink( $wgLang->getNsText(
1899 Namespace::getUser() ) . ":{$ut}", $ut ); }
1900
1901 $nb = wfMsg( "nbytes", $size );
1902 $style = $this->getInternalLinkAttributes( $url, $dt );
1903
1904 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
1905 . " . . {$ul} ({$nb})";
1906
1907 if ( "" != $c && "*" != $c ) {
1908 $s .= " <em>(" . wfEscapeHTML( $c ) . ")</em>";
1909 }
1910 $s .= "</li>\n";
1911 return $s;
1912 }
1913
1914 function tocIndent($level) {
1915
1916 while($level-->0) $rv.="<div style=\"margin-left:2em;\">\n";
1917 return $rv;
1918
1919 }
1920
1921 function tocUnindent($level) {
1922 while($level-->0) $rv.="</div>\n";
1923 return $rv;
1924 }
1925
1926 // parameter level defines if we are on an indentation level
1927 function tocLine($anchor,$tocline,$level) {
1928
1929 if($level) {
1930
1931 return "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n";
1932 } else {
1933
1934 return "<div style=\"margin-bottom:0px;\">\n".
1935 "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n".
1936 "</div>\n";
1937 }
1938
1939 }
1940
1941 function tocTable($toc) {
1942 // note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
1943 global $printable;
1944
1945 if (!$printable) {
1946 $hideline = " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>";
1947 }
1948 return
1949 "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
1950 "<b>".wfMsg("toc")."</b>" .
1951 $hideline .
1952 "</td></tr><tr id='tocinside'><td align=\"left\">\n".
1953 $toc."</td></tr></table><P>\n";
1954 }
1955
1956 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
1957 function editSectionScript($section,$head) {
1958
1959 global $wgTitle,$wgUser,$oldid;
1960 if($oldid) return $head;
1961 $url = wfLocalUrlE(urlencode($wgTitle->getPrefixedText()),"action=edit&section=$section");
1962 return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
1963 }
1964
1965 function editSectionLink($section) {
1966
1967 global $printable;
1968 global $wgTitle,$wgUser,$oldid;
1969 if($oldid) return "";
1970 if ($printable) return "";
1971 $editurl="&section={$section}";
1972 $url=$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
1973 return "<div style=\"float:right;margin-left:5px;\"><small>[".$url."]</small></div>";
1974
1975 }
1976 }
1977
1978 include_once( "SkinStandard.php" );
1979 include_once( "SkinNostalgia.php" );
1980 include_once( "SkinCologneBlue.php" );
1981
1982 #include_once( "SkinSmarty.php" );
1983
1984 ?>