3 include_once( "Feed.php" );
7 # These are the INTERNAL names, which get mapped
8 # directly to class names. For display purposes, the
9 # Language class has internationalized names
11 /* private */ $wgValidSkinNames = array(
12 "Standard", "Nostalgia", "CologneBlue"
15 $wgValidSkinNames[] = "Smarty";
16 $wgValidSkinNames[] = "Montparnasse";
19 #$wgValidSkinNames[] = "PHPTal";
20 $wgValidSkinNames[] = "DaVinci";
23 include_once( "RecentChange.php" );
25 # For some odd PHP bug, this function can't be part of a class
26 function getCategories ()
28 global $wgOut , $wgTitle , $wgUseCategoryMagic , $wgUser , $wgParser ;
29 if ( !isset ( $wgUseCategoryMagic ) ||
!$wgUseCategoryMagic ) return "" ;
30 if ( count ( $wgParser->mCategoryLinks
) == 0 ) return "" ;
31 if ( !$wgOut->isArticle() ) return "" ;
32 $sk = $wgUser->getSkin() ;
35 $s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ;
36 $t = implode ( " | " , $wgParser->mCategoryLinks
) ;
37 if ( $t != "" ) $s .= " : " ;
42 class RCCacheEntry
extends RecentChange
44 var $secureName, $link;
45 var $curlink , $lastlink , $usertalklink , $versionlink ;
46 var $userlink, $timestamp, $watched;
48 function newFromParent( $rc )
50 $rc2 = new RCCacheEntry
;
51 $rc2->mAttribs
= $rc->mAttribs
;
52 $rc2->mExtra
= $rc->mExtra
;
59 /* private */ var $lastdate, $lastline;
60 var $linktrail ; # linktrail regexp
61 var $rc_cache ; # Cache for Enhanced Recent Changes
62 var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
67 $this->linktrail
= wfMsg("linktrail");
70 function getSkinNames()
72 global $wgValidSkinNames;
73 return $wgValidSkinNames;
76 function getStylesheet()
78 return "wikistandard.css";
83 global $wgOut, $wgUser;
85 if ( $wgOut->isQuickbarSuppressed() ) { return 0; }
86 $q = $wgUser->getOption( "quickbar" );
87 if ( "" == $q ) { $q = 0; }
91 function initPage( &$out )
93 global $wgStyleSheetPath;
94 $fname = "Skin::initPage";
95 wfProfileIn( $fname );
97 $out->addLink( "shortcut icon", "", "/favicon.ico" );
99 wfProfileOut( $fname );
102 function outputPage( &$out ) {
103 global $wgDebugComments;
105 wfProfileIn( "Skin::outputPage" );
106 $this->initPage( $out );
107 $out->out( $out->headElement() );
109 $out->out( "\n<body" );
110 $ops = $this->getBodyOptions();
111 foreach ( $ops as $name => $val ) {
112 $out->out( " $name='$val'" );
115 if ( $wgDebugComments ) {
116 $out->out( "<!-- Wiki debugging output:\n" .
117 $out->mDebugtext
. "-->\n" );
119 $out->out( $this->beforeContent() );
121 $out->out( $out->mBodytext
);
123 $out->out( $this->afterContent() );
126 $out->out( $out->reportTime() );
128 $out->out( "\n</body></html>" );
131 function getHeadScripts() {
132 global $wgStyleSheetPath;
133 $r = "<script type=\"text/javascript\" src=\"{$wgStyleSheetPath}/wikibits.js\"></script>\n";
137 function getUserStyles()
139 global $wgOut, $wgStyleSheetPath;
140 $sheet = $this->getStylesheet();
141 $s = "<style type='text/css'><!--\n";
142 $s .= "/*/*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
143 $s .= "@import url(\"$wgStyleSheetPath/$sheet\");\n";
144 $s .= $this->doGetUserStyles();
146 $s .= "//--></style>\n";
150 function doGetUserStyles()
155 if ( 1 == $wgUser->getOption( "underline" ) ) {
156 # Don't override browser settings
160 $s .= "a.stub, a.new, a.internal, a.external { " .
161 "text-decoration: none; }\n";
163 if ( 1 == $wgUser->getOption( "highlightbroken" ) ) {
164 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
166 if ( 1 == $wgUser->getOption( "justify" ) ) {
167 $s .= "#article { text-align: justify; }\n";
172 function getBodyOptions()
174 global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $oldid, $redirect, $diff,$action;
176 if ( 0 != $wgTitle->getNamespace() ) {
177 $a = array( "bgcolor" => "#ffffec" );
179 else $a = array( "bgcolor" => "#FFFFFF" );
180 if($wgOut->isArticle() && $wgUser->getOption("editondblclick")
182 (!$wgTitle->isProtected() ||
$wgUser->isSysop())
185 $t = wfMsg( "editthispage" );
187 if ( $redirect ) { $red = "&redirect={$redirect}"; }
188 if ( $oldid && ! isset( $diff ) ) {
189 $oid = "&oldid={$oldid}";
191 $s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" );
192 $s = "document.location = \"" .$s ."\";";
193 $a +
= array ("ondblclick" => $s);
196 $a['onload'] = $wgOut->getOnloadHandler();
200 function getExternalLinkAttributes( $link, $text )
202 global $wgUser, $wgOut, $wgLang;
204 $link = urldecode( $link );
205 $link = $wgLang->checkTitleEncoding( $link );
206 $link = str_replace( "_", " ", $link );
207 $link = wfEscapeHTML( $link );
209 $r = " class='external'";
211 if ( 1 == $wgUser->getOption( "hover" ) ) {
212 $r .= " title=\"{$link}\"";
217 function getInternalLinkAttributes( $link, $text, $broken = false )
219 global $wgUser, $wgOut;
221 $link = urldecode( $link );
222 $link = str_replace( "_", " ", $link );
223 $link = wfEscapeHTML( $link );
225 if ( $broken == "stub" ) {
226 $r = " class='stub'";
227 } else if ( $broken == "yes" ) {
233 if ( 1 == $wgUser->getOption( "hover" ) ) {
234 $r .= " title=\"{$link}\"";
239 function getInternalLinkAttributesObj( &$nt, $text, $broken = false )
241 global $wgUser, $wgOut;
243 if ( $broken == "stub" ) {
244 $r = " class='stub'";
245 } else if ( $broken == "yes" ) {
251 if ( 1 == $wgUser->getOption( "hover" ) ) {
252 $r .= ' title ="' . $nt->getEscapedText() . '"';
263 # This will be called immediately after the <body> tag. Split into
264 # two functions to make it easier to subclass.
266 function beforeContent()
268 global $wgUser, $wgOut, $wgSiteNotice;
270 if( $wgSiteNotice ) {
271 $note = "\n<div id='notice' style='font-weight: bold; color: red; text-align: center'>$wgSiteNotice</div>\n";
275 return $this->doBeforeContent() . $note;
278 function doBeforeContent()
280 global $wgUser, $wgOut, $wgTitle, $wgLang;
281 $fname = "Skin::doBeforeContent";
282 wfProfileIn( $fname );
285 $qb = $this->qbSetting();
287 if( $langlinks = $this->otherLanguages() ) {
293 $borderhack = "class='top'";
296 $s .= "\n<div id='content'>\n<div id='topbar'>" .
297 "<table border=0 cellspacing=0><tr>";
300 $left = ($qb == 1 ||
$qb == 3);
301 if($wgLang->isRTL()) $left = !$left;
304 $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>" .
305 $this->logoText() . "</td>";
307 $s .= $this->getQuickbarCompensator( $rows );
309 $l = $wgLang->isRTL() ?
"right" : "left";
310 $s .= "<td {$borderhack} align='$l' valign='top'>";
312 $s .= $this->topLinks() ;
313 $s .= "<p class='subtitle'>" . $this->pageTitleLinks();
315 $r = $wgLang->isRTL() ?
"left" : "right";
316 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap>";
317 $s .= $this->nameAndLogin();
318 $s .= "\n<br>" . $this->searchForm() . "</td>";
321 $s .= "</tr>\n<tr><td class='top' colspan=\"2\">$langlinks</td>";
324 if ( $shove && !$left ) { # Right
325 $s .= $this->getQuickbarCompensator( $rows );
327 $s .= "</tr></table>\n</div>\n";
328 $s .= "\n<div id='article'>";
330 $s .= $this->pageTitle();
331 $s .= $this->pageSubtitle() ;
332 $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
334 wfProfileOut( $fname );
338 function getQuickbarCompensator( $rows = 1 )
340 return "<td width='152' rowspan='{$rows}'> </td>";
343 # This gets called immediately before the </body> tag.
345 function afterContent()
347 global $wgUser, $wgOut, $wgServer;
348 global $wgTitle, $wgLang;
350 $printfooter = "<div class=\"printfooter\">" . $this->printFooter() . "</div>\n";
351 return $printfooter . $this->doAfterContent();
354 function printFooter() {
356 $url = htmlspecialchars( $wgTitle->getFullURL() );
357 return "<p>" . wfMsg( "retrievedfrom", "<a href=\"$url\">$url</a>" ) .
358 "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
361 function doAfterContent()
363 global $wgUser, $wgOut, $wgLang;
364 $fname = "Skin::doAfterContent";
365 wfProfileIn( $fname );
366 wfProfileIn( "$fname-1" );
368 $s = "\n</div><br clear=all>\n";
369 $s .= "\n<div id='footer'>";
370 $s .= "<table border=0 cellspacing=0><tr>";
372 wfProfileOut( "$fname-1" );
373 wfProfileIn( "$fname-2" );
375 $qb = $this->qbSetting();
377 $left = ($qb == 1 ||
$qb == 3);
378 if($wgLang->isRTL()) $left = !$left;
380 if ( $shove && $left ) { # Left
381 $s .= $this->getQuickbarCompensator();
383 wfProfileOut( "$fname-2" );
384 wfProfileIn( "$fname-3" );
385 $l = $wgLang->isRTL() ?
"right" : "left";
386 $s .= "<td class='bottom' align='$l' valign='top'>";
388 $s .= $this->bottomLinks();
389 $s .= "\n<br>" . $this->mainPageLink()
390 . " | " . $this->aboutLink()
391 . " | " . $this->specialLink( "recentchanges" )
392 . " | " . $this->searchForm()
393 . "<br><span id='pagestats'>" . $this->pageStats() . "</span>";
396 if ( $shove && !$left ) { # Right
397 $s .= $this->getQuickbarCompensator();
399 $s .= "</tr></table>\n</div>\n</div>\n";
401 wfProfileOut( "$fname-3" );
402 wfProfileIn( "$fname-4" );
403 if ( 0 != $qb ) { $s .= $this->quickBar(); }
404 wfProfileOut( "$fname-4" );
405 wfProfileOut( $fname );
409 function pageTitleLinks()
411 global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval;
413 $s = $this->printableLink();
414 if ( wfMsg ( "disclaimers" ) != "-" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
416 if ( $wgOut->isArticleRelated() ) {
417 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
418 $name = $wgTitle->getDBkey();
419 $link = wfEscapeHTML( wfImageUrl( $name ) );
420 $style = $this->getInternalLinkAttributes( $link, $name );
421 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
423 # This will show the "Approve" link if $wgUseApproval=true;
424 if ( isset ( $wgUseApproval ) && $wgUseApproval )
426 $t = $wgTitle->getDBkey();
427 $name = "Approve this article" ;
428 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
429 #wfEscapeHTML( wfImageUrl( $name ) );
430 $style = $this->getExternalLinkAttributes( $link, $name );
431 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
434 if ( "history" == $action ||
isset( $diff ) ||
isset( $oldid ) ) {
435 $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
436 wfMsg( "currentrev" ) );
439 if ( $wgUser->getNewtalk() ) {
440 # do not show "You have new messages" text when we are viewing our
443 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
444 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
445 $n =$wgUser->getName();
446 $tl = $this->makeKnownLink( $wgLang->getNsText(
447 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
448 wfMsg("newmessageslink") );
449 $s.=" | <strong>". wfMsg( "newmessages", $tl ) . "</strong>";
452 if( $wgUser->isSysop() &&
453 (($wgTitle->getArticleId() == 0) ||
($action == "history")) &&
454 ($n = $wgTitle->isDeleted() ) ) {
455 $s .= " | " . wfMsg( "thisisdeleted",
456 $this->makeKnownLink(
457 $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
458 wfMsg( "restorelink", $n ) ) );
463 function printableLink()
465 global $wgOut, $wgFeedClasses, $wgRequest;
467 $baseurl = $_SERVER['REQUEST_URI'];
468 if( strpos( "?", $baseurl ) == false ) {
473 $baseurl = htmlspecialchars( $baseurl );
474 $printurl = $wgRequest->escapeAppendQuery( "printable=yes" );
476 $s = "<a href=\"$printurl\">" . wfMsg( "printableversion" ) . "</a>";
477 if( $wgOut->isSyndicated() ) {
478 foreach( $wgFeedClasses as $format => $class ) {
479 $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
480 $s .= " | <a href=\"$feedurl\">{$format}</a>";
488 global $wgOut, $wgTitle, $wgUser;
490 $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
491 if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
495 function pageSubtitle()
497 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
499 $sub = $wgOut->getSubtitle();
501 global $wgExtraSubtitle;
502 $sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
504 if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
505 $ptext=$wgTitle->getPrefixedText();
506 if(preg_match("/\//",$ptext)) {
507 $sub.="</p><p class='subpages'>";
508 $links=explode("/",$ptext);
511 foreach($links as $link) {
513 if ($c<count($links)) {
514 $growinglink .= $link;
515 $getlink = $this->makeLink( $growinglink, $link );
516 if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
529 $s = "<p class='subtitle'>{$sub}\n";
533 function nameAndLogin()
535 global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader, $wgIP;
537 $li = $wgLang->specialPage( "Userlogin" );
538 $lo = $wgLang->specialPage( "Userlogout" );
541 if ( 0 == $wgUser->getID() ) {
542 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
545 $tl = $this->makeKnownLink( $wgLang->getNsText(
546 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
547 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
549 $s .= $n . " (".$tl.")";
551 $s .= wfMsg("notloggedin");
554 $rt = $wgTitle->getPrefixedURL();
555 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
557 } else { $q = "returnto={$rt}"; }
559 $s .= "\n<br>" . $this->makeKnownLink( $li,
560 wfMsg( "login" ), $q );
562 $n = $wgUser->getName();
563 $rt = $wgTitle->getPrefixedURL();
564 $tl = $this->makeKnownLink( $wgLang->getNsText(
565 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
566 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
570 $s .= $this->makeKnownLink( $wgLang->getNsText(
571 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br>" .
572 $this->makeKnownLink( $lo, wfMsg( "logout" ),
573 "returnto={$rt}" ) . " | " .
574 $this->specialLink( "preferences" );
576 $s .= " | " . $this->makeKnownLink( wfMsg( "helppage" ),
582 function searchForm()
586 $s = "<form name='search' class='inline' method=post action=\""
587 . wfLocalUrl( "" ) . "\">"
588 . "<input type=text name=\"search\" size=19 value=\""
589 . htmlspecialchars(substr($search,0,256)) . "\">\n"
590 . "<input type=submit name=\"go\" value=\"" . wfMsg ("go") . "\"> "
591 . "<input type=submit name=\"fulltext\" value=\"" . wfMsg ("search") . "\"></form>";
601 $s = $this->mainPageLink() . $sep
602 . $this->specialLink( "recentchanges" );
604 if ( $wgOut->isArticleRelated() ) {
605 $s .= $sep . $this->editThisPage()
606 . $sep . $this->historyLink();
608 # Many people don't like this dropdown box
609 #$s .= $sep . $this->specialPagesList();
614 function bottomLinks()
616 global $wgOut, $wgUser, $wgTitle;
620 if ( $wgOut->isArticleRelated() ) {
621 $s .= "<strong>" . $this->editThisPage() . "</strong>";
622 if ( 0 != $wgUser->getID() ) {
623 $s .= $sep . $this->watchThisPage();
625 $s .= $sep . $this->talkLink()
626 . $sep . $this->historyLink()
627 . $sep . $this->whatLinksHere()
628 . $sep . $this->watchPageLinksLink();
630 if ( $wgTitle->getNamespace() == Namespace::getUser()
631 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
634 $id=User
::idFromName($wgTitle->getText());
635 $ip=User
::isIP($wgTitle->getText());
637 if($id ||
$ip) { # both anons and non-anons have contri list
638 $s .= $sep . $this->userContribsLink();
640 if ( 0 != $wgUser->getID() ) { # show only to signed in users
641 if($id) { # can only email non-anons
642 $s .= $sep . $this->emailUserLink();
646 if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
647 $s .= "\n<br>" . $this->deleteThisPage() .
648 $sep . $this->protectThisPage() .
649 $sep . $this->moveThisPage();
651 $s .= "<br>\n" . $this->otherLanguages();
658 global $wgOut, $wgLang, $wgArticle;
659 global $oldid, $diff, $wgDisableCounters;
661 if ( ! $wgOut->isArticle() ) { return ""; }
662 if ( isset( $oldid ) ||
isset( $diff ) ) { return ""; }
663 if ( 0 == $wgArticle->getID() ) { return ""; }
665 if ( $wgDisableCounters ) {
668 $count = $wgLang->formatNum( $wgArticle->getCount() );
669 $s = wfMsg( "viewcount", $count );
671 $s .= $this->lastModified();
672 $s .= " " . wfMsg( "gnunote" );
676 function lastModified()
678 global $wgLang, $wgArticle;
680 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
681 $s = " " . wfMsg( "lastmodified", $d );
685 function logoText( $align = "" )
687 if ( "" != $align ) { $a = " align='{$align}'"; }
690 $mp = wfMsg( "mainpage" );
691 $titleObj = Title
::newFromText( $mp );
692 $s = "<a href=\"" . $titleObj->escapeLocalURL()
693 . "\"><img{$a} border=0 src=\""
694 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\" /></a>";
700 global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
701 global $wpPreview, $wgDisableUploads, $wgRemoteUploads;
703 $fname = "Skin::quickBar";
704 wfProfileIn( $fname );
706 $tns=$wgTitle->getNamespace();
708 $s = "\n<div id='quickbar'>";
709 $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
712 $s .= $this->mainPageLink()
713 . $sep . $this->specialLink( "recentchanges" )
714 . $sep . $this->specialLink( "randompage" );
715 if ($wgUser->getID()) {
716 $s.= $sep . $this->specialLink( "watchlist" ) ;
717 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
718 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
721 // only show watchlist link if logged in
722 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
723 $s .= "\n<br><hr class='sep'>";
724 $articleExists = $wgTitle->getArticleId();
725 if ( $wgOut->isArticle() ||
$action =="edit" ||
$action =="history" ||
$wpPreview) {
726 if($wgOut->isArticle()) {
727 $s .= "<strong>" . $this->editThisPage() . "</strong>";
728 } else { # backlink to the article in edit or history mode
729 if($articleExists){ # no backlink if no article
732 $text = wfMsg("articlepage");
735 $text = wfMsg("viewtalkpage");
738 $text = wfMsg("userpage");
741 $text = wfMsg("viewtalkpage");
744 $text = wfMsg("wikipediapage");
747 $text = wfMsg("viewtalkpage");
750 $text = wfMsg("imagepage");
753 $text = wfMsg("viewtalkpage");
756 $text= wfMsg("articlepage");
759 $link = $wgTitle->getText();
760 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
761 $link = $nstext . ":" . $link ;
764 $s .= $this->makeLink( $link, $text );
765 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
766 # we just throw in a "New page" text to tell the user that he's in edit mode,
767 # and to avoid messing with the separator that is prepended to the next item
768 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
774 if( $tns%2
&& $action!="edit" && !$wpPreview) {
775 $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
779 watching could cause problems in edit mode:
780 if user edits article, then loads "watch this article" in background and then saves
781 article with "Watch this article" checkbox disabled, the article is transparently
782 unwatched. Therefore we do not show the "Watch this page" link in edit mode
784 if ( 0 != $wgUser->getID() && $articleExists) {
785 if($action!="edit" && $action != "submit" )
787 $s .= $sep . $this->watchThisPage();
789 if ( $wgTitle->userCanEdit() )
790 $s .= $sep . $this->moveThisPage();
792 if ( $wgUser->isSysop() and $articleExists ) {
793 $s .= $sep . $this->deleteThisPage() .
794 $sep . $this->protectThisPage();
796 $s .= $sep . $this->talkLink();
797 if ($articleExists && $action !="history") {
798 $s .= $sep . $this->historyLink();
800 $s.=$sep . $this->whatLinksHere();
802 if($wgOut->isArticleRelated()) {
803 $s .= $sep . $this->watchPageLinksLink();
806 if ( Namespace::getUser() == $wgTitle->getNamespace()
807 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
810 $id=User
::idFromName($wgTitle->getText());
811 $ip=User
::isIP($wgTitle->getText());
814 $s .= $sep . $this->userContribsLink();
816 if ( 0 != $wgUser->getID() ) {
817 if($id) { # can only email real users
818 $s .= $sep . $this->emailUserLink();
822 $s .= "\n<br><hr class='sep'>";
825 if ( 0 != $wgUser->getID() && ( !$wgDisableUploads ||
$wgRemoteUploads ) ) {
826 $s .= $this->specialLink( "upload" ) . $sep;
828 $s .= $this->specialLink( "specialpages" )
829 . $sep . $this->bugReportsLink();
831 global $wgSiteSupportPage;
832 if( $wgSiteSupportPage ) {
833 $s .= "\n<br><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
834 "\" class=\"internal\">" . wfMsg( "sitesupport" ) . "</a>";
837 $s .= "\n<br></div>\n";
838 wfProfileOut( $fname );
842 function specialPagesList()
844 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
847 $validSP = $wgLang->getValidSpecialPages();
849 foreach ( $validSP as $name => $desc ) {
850 if ( "" == $desc ) { continue; }
853 if ( $wgUser->isSysop() )
855 $sysopSP = $wgLang->getSysopSpecialPages();
857 foreach ( $sysopSP as $name => $desc ) {
858 if ( "" == $desc ) { continue; }
862 if ( $wgUser->isDeveloper() )
864 $devSP = $wgLang->getDeveloperSpecialPages();
866 foreach ( $devSP as $name => $desc ) {
867 if ( "" == $desc ) { continue; }
872 $sp = wfMsg( "specialpages" );
873 $spp = $wgLang->specialPage( "Specialpages" );
875 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
876 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
877 $s .= "<select name=\"wpDropdown\">\n";
878 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
880 foreach ( $a as $name => $desc ) {
881 $p = $wgLang->specialPage( $name );
882 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
885 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
890 function mainPageLink()
892 $mp = wfMsg( "mainpage" );
893 $s = $this->makeKnownLink( $mp, $mp );
897 function copyrightLink()
899 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
900 wfMsg( "copyrightpagename" ) );
906 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
907 wfMsg( "aboutwikipedia" ) );
912 function disclaimerLink()
914 $s = $this->makeKnownLink( wfMsg( "disclaimerpage" ),
915 wfMsg( "disclaimers" ) );
919 function editThisPage()
921 global $wgOut, $wgTitle, $oldid, $redirect, $diff;
923 if ( ! $wgOut->isArticleRelated() ) {
924 $s = wfMsg( "protectedpage" );
926 $n = $wgTitle->getPrefixedText();
927 if ( $wgTitle->userCanEdit() ) {
928 $t = wfMsg( "editthispage" );
930 #$t = wfMsg( "protectedpage" );
931 $t = wfMsg( "viewsource" );
935 if ( $redirect ) { $red = "&redirect={$redirect}"; }
936 if ( $oldid && ! isset( $diff ) ) {
937 $oid = "&oldid={$oldid}";
939 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
944 function deleteThisPage()
946 global $wgUser, $wgOut, $wgTitle, $diff;
948 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
949 $n = $wgTitle->getPrefixedText();
950 $t = wfMsg( "deletethispage" );
952 $s = $this->makeKnownLink( $n, $t, "action=delete" );
959 function protectThisPage()
961 global $wgUser, $wgOut, $wgTitle, $diff;
963 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
964 $n = $wgTitle->getPrefixedText();
966 if ( $wgTitle->isProtected() ) {
967 $t = wfMsg( "unprotectthispage" );
968 $q = "action=unprotect";
970 $t = wfMsg( "protectthispage" );
971 $q = "action=protect";
973 $s = $this->makeKnownLink( $n, $t, $q );
980 function watchThisPage()
982 global $wgUser, $wgOut, $wgTitle, $diff;
984 if ( $wgOut->isArticleRelated() ) {
985 $n = $wgTitle->getPrefixedText();
987 if ( $wgTitle->userIsWatching() ) {
988 $t = wfMsg( "unwatchthispage" );
989 $q = "action=unwatch";
991 $t = wfMsg( "watchthispage" );
994 $s = $this->makeKnownLink( $n, $t, $q );
996 $s = wfMsg( "notanarticle" );
1001 function moveThisPage()
1003 global $wgTitle, $wgLang;
1005 if ( $wgTitle->userCanEdit() ) {
1006 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
1007 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
1008 } // no message if page is protected - would be redundant
1012 function historyLink()
1016 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1017 wfMsg( "history" ), "action=history" );
1021 function whatLinksHere()
1023 global $wgTitle, $wgLang;
1025 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
1026 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
1030 function userContribsLink()
1032 global $wgTitle, $wgLang;
1034 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1035 wfMsg( "contributions" ), "target=" . $wgTitle->getPartialURL() );
1039 function emailUserLink()
1041 global $wgTitle, $wgLang;
1043 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
1044 wfMsg( "emailuser" ), "target=" . $wgTitle->getPartialURL() );
1048 function watchPageLinksLink()
1050 global $wgOut, $wgTitle, $wgLang;
1052 if ( ! $wgOut->isArticleRelated() ) {
1053 $s = "(" . wfMsg( "notanarticle" ) . ")";
1055 $s = $this->makeKnownLink( $wgLang->specialPage(
1056 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
1057 "target=" . $wgTitle->getPrefixedURL() );
1062 function otherLanguages()
1064 global $wgOut, $wgLang, $wgTitle, $wgUseNewInterlanguage;
1066 $a = $wgOut->getLanguageLinks();
1068 if ( 0 == count( $a ) ) {
1069 if ( !$wgUseNewInterlanguage ) return "";
1070 $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
1071 if ( $ns != 0 AND $ns != 1 ) return "" ;
1073 $x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
1074 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1075 wfMsg( "intl" ) , $x );
1078 if ( !$wgUseNewInterlanguage ) {
1079 $s = wfMsg( "otherlanguages" ) . ": ";
1081 global $wgLanguageCode ;
1082 $x = "mode=zoom&xt=".$wgTitle->getDBkey() ;
1083 $x .= "&xl=".$wgLanguageCode ;
1084 $s = $this->makeKnownLink( $wgLang->specialPage( "Intl" ),
1085 wfMsg( "otherlanguages" ) , $x ) . ": " ;
1088 $s = wfMsg( "otherlanguages" ) . ": ";
1090 if($wgLang->isRTL()) $s .= "<span dir='LTR'>";
1091 foreach( $a as $l ) {
1092 if ( ! $first ) { $s .= " | "; }
1095 $nt = Title
::newFromText( $l );
1096 $url = $nt->getFullURL();
1097 $text = $wgLang->getLanguageName( $nt->getInterwiki() );
1099 if ( "" == $text ) { $text = $l; }
1100 $style = $this->getExternalLinkAttributes( $l, $text );
1101 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
1103 if($wgLang->isRTL()) $s .= "</span>";
1107 function bugReportsLink()
1109 $s = $this->makeKnownLink( wfMsg( "bugreportspage" ),
1110 wfMsg( "bugreports" ) );
1116 global $wgLinkCache;
1117 $t1 = Title
::newFromText( gmdate( "F j" ) );
1118 $t2 = Title
::newFromText( gmdate( "Y" ) );
1120 $wgLinkCache->suspend();
1121 $id = $t1->getArticleID();
1122 $wgLinkCache->resume();
1125 $s = $this->makeBrokenLink( $t1->getText() );
1127 $s = $this->makeKnownLink( $t1->getText() );
1131 $wgLinkCache->suspend();
1132 $id = $t2->getArticleID();
1133 $wgLinkCache->resume();
1136 $s .= $this->makeBrokenLink( $t2->getText() );
1138 $s .= $this->makeKnownLink( $t2->getText() );
1145 global $wgLang, $wgTitle, $wgLinkCache;
1147 $tns = $wgTitle->getNamespace();
1148 if ( -1 == $tns ) { return ""; }
1150 $pn = $wgTitle->getText();
1151 $tp = wfMsg( "talkpage" );
1152 if ( Namespace::isTalk( $tns ) ) {
1153 $lns = Namespace::getSubject( $tns );
1156 $text = wfMsg("articlepage");
1159 $text = wfMsg("userpage");
1162 $text = wfMsg("wikipediapage");
1165 $text = wfMsg("imagepage");
1168 $text= wfMsg("articlepage");
1172 $lns = Namespace::getTalk( $tns );
1175 $n = $wgLang->getNsText( $lns );
1176 if ( "" == $n ) { $link = $pn; }
1177 else { $link = "{$n}:{$pn}"; }
1179 $wgLinkCache->suspend();
1180 $s = $this->makeLink( $link, $text );
1181 $wgLinkCache->resume();
1186 function commentLink()
1188 global $wgLang, $wgTitle, $wgLinkCache;
1190 $tns = $wgTitle->getNamespace();
1191 if ( -1 == $tns ) { return ""; }
1193 $lns = ( Namespace::isTalk( $tns ) ) ?
$tns : Namespace::getTalk( $tns );
1195 # assert Namespace::isTalk( $lns )
1197 $n = $wgLang->getNsText( $lns );
1198 $pn = $wgTitle->getText();
1200 $link = "{$n}:{$pn}";
1202 $wgLinkCache->suspend();
1203 $s = $this->makeKnownLink($link, wfMsg("postcomment"), "action=edit§ion=new");
1204 $wgLinkCache->resume();
1209 # After all the page content is transformed into HTML, it makes
1210 # a final pass through here for things like table backgrounds.
1212 function transformContent( $text )
1217 # Note: This function MUST call getArticleID() on the link,
1218 # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
1220 function makeLink( $title, $text = "", $query = "", $trail = "" ) {
1221 wfProfileIn( "Skin::makeLink" );
1222 $nt = Title
::newFromText( $title );
1224 $result = $this->makeLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1226 wfDebug( "Invalid title passed to Skin::makeLink(): \"$title\"\n" );
1227 $result = $text == "" ?
$title : $text;
1230 wfProfileOut( "Skin::makeLink" );
1234 function makeKnownLink( $title, $text = "", $query = "", $trail = "" ) {
1235 $nt = Title
::newFromText( $title );
1237 return $this->makeKnownLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1239 wfDebug( "Invalid title passed to Skin::makeKnownLink(): \"$title\"\n" );
1240 return $text == "" ?
$title : $text;
1244 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" ) {
1245 $nt = Title
::newFromText( $title );
1247 return $this->makeBrokenLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1249 wfDebug( "Invalid title passed to Skin::makeBrokenLink(): \"$title\"\n" );
1250 return $text == "" ?
$title : $text;
1254 function makeStubLink( $title, $text = "", $query = "", $trail = "" ) {
1255 $nt = Title
::newFromText( $title );
1257 return $this->makeStubLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1259 wfDebug( "Invalid title passed to Skin::makeStubLink(): \"$title\"\n" );
1260 return $text == "" ?
$title : $text;
1264 # Pass a title object, not a title string
1265 function makeLinkObj( &$nt, $text= "", $query = "", $trail = "", $prefix = "" )
1267 global $wgOut, $wgUser;
1268 if ( $nt->isExternal() ) {
1269 $u = $nt->getFullURL();
1270 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1271 $style = $this->getExternalLinkAttributes( $link, $text );
1274 if ( "" != $trail ) {
1275 if ( preg_match( "/^([a-z]+)(.*)$$/sD", $trail, $m ) ) {
1280 $retVal = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1281 } elseif ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
1282 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1283 } elseif ( ( -1 == $nt->getNamespace() ) ||
1284 ( Namespace::getImage() == $nt->getNamespace() ) ) {
1285 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1287 $aid = $nt->getArticleID() ;
1289 $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail, $prefix );
1291 $threshold = $wgUser->getOption("stubthreshold") ;
1292 if ( $threshold > 0 ) {
1293 $res = wfQuery ( "SELECT LENGTH(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ
) ;
1295 if ( wfNumRows( $res ) > 0 ) {
1296 $s = wfFetchObject( $res );
1298 if ( $s->cur_is_redirect
OR $s->cur_namespace
!= 0 ) {
1299 $size = $threshold*2 ; # Really big
1301 wfFreeResult( $res );
1303 $size = $threshold*2 ; # Really big
1308 if ( $size < $threshold ) {
1309 $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
1311 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1318 # Pass a title object, not a title string
1319 function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1321 global $wgOut, $wgTitle;
1323 $fname = "Skin::makeKnownLinkObj";
1324 wfProfileIn( $fname );
1326 $link = $nt->getPrefixedURL();
1328 if ( "" == $link ) {
1330 if ( "" == $text ) { $text = $nt->getFragment(); }
1332 $u = $nt->escapeLocalURL( $query );
1334 if ( "" != $nt->getFragment() ) {
1335 $u .= "#" . wfEscapeHTML( $nt->getFragment() );
1337 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1338 $style = $this->getInternalLinkAttributesObj( $nt, $text );
1341 if ( "" != $trail ) {
1342 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1347 $r = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1348 wfProfileOut( $fname );
1352 # Pass a title object, not a title string
1353 function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1355 global $wgOut, $wgUser;
1357 $fname = "Skin::makeBrokenLinkObj";
1358 wfProfileIn( $fname );
1360 if ( "" == $query ) {
1363 $q = "action=edit&{$query}";
1365 $u = $nt->escapeLocalURL( $q );
1367 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1368 $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
1371 if ( "" != $trail ) {
1372 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1377 if ( $wgUser->getOption( "highlightbroken" ) ) {
1378 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1380 $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
1383 wfProfileOut( $fname );
1387 # Pass a title object, not a title string
1388 function makeStubLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1390 global $wgOut, $wgUser;
1392 $link = $nt->getPrefixedURL();
1394 $u = $nt->escapeLocalURL( $query );
1396 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1397 $style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
1400 if ( "" != $trail ) {
1401 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1406 if ( $wgUser->getOption( "highlightbroken" ) ) {
1407 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1409 $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1414 function fnamePart( $url )
1416 $basename = strrchr( $url, "/" );
1417 if ( false === $basename ) { $basename = $url; }
1418 else { $basename = substr( $basename, 1 ); }
1419 return wfEscapeHTML( $basename );
1422 function makeImage( $url, $alt = "" )
1426 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1427 $s = "<img src=\"{$url}\" alt=\"{$alt}\" />";
1431 function makeImageLink( $name, $url, $alt = "" ) {
1432 $nt = Title
::makeTitle( Namespace::getImage(), $name );
1433 return $this->makeImageLinkObj( $nt, $alt );
1436 function makeImageLinkObj( $nt, $alt = "" ) {
1437 global $wgLang, $wgUseImageResize;
1438 $name = $nt->getDBKey();
1439 $url = wfImageUrl( $name );
1441 $prefix = $postfix = "";
1443 if ( $wgUseImageResize ) {
1444 # Check if the alt text is of the form "options|alt text"
1446 # * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang
1447 # * left no resizing, just left align. label is used for alt= only
1448 # * right same, but right aligned
1449 # * none same, but not aligned
1450 # * ___px scale to ___ pixels width, no aligning. e.g. use in taxobox
1452 $part = explode( "|", $alt);
1454 $mwThumb =& MagicWord
::get( MAG_IMG_THUMBNAIL
);
1455 $mwLeft =& MagicWord
::get( MAG_IMG_LEFT
);
1456 $mwRight =& MagicWord
::get( MAG_IMG_RIGHT
);
1457 $mwNone =& MagicWord
::get( MAG_IMG_NONE
);
1458 $mwWidth =& MagicWord
::get( MAG_IMG_WIDTH
);
1459 $mwCenter =& MagicWord
::get( MAG_IMG_CENTER
);
1460 $alt = $part[count($part)-1];
1464 foreach( $part as $key => $val ) {
1465 if ( ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
1467 } elseif ( ! is_null( $mwRight->matchVariableStartToEnd($val) ) ) {
1468 # remember to set an alignment, don't render immediately
1470 } elseif ( ! is_null( $mwLeft->matchVariableStartToEnd($val) ) ) {
1471 # remember to set an alignment, don't render immediately
1473 } elseif ( ! is_null( $mwCenter->matchVariableStartToEnd($val) ) ) {
1474 # remember to set an alignment, don't render immediately
1476 } elseif ( ! is_null( $mwNone->matchVariableStartToEnd($val) ) ) {
1477 # remember to set an alignment, don't render immediately
1479 } elseif ( ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {
1480 # $match is the image width in pixels
1481 $width = intval($match);
1484 if ( "center" == $align )
1486 $prefix = "<center>";
1487 $postfix = "</center>";
1493 # Create a thumbnail. Alignment depends on language
1494 # writing direction, # right aligned for left-to-right-
1495 # languages ("Western languages"), left-aligned
1496 # for right-to-left-languages ("Semitic languages")
1498 # If thumbnail width has not been provided, it is set
1499 # here to 180 pixels
1500 if ( $align == "" ) {
1501 $align = $wgLang->isRTL() ?
"left" : "right";
1503 if ( ! isset($width) ) {
1506 return $prefix.$this->makeThumbLinkObj( $nt, $alt, $align, $width ).$postfix;
1508 } elseif ( isset($width) ) {
1510 # Create a resized image, without the additional thumbnail
1512 $url = $this->createThumb( $name, $width );
1514 } # endif $wgUseImageResize
1516 if ( empty( $alt ) ) {
1517 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1519 $alt = htmlspecialchars( $alt );
1521 $u = $nt->escapeLocalURL();
1524 $s = str_replace( "$1", $name, wfMsg("missingimage") );
1526 $s = "\n <a href=\"{$u}\" class='image' title=\"{$alt}\">\n" .
1527 " <img border=\"0\" src=\"{$url}\" alt=\"{$alt}\" />\n </a>";
1529 if ( "" != $align ) {
1530 $s = "<div class=\"float{$align}\">{$s}\n</div>";
1532 return $prefix.$s.$postfix;
1535 function createThumb( $name, $width ) {
1536 global $wgUploadDirectory;
1537 global $wgImageMagickConvertCommand;
1538 global $wgUseImageMagick;
1539 global $wgUseSquid, $wgInternalServer;
1540 $imgPath = wfImagePath( $name );
1541 $thumbName = $width."px-".$icon.$name;
1542 $thumbPath = wfImageThumbDir( $thumbName )."/".$thumbName;
1543 $thumbUrl = wfImageThumbUrl( $thumbName );
1545 if ( ! file_exists( $imgPath ) )
1547 # If there is no image, there will be no thumbnail
1551 if ( (! file_exists( $thumbPath ) )
1552 ||
( filemtime($thumbPath) < filemtime($imgPath) ) ) {
1554 if ( $wgUseSquid ) {
1556 $wgInternalServer.$thumbUrl
1558 wfPurgeSquidServers($urlArr);
1561 if ( $wgUseImageMagick ) {
1563 $cmd = $wgImageMagickConvertCommand .
1564 " -quality 85 -geometry {$width} ".
1565 escapeshellarg($imgPath) . " " .
1566 escapeshellarg($thumbPath);
1567 $conv = shell_exec( $cmd );
1569 # Use PHP's builtin GD library functions.
1571 # First find out what kind of file this is, and select the correct
1572 # input routine for this.
1573 list($src_width, $src_height, $src_type, $src_attr) = getimagesize( $imgPath );
1574 switch( $src_type ) {
1576 $src_image = imagecreatefromgif( $imgPath );
1579 $src_image = imagecreatefromjpeg( $imgPath );
1582 $src_image = imagecreatefrompng( $imgPath );
1584 case 15: # WBMP for WML
1585 $src_image = imagecreatefromwbmp( $imgPath );
1588 $src_image = imagecreatefromxbm( $imgPath );
1591 return "Image type not supported";
1594 $height = floor( $src_height * ( $width/$src_width ) );
1595 $dst_image = imagecreatetruecolor( $width, $height );
1596 imagecopyresampled( $dst_image, $src_image,
1598 $width, $height, $src_width, $src_height );
1599 switch( $src_type ) {
1604 #$thumbUrl .= ".png";
1605 #$thumbPath .= ".png";
1606 imagepng( $dst_image, $thumbPath );
1609 #$thumbUrl .= ".jpg";
1610 #$thumbPath .= ".jpg";
1611 imageinterlace( $dst_image );
1612 imagejpeg( $dst_image, $thumbPath, 95 );
1617 imagedestroy( $dst_image );
1618 imagedestroy( $src_image );
1623 # Check for zero-sized thumbnails. Those can be generated when
1624 # no disk space is available or some other error occurs
1626 $thumbstat = stat( $thumbPath );
1627 $imgstat = stat( $imgPath );
1628 if( $thumbstat["size"] == 0 )
1630 unlink( $thumbPath );
1637 function makeThumbLinkObj( $nt, $label = "", $align = "right", $boxwidth = 180 ) {
1638 global $wgUploadPath, $wgLang;
1639 $name = $nt->getDBKey();
1640 $image = Title
::makeTitle( Namespace::getImage(), $name );
1641 $url = wfImageUrl( $name );
1642 $path = wfImagePath( $name );
1644 #$label = htmlspecialchars( $label );
1645 $alt = preg_replace( "/<[^>]*>/", "", $label);
1646 $alt = htmlspecialchars( $alt );
1648 if ( file_exists( $path ) )
1650 list($width, $height, $type, $attr) = getimagesize( $path );
1652 $width = $height = 200;
1654 $boxheight = intval( $height/($width/$boxwidth) );
1655 if ( $boxwidth > $width ) {
1657 $boxheight = $height;
1660 $thumbUrl = $this->createThumb( $name, $boxwidth );
1662 $u = $nt->escapeLocalURL();
1664 $more = htmlspecialchars( wfMsg( "thumbnail-more" ) );
1665 $magnifyalign = $wgLang->isRTL() ?
"left" : "right";
1666 $textalign = $wgLang->isRTL() ?
" style=\"text-align:right\"" : "";
1668 $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$boxwidth}px;\">";
1669 if ( $thumbUrl == "" ) {
1670 $s .= str_replace( "$1", $name, wfMsg("missingimage") );
1672 $s .= "\n".' <a href="'.$u.'" class="internal" title="'.$alt.'">'."\n".
1673 ' <img border="0" src="'.$thumbUrl.'" alt="'.$alt.'" ' .
1674 ' width="'.$boxwidth.'" height="'.$boxheight.'" /></a>' ."\n".
1675 ' <a href="'.$u.'" class="internal" title="'.$more.'"> ' ."\n".
1676 ' <img border="0" src="'.$wgUploadPath.'/magnify-clip.png" ' .
1677 'width="26" height="24" align="'.$magnifyalign.'" alt="'.$more.'" /> </a>'."\n";
1679 $s .= ' <p'.$textalign.'>'.$label."</p>\n</div>";
1683 function makeMediaLink( $name, $url, $alt = "" ) {
1684 $nt = Title
::makeTitle( Namespace::getMedia(), $name );
1685 return $this->makeMediaLinkObj( $nt, $alt );
1688 function makeMediaLinkObj( $nt, $alt = "" )
1690 $name = $nt->getDBKey();
1691 $url = wfImageUrl( $name );
1692 if ( empty( $alt ) ) {
1693 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1696 $u = htmlspecialchars( $url );
1697 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1701 function specialLink( $name, $key = "" )
1705 if ( "" == $key ) { $key = strtolower( $name ); }
1706 $pn = $wgLang->ucfirst( $name );
1707 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1711 # Called by history lists and recent changes
1714 # Returns text for the start of the tabular part of RC
1715 function beginRecentChangesList()
1717 $this->rc_cache
= array() ;
1718 $this->rcMoveIndex
= 0;
1719 $this->rcCacheIndex
= 0 ;
1720 $this->lastdate
= "";
1724 function beginImageHistoryList()
1726 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1727 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul class='special'>";
1731 # Returns text for the end of RC
1732 # If enhanced RC is in use, returns pretty much all the text
1733 function endRecentChangesList()
1735 $s = $this->recentChangesBlock() ;
1740 # Enhanced RC ungrouped line
1741 function recentChangesBlockLine ( $rcObj )
1743 global $wgUploadPath, $wgLang ;
1745 # Get rc_xxxx variables
1746 extract( $rcObj->mAttribs
) ;
1747 $curIdEq = "curid=$rc_cur_id";
1752 $r .= "<img src='{$wgUploadPath}/Arr_.png' width='12' height='12' border='0' />" ; $r .= "<tt>" ;
1754 if ( $rc_type == RC_MOVE
) {
1755 $r .= " ";
1757 # M & N (minor & new)
1758 $M = wfMsg( "minoreditletter" );
1759 $N = wfMsg( "newpageletter" );
1761 if ( $rc_type == RC_NEW
) {
1774 $r .= " ".$rcObj->timestamp
." " ;
1778 $link = $rcObj->link
;
1779 if ( $rcObj->watched
) $link = "<strong>{$link}</strong>" ;
1784 $r .= $rcObj->curlink
;
1788 $r .= $this->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
1791 $r .= ") . . ".$rcObj->userlink
;
1792 $r .= $rcObj->usertalklink
;
1795 if ( $rc_comment != "" && $rc_type != RC_MOVE
) {
1796 $rc_comment=$this->formatComment($rc_comment);
1797 $r .= $wgLang->emphasize( " (".$rc_comment.")" );
1805 function recentChangesBlockGroup ( $block )
1807 global $wgUploadPath, $wgLang ;
1810 $M = wfMsg( "minoreditletter" );
1811 $N = wfMsg( "newpageletter" );
1813 # Collate list of users
1815 $userlinks = array () ;
1816 foreach ( $block AS $rcObj ) {
1817 $oldid = $rcObj->mAttribs
['rc_last_oldid'];
1818 if ( $rcObj->mAttribs
['rc_new'] ) $isnew = true ;
1819 $u = $rcObj->userlink
;
1820 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1824 # Sort the list and convert to text
1825 krsort ( $userlinks ) ;
1826 asort ( $userlinks ) ;
1828 foreach ( $userlinks as $userlink => $count) {
1830 if ( $count > 1 ) $text .= " ({$count}×)" ;
1831 array_push ( $users , $text ) ;
1833 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1836 $rci = "RCI{$this->rcCacheIndex}" ;
1837 $rcl = "RCL{$this->rcCacheIndex}" ;
1838 $rcm = "RCM{$this->rcCacheIndex}" ;
1839 $toggleLink = "javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")" ;
1840 $arrowdir = $wgLang->isRTL() ?
"l" : "r";
1841 $tl = "<span id='{$rcm}'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_{$arrowdir}.png' width='12' height='12' border='0' /></a></span>" ;
1842 $tl .= "<span id='{$rcl}' style='display:none'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_d.png' width='12' height='12' border='0' /></a></span>" ;
1848 if ( $isnew ) $r .= $N ;
1849 else $r .= " " ;
1850 $r .= " " ; # Minor
1853 $r .= " ".$block[0]->timestamp
." " ;
1857 $link = $block[0]->link
;
1858 if ( $block[0]->watched
) $link = "<strong>{$link}</strong>" ;
1861 $curIdEq = "curid=" . $block[0]->mAttribs
['rc_cur_id'];
1862 if ( $block[0]->mAttribs
['rc_type'] != RC_LOG
) {
1864 $r .= " (".count($block)." " ;
1865 if ( $isnew ) $r .= wfMsg("changes");
1866 else $r .= $this->makeKnownLinkObj( $block[0]->getTitle() , wfMsg("changes") ,
1867 "{$curIdEq}&diff=0&oldid=".$oldid ) ;
1871 $r .= $this->makeKnownLinkObj( $block[0]->getTitle(), wfMsg( "history" ), "{$curIdEq}&action=history" );
1879 $r .= "<div id='{$rci}' style='display:none'>" ;
1880 foreach ( $block AS $rcObj ) {
1881 # Get rc_xxxx variables
1882 extract( $rcObj->mAttribs
);
1884 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0 />";
1885 $r .= "<tt> " ;
1886 if ( $rc_new ) $r .= $N ;
1887 else $r .= " " ;
1888 if ( $rc_minor ) $r .= $M ;
1889 else $r .= " " ;
1893 if ( $rc_last_oldid != 0 ) {
1894 $o = "oldid=".$rc_last_oldid ;
1896 if ( $rc_type == RC_LOG
) {
1897 $link = $rcObj->timestamp
;
1899 $link = $this->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp
, "{$curIdEq}&$o" ) ;
1901 $link = "<tt>{$link}</tt>" ;
1905 $r .= $rcObj->curlink
;
1907 $r .= $rcObj->lastlink
;
1908 $r .= ") . . ".$rcObj->userlink
;
1909 $r .= $rcObj->usertalklink
;
1910 if ( $rc_comment != "" ) {
1911 $rc_comment=$this->formatComment($rc_comment);
1912 $r .= $wgLang->emphasize( " (".$rc_comment.")" ) ;
1918 $this->rcCacheIndex++
;
1922 # If enhanced RC is in use, this function takes the previously cached
1923 # RC lines, arranges them, and outputs the HTML
1924 function recentChangesBlock ()
1926 global $wgUploadPath ;
1927 if ( count ( $this->rc_cache
) == 0 ) return "" ;
1929 foreach ( $this->rc_cache
AS $secureName => $block ) {
1930 if ( count ( $block ) < 2 ) {
1931 $blockOut .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ;
1933 $blockOut .= $this->recentChangesBlockGroup ( $block ) ;
1937 return "<div>{$blockOut}</div>" ;
1940 # Called in a loop over all displayed RC entries
1941 # Either returns the line, or caches it for later use
1942 function recentChangesLine( &$rc, $watched = false )
1945 $usenew = $wgUser->getOption( "usenewrc" );
1947 $line = $this->recentChangesLineNew ( $rc, $watched ) ;
1949 $line = $this->recentChangesLineOld ( $rc, $watched ) ;
1953 function recentChangesLineOld( &$rc, $watched = false )
1955 global $wgTitle, $wgLang, $wgUser;
1957 # Extract DB fields into local scope
1958 extract( $rc->mAttribs
);
1959 $curIdEq = "curid=" . $rc_cur_id;
1961 # Make date header if necessary
1962 $date = $wgLang->date( $rc_timestamp, true);
1964 if ( $date != $this->lastdate
) {
1965 if ( "" != $this->lastdate
) { $s .= "</ul>\n"; }
1966 $s .= "<h4>{$date}</h4>\n<ul class='special'>";
1967 $this->lastdate
= $date;
1971 if ( $rc_type == RC_MOVE
) {
1973 $s .= "(" . wfMsg( "diff" ) . ") (";
1975 $s .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), wfMsg( "hist" ), "action=history" ) .
1978 # "[[x]] moved to [[y]]"
1980 $s .= wfMsg( "1movedto2", $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" ),
1981 $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" ) );
1985 if ( $rc_type == RC_NEW ||
$rc_type == RC_LOG
) {
1986 $diffLink = wfMsg( "diff" );
1988 $diffLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "diff" ),
1989 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
1991 $s .= "($diffLink) (";
1994 $s .= $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
1997 # M and N (minor and new)
1998 $M = wfMsg( "minoreditletter" );
1999 $N = wfMsg( "newpageletter" );
2000 if ( $rc_minor ) { $s .= " <strong>{$M}</strong>"; }
2001 if ( $rc_type == RC_NEW
) { $s .= "<strong>{$N}</strong>"; }
2004 $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), "" );
2007 $articleLink = "<strong>{$articleLink}</strong>";
2009 $s .= " $articleLink";
2014 $s .= "; " . $wgLang->time( $rc_timestamp, true ) . " . . ";
2016 # User link (or contributions for unregistered users)
2017 if ( 0 == $rc_user ) {
2018 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2019 $rc_user_text, "target=" . $rc_user_text );
2021 $userLink = $this->makeLink( $wgLang->getNsText( NS_USER
) . ":{$rc_user_text}", $rc_user_text );
2026 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2027 global $wgDisableAnonTalk;
2028 if( 0 == $rc_user && $wgDisableAnonTalk ) {
2031 $utns=$wgLang->getNsText(NS_USER_TALK
);
2032 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2036 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2037 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2038 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2042 if($userTalkLink) $userTalkLink .= " | ";
2043 $userTalkLink .= $blockLink;
2045 if($userTalkLink) $s.=" ({$userTalkLink})";
2048 if ( "" != $rc_comment && "*" != $rc_comment && $rc_type != RC_MOVE
) {
2049 $rc_comment=$this->formatComment($rc_comment);
2050 $s .= $wgLang->emphasize(" (" . $rc_comment . ")");
2057 # function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
2058 function recentChangesLineNew( &$baseRC, $watched = false )
2060 global $wgTitle, $wgLang, $wgUser;
2062 # Create a specialised object
2063 $rc = RCCacheEntry
::newFromParent( $baseRC ) ;
2065 # Extract fields from DB into the function scope (rc_xxxx variables)
2066 extract( $rc->mAttribs
);
2067 $curIdEq = "curid=" . $rc_cur_id;
2069 # If it's a new day, add the headline and flush the cache
2070 $date = $wgLang->date( $rc_timestamp, true);
2072 if ( $date != $this->lastdate
) {
2073 # Process current cache
2074 $ret = $this->recentChangesBlock () ;
2075 $this->rc_cache
= array() ;
2076 $ret .= "<h4>{$date}</h4>\n";
2077 $this->lastdate
= $date;
2081 if ( $rc_type == RC_MOVE
) {
2082 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" );
2083 $clink .= " " . wfMsg("movedto") . " ";
2084 $clink .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" );
2086 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "" ) ;
2089 $time = $wgLang->time( $rc_timestamp, true );
2090 $rc->watched
= $watched ;
2091 $rc->link
= $clink ;
2092 $rc->timestamp
= $time;
2095 if ( ( $rc_type == RC_NEW
&& $rc_this_oldid == 0 ) ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2096 $curLink = wfMsg( "cur" );
2098 $curLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "cur" ),
2099 "{$curIdEq}&diff=0&oldid={$rc_this_oldid}" );
2103 $titleObj = $rc->getTitle();
2104 if ( $rc_last_oldid == 0 ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2105 $lastLink = wfMsg( "last" );
2107 $lastLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "last" ),
2108 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
2111 # Make user link (or user contributions for unregistered users)
2112 if ( 0 == $rc_user ) {
2113 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2114 $rc_user_text, "target=" . $rc_user_text );
2116 $userLink = $this->makeLink( $wgLang->getNsText(
2117 Namespace::getUser() ) . ":{$rc_user_text}", $rc_user_text );
2120 $rc->userlink
= $userLink ;
2121 $rc->lastlink
= $lastLink ;
2122 $rc->curlink
= $curLink ;
2124 # Make user talk link
2125 $utns=$wgLang->getNsText(NS_USER_TALK
);
2126 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2127 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2129 global $wgDisableAnonTalk;
2130 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2131 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2132 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2133 if( $wgDisableAnonTalk )
2134 $rc->usertalklink
= " ({$blockLink})";
2136 $rc->usertalklink
= " ({$userTalkLink} | {$blockLink})";
2138 if( $wgDisableAnonTalk && ($rc_user == 0) )
2139 $rc->usertalklink
= "";
2141 $rc->usertalklink
= " ({$userTalkLink})";
2144 # Put accumulated information into the cache, for later display
2145 # Page moves go on their own line
2146 $title = $rc->getTitle();
2147 $secureName = $title->getPrefixedDBkey();
2148 if ( $rc_type == RC_MOVE
) {
2149 # Use an @ character to prevent collision with page names
2150 $this->rc_cache
["@@" . ($this->rcMoveIndex++
)] = array($rc);
2152 if ( !isset ( $this->rc_cache
[$secureName] ) ) $this->rc_cache
[$secureName] = array() ;
2153 array_push ( $this->rc_cache
[$secureName] , $rc ) ;
2158 function endImageHistoryList()
2164 /* This function is called by all recent changes variants, by the page history,
2165 and by the user contributions list. It is responsible for formatting edit
2166 comments. It escapes any HTML in the comment, but adds some CSS to format
2167 auto-generated comments (from section editing).
2169 function formatComment($comment)
2171 $comment=wfEscapeHTML($comment);
2173 # format text between /* .. */ with autocomment CSS class
2174 $comment=preg_replace("/\/\*\s*(.*?)\s*\*\//i",
2175 "<span id=\"autocomment\">$1</span>",$comment);
2179 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
2181 global $wgUser, $wgLang, $wgTitle;
2183 $dt = $wgLang->timeanddate( $ts, true );
2184 $del = wfMsg( "deleteimg" );
2185 $cur = wfMsg( "cur" );
2188 $url = wfImageUrl( $img );
2190 if ( $wgUser->isSysop() ) {
2191 $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
2193 $style = $this->getInternalLinkAttributes( $link, $del );
2195 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
2200 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
2201 if( $wgUser->getID() != 0 ) {
2202 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2203 wfMsg( "revertimg" ), "action=revert&oldimage=" .
2204 urlencode( $img ) );
2205 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2206 $del, "action=delete&oldimage=" . urlencode( $img ) );
2208 # Having live active links for non-logged in users
2209 # means that bots and spiders crawling our site can
2210 # inadvertently change content. Baaaad idea.
2211 $rlink = wfMsg( "revertimg" );
2215 if ( 0 == $u ) { $ul = $ut; }
2216 else { $ul = $this->makeLink( $wgLang->getNsText(
2217 Namespace::getUser() ) . ":{$ut}", $ut ); }
2219 $nb = wfMsg( "nbytes", $size );
2220 $style = $this->getInternalLinkAttributes( $url, $dt );
2222 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
2223 . " . . {$ul} ({$nb})";
2225 if ( "" != $c && "*" != $c ) {
2226 $s .= $wgLang->emphasize(" (" . wfEscapeHTML( $c ) . ")");
2232 function tocIndent($level) {
2233 return str_repeat( "<div class='tocindent'>\n", $level );
2236 function tocUnindent($level) {
2237 return str_repeat( "</div>\n", $level );
2240 # parameter level defines if we are on an indentation level
2241 function tocLine( $anchor, $tocline, $level ) {
2242 $link = "<a href=\"#$anchor\">$tocline</a><br />";
2246 return "<div class='tocline'>$link</div>\n";
2251 function tocTable($toc) {
2252 # note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
2253 # try min-width & co when somebody gets a chance
2254 $hideline = " <script type='text/javascript'>showTocToggle(\"" . addslashes( wfMsg("showtoc") ) . "\",\"" . addslashes( wfMsg("hidetoc") ) . "\")</script>";
2256 "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
2257 "<b>".wfMsg("toc")."</b>" .
2259 "</td></tr><tr id='tocinside'><td>\n".
2260 $toc."</td></tr></table><P>\n";
2263 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
2264 function editSectionScript( $section, $head ) {
2265 global $wgTitle, $wgRequest;
2266 if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
2269 $url = $wgTitle->escapeLocalURL( "action=edit§ion=$section" );
2270 return "<span oncontextmenu='document.location=\"$url\";return false;'>{$head}</span>";
2273 function editSectionLink( $section ) {
2275 global $wgTitle, $wgUser, $wgLang;
2277 if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
2278 # Section edit links would be out of sync on an old page.
2279 # But, if we're diffing to the current page, they'll be
2284 $editurl = "§ion={$section}";
2285 $url = $this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
2287 if( $wgLang->isRTL() ) {
2289 $nearside = "right";
2294 return "<div class=\"editsection\" style=\"float:$farside;margin-$nearside:5px;\">[".$url."]</div>";
2298 // This function is called by EditPage.php and shows a bulletin board style
2299 // toolbar for common editing functions. It can be disabled in the user preferences.
2300 // The necsesary JavaScript code can be found in style/wikibits.js.
2301 function getEditToolbar() {
2303 global $wgUploadPath,$wgLang;
2305 // toolarray an array of arrays which each include the filename of
2306 // the button image (without path), the opening tag, the closing tag,
2307 // and optionally a sample text that is inserted between the two when no
2308 // selection is highlighted.
2309 // The tip text is shown when the user moves the mouse over the button.
2311 array( "image"=>"button_bold.png",
2314 "sample"=>wfMsg("bold_sample"),
2315 "tip"=>wfMsg("bold_tip")),
2316 array( "image"=>"button_italic.png",
2319 "sample"=>wfMsg("italic_sample"),
2320 "tip"=>wfMsg("italic_tip")),
2321 array( "image"=>"button_link.png",
2324 "sample"=>wfMsg("link_sample"),
2325 "tip"=>wfMsg("link_tip")),
2326 array( "image"=>"button_extlink.png",
2329 "sample"=>wfMsg("extlink_sample"),
2330 "tip"=>wfMsg("extlink_tip")),
2331 array( "image"=>"button_headline.png",
2334 "sample"=>wfMsg("headline_sample"),
2335 "tip"=>wfMsg("headline_tip")),
2336 array( "image"=>"button_image.png",
2337 "open"=>"[[".$wgLang->getNsText(NS_IMAGE
).":",
2339 "sample"=>wfMsg("image_sample"),
2340 "tip"=>wfMsg("image_tip")),
2341 array( "image"=>"button_media.png",
2342 "open"=>"[[".$wgLang->getNsText(NS_MEDIA
).":",
2344 "sample"=>wfMsg("media_sample"),
2345 "tip"=>wfMsg("media_tip")),
2346 array( "image"=>"button_math.png",
2347 "open"=>"\\<math\\>",
2348 "close"=>"\\</math\\>",
2349 "sample"=>wfMsg("math_sample"),
2350 "tip"=>wfMsg("math_tip")),
2351 array( "image"=>"button_nowiki.png",
2352 "open"=>"\\<nowiki\\>",
2353 "close"=>"\\</nowiki\\>",
2354 "sample"=>wfMsg("nowiki_sample"),
2355 "tip"=>wfMsg("nowiki_tip")),
2356 array( "image"=>"button_sig.png",
2360 "tip"=>wfMsg("sig_tip")),
2361 array( "image"=>"button_hr.png",
2362 "open"=>"\\n----\\n",
2365 "tip"=>wfMsg("hr_tip"))
2367 $toolbar ="<script type='text/javascript'>\n";
2368 $toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
2369 foreach($toolarray as $tool) {
2371 $image=$wgUploadPath."/".$tool["image"];
2372 $open=$tool["open"];
2373 $close=$tool["close"];
2374 $sample = addslashes( $tool["sample"] );
2376 // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
2377 // Older browsers show a "speedtip" type message only for ALT.
2378 // Ideally these should be different, realistically they
2379 // probably don't need to be.
2380 $tip = addslashes( $tool["tip"] );
2381 $toolbar.="addButton('$image','$tip','$open','$close','$sample');\n";
2384 $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "','" . addslashes(wfMsg("infobox_alert")) . "','" . addslashes(wfMsg("infobox_mozvote"))."');\n";
2385 $toolbar.="document.writeln(\"</div>\");\n</script>";
2390 include_once( "SkinStandard.php" );
2391 include_once( "SkinNostalgia.php" );
2392 include_once( "SkinCologneBlue.php" );
2394 if( $wgUseSmarty ) {
2395 include_once( "SkinSmarty.php" );
2397 if( $wgUsePHPTal ) {
2398 include_once( "SkinPHPTal.php" );