d97334f9e1d405324064ad3e0f4c90b1bf00949d
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' => "Standard",
13 'nostalgia' => "Nostalgia",
14 'cologneblue' => "CologneBlue"
17 $wgValidSkinNames['smarty'] = "Smarty";
18 $wgValidSkinNames['montparnasse'] = "Montparnasse";
21 #$wgValidSkinNames[] = "PHPTal";
22 $wgValidSkinNames['davinci'] = "DaVinci";
23 $wgValidSkinNames['mono'] = "Mono";
26 include_once( "RecentChange.php" );
28 # For some odd PHP bug, this function can't be part of a class
29 function getCategories ()
31 global $wgOut , $wgTitle , $wgUseCategoryMagic , $wgUser , $wgParser ;
32 if ( !isset ( $wgUseCategoryMagic ) ||
!$wgUseCategoryMagic ) return "" ;
33 if ( count ( $wgParser->mCategoryLinks
) == 0 ) return "" ;
34 if ( !$wgOut->isArticle() ) return "" ;
35 $sk = $wgUser->getSkin() ;
38 $s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ;
39 $t = implode ( " | " , $wgParser->mCategoryLinks
) ;
40 if ( $t != "" ) $s .= " : " ;
45 class RCCacheEntry
extends RecentChange
47 var $secureName, $link;
48 var $curlink , $lastlink , $usertalklink , $versionlink ;
49 var $userlink, $timestamp, $watched;
51 function newFromParent( $rc )
53 $rc2 = new RCCacheEntry
;
54 $rc2->mAttribs
= $rc->mAttribs
;
55 $rc2->mExtra
= $rc->mExtra
;
62 /* private */ var $lastdate, $lastline;
63 var $linktrail ; # linktrail regexp
64 var $rc_cache ; # Cache for Enhanced Recent Changes
65 var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
70 $this->linktrail
= wfMsg("linktrail");
73 function getSkinNames()
75 global $wgValidSkinNames;
76 return $wgValidSkinNames;
79 function getStylesheet()
81 return "wikistandard.css";
86 global $wgOut, $wgUser;
88 if ( $wgOut->isQuickbarSuppressed() ) { return 0; }
89 $q = $wgUser->getOption( "quickbar" );
90 if ( "" == $q ) { $q = 0; }
94 function initPage( &$out )
96 global $wgStyleSheetPath;
97 $fname = "Skin::initPage";
98 wfProfileIn( $fname );
100 $out->addLink( "shortcut icon", "", "/favicon.ico" );
102 wfProfileOut( $fname );
105 function outputPage( &$out ) {
106 global $wgDebugComments;
108 wfProfileIn( "Skin::outputPage" );
109 $this->initPage( $out );
110 $out->out( $out->headElement() );
112 $out->out( "\n<body" );
113 $ops = $this->getBodyOptions();
114 foreach ( $ops as $name => $val ) {
115 $out->out( " $name='$val'" );
118 if ( $wgDebugComments ) {
119 $out->out( "<!-- Wiki debugging output:\n" .
120 $out->mDebugtext
. "-->\n" );
122 $out->out( $this->beforeContent() );
124 $out->out( $out->mBodytext
);
126 $out->out( $this->afterContent() );
129 $out->out( $out->reportTime() );
131 $out->out( "\n</body></html>" );
134 function getHeadScripts() {
135 global $wgStyleSheetPath;
136 $r = "<script type=\"text/javascript\" src=\"{$wgStyleSheetPath}/wikibits.js\"></script>\n";
140 function getUserStyles()
142 global $wgOut, $wgStyleSheetPath;
143 $sheet = $this->getStylesheet();
144 $s = "<style type='text/css'><!--\n";
145 $s .= "/*/*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
146 $s .= "@import url(\"$wgStyleSheetPath/$sheet\");\n";
147 $s .= $this->doGetUserStyles();
149 $s .= "//--></style>\n";
153 function doGetUserStyles()
158 if ( 1 == $wgUser->getOption( "underline" ) ) {
159 # Don't override browser settings
163 $s .= "a.stub, a.new, a.internal, a.external { " .
164 "text-decoration: none; }\n";
166 if ( 1 == $wgUser->getOption( "highlightbroken" ) ) {
167 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
169 if ( 1 == $wgUser->getOption( "justify" ) ) {
170 $s .= "#article { text-align: justify; }\n";
175 function getBodyOptions()
177 global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $oldid, $redirect, $diff,$action;
179 if ( 0 != $wgTitle->getNamespace() ) {
180 $a = array( "bgcolor" => "#ffffec" );
182 else $a = array( "bgcolor" => "#FFFFFF" );
183 if($wgOut->isArticle() && $wgUser->getOption("editondblclick")
185 (!$wgTitle->isProtected() ||
$wgUser->isSysop())
188 $t = wfMsg( "editthispage" );
190 if ( $redirect ) { $red = "&redirect={$redirect}"; }
191 if ( $oldid && ! isset( $diff ) ) {
192 $oid = "&oldid={$oldid}";
194 $s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" );
195 $s = "document.location = \"" .$s ."\";";
196 $a +
= array ("ondblclick" => $s);
199 $a['onload'] = $wgOut->getOnloadHandler();
203 function getExternalLinkAttributes( $link, $text )
205 global $wgUser, $wgOut, $wgLang;
207 $link = urldecode( $link );
208 $link = $wgLang->checkTitleEncoding( $link );
209 $link = str_replace( "_", " ", $link );
210 $link = wfEscapeHTML( $link );
212 $r = " class='external'";
214 if ( 1 == $wgUser->getOption( "hover" ) ) {
215 $r .= " title=\"{$link}\"";
220 function getInternalLinkAttributes( $link, $text, $broken = false )
222 global $wgUser, $wgOut;
224 $link = urldecode( $link );
225 $link = str_replace( "_", " ", $link );
226 $link = wfEscapeHTML( $link );
228 if ( $broken == "stub" ) {
229 $r = " class='stub'";
230 } else if ( $broken == "yes" ) {
236 if ( 1 == $wgUser->getOption( "hover" ) ) {
237 $r .= " title=\"{$link}\"";
242 function getInternalLinkAttributesObj( &$nt, $text, $broken = false )
244 global $wgUser, $wgOut;
246 if ( $broken == "stub" ) {
247 $r = " class='stub'";
248 } else if ( $broken == "yes" ) {
254 if ( 1 == $wgUser->getOption( "hover" ) ) {
255 $r .= ' title ="' . $nt->getEscapedText() . '"';
266 # This will be called immediately after the <body> tag. Split into
267 # two functions to make it easier to subclass.
269 function beforeContent()
271 global $wgUser, $wgOut, $wgSiteNotice;
273 if( $wgSiteNotice ) {
274 $note = "\n<div id='notice' style='font-weight: bold; color: red; text-align: center'>$wgSiteNotice</div>\n";
278 return $this->doBeforeContent() . $note;
281 function doBeforeContent()
283 global $wgUser, $wgOut, $wgTitle, $wgLang;
284 $fname = "Skin::doBeforeContent";
285 wfProfileIn( $fname );
288 $qb = $this->qbSetting();
290 if( $langlinks = $this->otherLanguages() ) {
296 $borderhack = "class='top'";
299 $s .= "\n<div id='content'>\n<div id='topbar'>" .
300 "<table border=0 cellspacing=0><tr>";
303 $left = ($qb == 1 ||
$qb == 3);
304 if($wgLang->isRTL()) $left = !$left;
307 $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>" .
308 $this->logoText() . "</td>";
310 $s .= $this->getQuickbarCompensator( $rows );
312 $l = $wgLang->isRTL() ?
"right" : "left";
313 $s .= "<td {$borderhack} align='$l' valign='top'>";
315 $s .= $this->topLinks() ;
316 $s .= "<p class='subtitle'>" . $this->pageTitleLinks();
318 $r = $wgLang->isRTL() ?
"left" : "right";
319 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap>";
320 $s .= $this->nameAndLogin();
321 $s .= "\n<br>" . $this->searchForm() . "</td>";
324 $s .= "</tr>\n<tr><td class='top' colspan=\"2\">$langlinks</td>";
327 if ( $shove && !$left ) { # Right
328 $s .= $this->getQuickbarCompensator( $rows );
330 $s .= "</tr></table>\n</div>\n";
331 $s .= "\n<div id='article'>";
333 $s .= $this->pageTitle();
334 $s .= $this->pageSubtitle() ;
335 $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
337 wfProfileOut( $fname );
341 function getQuickbarCompensator( $rows = 1 )
343 return "<td width='152' rowspan='{$rows}'> </td>";
346 # This gets called immediately before the </body> tag.
348 function afterContent()
350 global $wgUser, $wgOut, $wgServer;
351 global $wgTitle, $wgLang;
353 $printfooter = "<div class=\"printfooter\">" . $this->printFooter() . "</div>\n";
354 return $printfooter . $this->doAfterContent();
357 function printFooter() {
359 $url = htmlspecialchars( $wgTitle->getFullURL() );
360 return "<p>" . wfMsg( "retrievedfrom", "<a href=\"$url\">$url</a>" ) .
361 "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
364 function doAfterContent()
366 global $wgUser, $wgOut, $wgLang;
367 $fname = "Skin::doAfterContent";
368 wfProfileIn( $fname );
369 wfProfileIn( "$fname-1" );
371 $s = "\n</div><br clear=all>\n";
372 $s .= "\n<div id='footer'>";
373 $s .= "<table border=0 cellspacing=0><tr>";
375 wfProfileOut( "$fname-1" );
376 wfProfileIn( "$fname-2" );
378 $qb = $this->qbSetting();
380 $left = ($qb == 1 ||
$qb == 3);
381 if($wgLang->isRTL()) $left = !$left;
383 if ( $shove && $left ) { # Left
384 $s .= $this->getQuickbarCompensator();
386 wfProfileOut( "$fname-2" );
387 wfProfileIn( "$fname-3" );
388 $l = $wgLang->isRTL() ?
"right" : "left";
389 $s .= "<td class='bottom' align='$l' valign='top'>";
391 $s .= $this->bottomLinks();
392 $s .= "\n<br>" . $this->mainPageLink()
393 . " | " . $this->aboutLink()
394 . " | " . $this->specialLink( "recentchanges" )
395 . " | " . $this->searchForm()
396 . "<br><span id='pagestats'>" . $this->pageStats() . "</span>";
399 if ( $shove && !$left ) { # Right
400 $s .= $this->getQuickbarCompensator();
402 $s .= "</tr></table>\n</div>\n</div>\n";
404 wfProfileOut( "$fname-3" );
405 wfProfileIn( "$fname-4" );
406 if ( 0 != $qb ) { $s .= $this->quickBar(); }
407 wfProfileOut( "$fname-4" );
408 wfProfileOut( $fname );
412 function pageTitleLinks()
414 global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval;
416 $s = $this->printableLink();
417 if ( wfMsg ( "disclaimers" ) != "-" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
419 if ( $wgOut->isArticleRelated() ) {
420 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
421 $name = $wgTitle->getDBkey();
422 $link = wfEscapeHTML( wfImageUrl( $name ) );
423 $style = $this->getInternalLinkAttributes( $link, $name );
424 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
426 # This will show the "Approve" link if $wgUseApproval=true;
427 if ( isset ( $wgUseApproval ) && $wgUseApproval )
429 $t = $wgTitle->getDBkey();
430 $name = "Approve this article" ;
431 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
432 #wfEscapeHTML( wfImageUrl( $name ) );
433 $style = $this->getExternalLinkAttributes( $link, $name );
434 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
437 if ( "history" == $action ||
isset( $diff ) ||
isset( $oldid ) ) {
438 $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
439 wfMsg( "currentrev" ) );
442 if ( $wgUser->getNewtalk() ) {
443 # do not show "You have new messages" text when we are viewing our
446 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
447 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
448 $n =$wgUser->getName();
449 $tl = $this->makeKnownLink( $wgLang->getNsText(
450 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
451 wfMsg("newmessageslink") );
452 $s.=" | <strong>". wfMsg( "newmessages", $tl ) . "</strong>";
455 if( $wgUser->isSysop() &&
456 (($wgTitle->getArticleId() == 0) ||
($action == "history")) &&
457 ($n = $wgTitle->isDeleted() ) ) {
458 $s .= " | " . wfMsg( "thisisdeleted",
459 $this->makeKnownLink(
460 $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
461 wfMsg( "restorelink", $n ) ) );
466 function printableLink()
468 global $wgOut, $wgFeedClasses, $wgRequest;
470 $baseurl = $_SERVER['REQUEST_URI'];
471 if( strpos( "?", $baseurl ) == false ) {
476 $baseurl = htmlspecialchars( $baseurl );
477 $printurl = $wgRequest->escapeAppendQuery( "printable=yes" );
479 $s = "<a href=\"$printurl\">" . wfMsg( "printableversion" ) . "</a>";
480 if( $wgOut->isSyndicated() ) {
481 foreach( $wgFeedClasses as $format => $class ) {
482 $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
483 $s .= " | <a href=\"$feedurl\">{$format}</a>";
491 global $wgOut, $wgTitle, $wgUser;
493 $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
494 if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
498 function pageSubtitle()
500 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
502 $sub = $wgOut->getSubtitle();
504 global $wgExtraSubtitle;
505 $sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
507 if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
508 $ptext=$wgTitle->getPrefixedText();
509 if(preg_match("/\//",$ptext)) {
510 $sub.="</p><p class='subpages'>";
511 $links=explode("/",$ptext);
514 foreach($links as $link) {
516 if ($c<count($links)) {
517 $growinglink .= $link;
518 $getlink = $this->makeLink( $growinglink, $link );
519 if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
532 $s = "<p class='subtitle'>{$sub}\n";
536 function nameAndLogin()
538 global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader, $wgIP;
540 $li = $wgLang->specialPage( "Userlogin" );
541 $lo = $wgLang->specialPage( "Userlogout" );
544 if ( 0 == $wgUser->getID() ) {
545 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
548 $tl = $this->makeKnownLink( $wgLang->getNsText(
549 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
550 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
552 $s .= $n . " (".$tl.")";
554 $s .= wfMsg("notloggedin");
557 $rt = $wgTitle->getPrefixedURL();
558 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
560 } else { $q = "returnto={$rt}"; }
562 $s .= "\n<br>" . $this->makeKnownLink( $li,
563 wfMsg( "login" ), $q );
565 $n = $wgUser->getName();
566 $rt = $wgTitle->getPrefixedURL();
567 $tl = $this->makeKnownLink( $wgLang->getNsText(
568 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
569 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
573 $s .= $this->makeKnownLink( $wgLang->getNsText(
574 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br>" .
575 $this->makeKnownLink( $lo, wfMsg( "logout" ),
576 "returnto={$rt}" ) . " | " .
577 $this->specialLink( "preferences" );
579 $s .= " | " . $this->makeKnownLink( wfMsg( "helppage" ),
585 function searchForm()
589 $s = "<form name='search' class='inline' method=post action=\""
590 . wfLocalUrl( "" ) . "\">"
591 . "<input type=text name=\"search\" size=19 value=\""
592 . htmlspecialchars(substr($search,0,256)) . "\">\n"
593 . "<input type=submit name=\"go\" value=\"" . wfMsg ("go") . "\"> "
594 . "<input type=submit name=\"fulltext\" value=\"" . wfMsg ("search") . "\"></form>";
604 $s = $this->mainPageLink() . $sep
605 . $this->specialLink( "recentchanges" );
607 if ( $wgOut->isArticleRelated() ) {
608 $s .= $sep . $this->editThisPage()
609 . $sep . $this->historyLink();
611 # Many people don't like this dropdown box
612 #$s .= $sep . $this->specialPagesList();
617 function bottomLinks()
619 global $wgOut, $wgUser, $wgTitle;
623 if ( $wgOut->isArticleRelated() ) {
624 $s .= "<strong>" . $this->editThisPage() . "</strong>";
625 if ( 0 != $wgUser->getID() ) {
626 $s .= $sep . $this->watchThisPage();
628 $s .= $sep . $this->talkLink()
629 . $sep . $this->historyLink()
630 . $sep . $this->whatLinksHere()
631 . $sep . $this->watchPageLinksLink();
633 if ( $wgTitle->getNamespace() == Namespace::getUser()
634 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
637 $id=User
::idFromName($wgTitle->getText());
638 $ip=User
::isIP($wgTitle->getText());
640 if($id ||
$ip) { # both anons and non-anons have contri list
641 $s .= $sep . $this->userContribsLink();
643 if ( 0 != $wgUser->getID() ) { # show only to signed in users
644 if($id) { # can only email non-anons
645 $s .= $sep . $this->emailUserLink();
649 if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
650 $s .= "\n<br>" . $this->deleteThisPage() .
651 $sep . $this->protectThisPage() .
652 $sep . $this->moveThisPage();
654 $s .= "<br>\n" . $this->otherLanguages();
661 global $wgOut, $wgLang, $wgArticle;
662 global $oldid, $diff, $wgDisableCounters;
664 if ( ! $wgOut->isArticle() ) { return ""; }
665 if ( isset( $oldid ) ||
isset( $diff ) ) { return ""; }
666 if ( 0 == $wgArticle->getID() ) { return ""; }
668 if ( $wgDisableCounters ) {
671 $count = $wgLang->formatNum( $wgArticle->getCount() );
672 $s = wfMsg( "viewcount", $count );
674 $s .= $this->lastModified();
675 $s .= " " . wfMsg( "gnunote" );
679 function lastModified()
681 global $wgLang, $wgArticle;
683 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
684 $s = " " . wfMsg( "lastmodified", $d );
688 function logoText( $align = "" )
690 if ( "" != $align ) { $a = " align='{$align}'"; }
693 $mp = wfMsg( "mainpage" );
694 $titleObj = Title
::newFromText( $mp );
695 $s = "<a href=\"" . $titleObj->escapeLocalURL()
696 . "\"><img{$a} border=0 src=\""
697 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\" /></a>";
703 global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
704 global $wpPreview, $wgDisableUploads, $wgRemoteUploads;
706 $fname = "Skin::quickBar";
707 wfProfileIn( $fname );
709 $tns=$wgTitle->getNamespace();
711 $s = "\n<div id='quickbar'>";
712 $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
715 $s .= $this->mainPageLink()
716 . $sep . $this->specialLink( "recentchanges" )
717 . $sep . $this->specialLink( "randompage" );
718 if ($wgUser->getID()) {
719 $s.= $sep . $this->specialLink( "watchlist" ) ;
720 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
721 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
724 // only show watchlist link if logged in
725 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
726 $s .= "\n<br><hr class='sep'>";
727 $articleExists = $wgTitle->getArticleId();
728 if ( $wgOut->isArticle() ||
$action =="edit" ||
$action =="history" ||
$wpPreview) {
729 if($wgOut->isArticle()) {
730 $s .= "<strong>" . $this->editThisPage() . "</strong>";
731 } else { # backlink to the article in edit or history mode
732 if($articleExists){ # no backlink if no article
735 $text = wfMsg("articlepage");
738 $text = wfMsg("viewtalkpage");
741 $text = wfMsg("userpage");
744 $text = wfMsg("viewtalkpage");
747 $text = wfMsg("wikipediapage");
750 $text = wfMsg("viewtalkpage");
753 $text = wfMsg("imagepage");
756 $text = wfMsg("viewtalkpage");
759 $text= wfMsg("articlepage");
762 $link = $wgTitle->getText();
763 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
764 $link = $nstext . ":" . $link ;
767 $s .= $this->makeLink( $link, $text );
768 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
769 # we just throw in a "New page" text to tell the user that he's in edit mode,
770 # and to avoid messing with the separator that is prepended to the next item
771 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
777 if( $tns%2
&& $action!="edit" && !$wpPreview) {
778 $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
782 watching could cause problems in edit mode:
783 if user edits article, then loads "watch this article" in background and then saves
784 article with "Watch this article" checkbox disabled, the article is transparently
785 unwatched. Therefore we do not show the "Watch this page" link in edit mode
787 if ( 0 != $wgUser->getID() && $articleExists) {
788 if($action!="edit" && $action != "submit" )
790 $s .= $sep . $this->watchThisPage();
792 if ( $wgTitle->userCanEdit() )
793 $s .= $sep . $this->moveThisPage();
795 if ( $wgUser->isSysop() and $articleExists ) {
796 $s .= $sep . $this->deleteThisPage() .
797 $sep . $this->protectThisPage();
799 $s .= $sep . $this->talkLink();
800 if ($articleExists && $action !="history") {
801 $s .= $sep . $this->historyLink();
803 $s.=$sep . $this->whatLinksHere();
805 if($wgOut->isArticleRelated()) {
806 $s .= $sep . $this->watchPageLinksLink();
809 if ( Namespace::getUser() == $wgTitle->getNamespace()
810 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
813 $id=User
::idFromName($wgTitle->getText());
814 $ip=User
::isIP($wgTitle->getText());
817 $s .= $sep . $this->userContribsLink();
819 if ( 0 != $wgUser->getID() ) {
820 if($id) { # can only email real users
821 $s .= $sep . $this->emailUserLink();
825 $s .= "\n<br><hr class='sep'>";
828 if ( 0 != $wgUser->getID() && ( !$wgDisableUploads ||
$wgRemoteUploads ) ) {
829 $s .= $this->specialLink( "upload" ) . $sep;
831 $s .= $this->specialLink( "specialpages" )
832 . $sep . $this->bugReportsLink();
834 global $wgSiteSupportPage;
835 if( $wgSiteSupportPage ) {
836 $s .= "\n<br><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
837 "\" class=\"internal\">" . wfMsg( "sitesupport" ) . "</a>";
840 $s .= "\n<br></div>\n";
841 wfProfileOut( $fname );
845 function specialPagesList()
847 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
850 $validSP = $wgLang->getValidSpecialPages();
852 foreach ( $validSP as $name => $desc ) {
853 if ( "" == $desc ) { continue; }
856 if ( $wgUser->isSysop() )
858 $sysopSP = $wgLang->getSysopSpecialPages();
860 foreach ( $sysopSP as $name => $desc ) {
861 if ( "" == $desc ) { continue; }
865 if ( $wgUser->isDeveloper() )
867 $devSP = $wgLang->getDeveloperSpecialPages();
869 foreach ( $devSP as $name => $desc ) {
870 if ( "" == $desc ) { continue; }
875 $sp = wfMsg( "specialpages" );
876 $spp = $wgLang->specialPage( "Specialpages" );
878 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
879 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
880 $s .= "<select name=\"wpDropdown\">\n";
881 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
883 foreach ( $a as $name => $desc ) {
884 $p = $wgLang->specialPage( $name );
885 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
888 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
893 function mainPageLink()
895 $mp = wfMsg( "mainpage" );
896 $s = $this->makeKnownLink( $mp, $mp );
900 function copyrightLink()
902 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
903 wfMsg( "copyrightpagename" ) );
909 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
910 wfMsg( "aboutwikipedia" ) );
915 function disclaimerLink()
917 $s = $this->makeKnownLink( wfMsg( "disclaimerpage" ),
918 wfMsg( "disclaimers" ) );
922 function editThisPage()
924 global $wgOut, $wgTitle, $oldid, $redirect, $diff;
926 if ( ! $wgOut->isArticleRelated() ) {
927 $s = wfMsg( "protectedpage" );
929 $n = $wgTitle->getPrefixedText();
930 if ( $wgTitle->userCanEdit() ) {
931 $t = wfMsg( "editthispage" );
933 #$t = wfMsg( "protectedpage" );
934 $t = wfMsg( "viewsource" );
938 if ( $redirect ) { $red = "&redirect={$redirect}"; }
939 if ( $oldid && ! isset( $diff ) ) {
940 $oid = "&oldid={$oldid}";
942 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
947 function deleteThisPage()
949 global $wgUser, $wgOut, $wgTitle, $diff;
951 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
952 $n = $wgTitle->getPrefixedText();
953 $t = wfMsg( "deletethispage" );
955 $s = $this->makeKnownLink( $n, $t, "action=delete" );
962 function protectThisPage()
964 global $wgUser, $wgOut, $wgTitle, $diff;
966 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
967 $n = $wgTitle->getPrefixedText();
969 if ( $wgTitle->isProtected() ) {
970 $t = wfMsg( "unprotectthispage" );
971 $q = "action=unprotect";
973 $t = wfMsg( "protectthispage" );
974 $q = "action=protect";
976 $s = $this->makeKnownLink( $n, $t, $q );
983 function watchThisPage()
985 global $wgUser, $wgOut, $wgTitle, $diff;
987 if ( $wgOut->isArticleRelated() ) {
988 $n = $wgTitle->getPrefixedText();
990 if ( $wgTitle->userIsWatching() ) {
991 $t = wfMsg( "unwatchthispage" );
992 $q = "action=unwatch";
994 $t = wfMsg( "watchthispage" );
997 $s = $this->makeKnownLink( $n, $t, $q );
999 $s = wfMsg( "notanarticle" );
1004 function moveThisPage()
1006 global $wgTitle, $wgLang;
1008 if ( $wgTitle->userCanEdit() ) {
1009 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
1010 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
1011 } // no message if page is protected - would be redundant
1015 function historyLink()
1019 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1020 wfMsg( "history" ), "action=history" );
1024 function whatLinksHere()
1026 global $wgTitle, $wgLang;
1028 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
1029 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
1033 function userContribsLink()
1035 global $wgTitle, $wgLang;
1037 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1038 wfMsg( "contributions" ), "target=" . $wgTitle->getPartialURL() );
1042 function emailUserLink()
1044 global $wgTitle, $wgLang;
1046 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
1047 wfMsg( "emailuser" ), "target=" . $wgTitle->getPartialURL() );
1051 function watchPageLinksLink()
1053 global $wgOut, $wgTitle, $wgLang;
1055 if ( ! $wgOut->isArticleRelated() ) {
1056 $s = "(" . wfMsg( "notanarticle" ) . ")";
1058 $s = $this->makeKnownLink( $wgLang->specialPage(
1059 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
1060 "target=" . $wgTitle->getPrefixedURL() );
1065 function otherLanguages()
1067 global $wgOut, $wgLang, $wgTitle, $wgUseNewInterlanguage;
1069 $a = $wgOut->getLanguageLinks();
1071 if ( 0 == count( $a ) ) {
1072 if ( !$wgUseNewInterlanguage ) return "";
1073 $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
1074 if ( $ns != 0 AND $ns != 1 ) return "" ;
1076 $x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
1077 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1078 wfMsg( "intl" ) , $x );
1081 if ( !$wgUseNewInterlanguage ) {
1082 $s = wfMsg( "otherlanguages" ) . ": ";
1084 global $wgLanguageCode ;
1085 $x = "mode=zoom&xt=".$wgTitle->getDBkey() ;
1086 $x .= "&xl=".$wgLanguageCode ;
1087 $s = $this->makeKnownLink( $wgLang->specialPage( "Intl" ),
1088 wfMsg( "otherlanguages" ) , $x ) . ": " ;
1091 $s = wfMsg( "otherlanguages" ) . ": ";
1093 if($wgLang->isRTL()) $s .= "<span dir='LTR'>";
1094 foreach( $a as $l ) {
1095 if ( ! $first ) { $s .= " | "; }
1098 $nt = Title
::newFromText( $l );
1099 $url = $nt->getFullURL();
1100 $text = $wgLang->getLanguageName( $nt->getInterwiki() );
1102 if ( "" == $text ) { $text = $l; }
1103 $style = $this->getExternalLinkAttributes( $l, $text );
1104 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
1106 if($wgLang->isRTL()) $s .= "</span>";
1110 function bugReportsLink()
1112 $s = $this->makeKnownLink( wfMsg( "bugreportspage" ),
1113 wfMsg( "bugreports" ) );
1119 global $wgLinkCache;
1120 $t1 = Title
::newFromText( gmdate( "F j" ) );
1121 $t2 = Title
::newFromText( gmdate( "Y" ) );
1123 $wgLinkCache->suspend();
1124 $id = $t1->getArticleID();
1125 $wgLinkCache->resume();
1128 $s = $this->makeBrokenLink( $t1->getText() );
1130 $s = $this->makeKnownLink( $t1->getText() );
1134 $wgLinkCache->suspend();
1135 $id = $t2->getArticleID();
1136 $wgLinkCache->resume();
1139 $s .= $this->makeBrokenLink( $t2->getText() );
1141 $s .= $this->makeKnownLink( $t2->getText() );
1148 global $wgLang, $wgTitle, $wgLinkCache;
1150 $tns = $wgTitle->getNamespace();
1151 if ( -1 == $tns ) { return ""; }
1153 $pn = $wgTitle->getText();
1154 $tp = wfMsg( "talkpage" );
1155 if ( Namespace::isTalk( $tns ) ) {
1156 $lns = Namespace::getSubject( $tns );
1159 $text = wfMsg("articlepage");
1162 $text = wfMsg("userpage");
1165 $text = wfMsg("wikipediapage");
1168 $text = wfMsg("imagepage");
1171 $text= wfMsg("articlepage");
1175 $lns = Namespace::getTalk( $tns );
1178 $n = $wgLang->getNsText( $lns );
1179 if ( "" == $n ) { $link = $pn; }
1180 else { $link = "{$n}:{$pn}"; }
1182 $wgLinkCache->suspend();
1183 $s = $this->makeLink( $link, $text );
1184 $wgLinkCache->resume();
1189 function commentLink()
1191 global $wgLang, $wgTitle, $wgLinkCache;
1193 $tns = $wgTitle->getNamespace();
1194 if ( -1 == $tns ) { return ""; }
1196 $lns = ( Namespace::isTalk( $tns ) ) ?
$tns : Namespace::getTalk( $tns );
1198 # assert Namespace::isTalk( $lns )
1200 $n = $wgLang->getNsText( $lns );
1201 $pn = $wgTitle->getText();
1203 $link = "{$n}:{$pn}";
1205 $wgLinkCache->suspend();
1206 $s = $this->makeKnownLink($link, wfMsg("postcomment"), "action=edit§ion=new");
1207 $wgLinkCache->resume();
1212 # After all the page content is transformed into HTML, it makes
1213 # a final pass through here for things like table backgrounds.
1215 function transformContent( $text )
1220 # Note: This function MUST call getArticleID() on the link,
1221 # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
1223 function makeLink( $title, $text = "", $query = "", $trail = "" ) {
1224 wfProfileIn( "Skin::makeLink" );
1225 $nt = Title
::newFromText( $title );
1227 $result = $this->makeLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1229 wfDebug( "Invalid title passed to Skin::makeLink(): \"$title\"\n" );
1230 $result = $text == "" ?
$title : $text;
1233 wfProfileOut( "Skin::makeLink" );
1237 function makeKnownLink( $title, $text = "", $query = "", $trail = "" ) {
1238 $nt = Title
::newFromText( $title );
1240 return $this->makeKnownLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1242 wfDebug( "Invalid title passed to Skin::makeKnownLink(): \"$title\"\n" );
1243 return $text == "" ?
$title : $text;
1247 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" ) {
1248 $nt = Title
::newFromText( $title );
1250 return $this->makeBrokenLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1252 wfDebug( "Invalid title passed to Skin::makeBrokenLink(): \"$title\"\n" );
1253 return $text == "" ?
$title : $text;
1257 function makeStubLink( $title, $text = "", $query = "", $trail = "" ) {
1258 $nt = Title
::newFromText( $title );
1260 return $this->makeStubLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1262 wfDebug( "Invalid title passed to Skin::makeStubLink(): \"$title\"\n" );
1263 return $text == "" ?
$title : $text;
1267 # Pass a title object, not a title string
1268 function makeLinkObj( &$nt, $text= "", $query = "", $trail = "", $prefix = "" )
1270 global $wgOut, $wgUser;
1271 if ( $nt->isExternal() ) {
1272 $u = $nt->getFullURL();
1273 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1274 $style = $this->getExternalLinkAttributes( $link, $text );
1277 if ( "" != $trail ) {
1278 if ( preg_match( "/^([a-z]+)(.*)$$/sD", $trail, $m ) ) {
1283 $retVal = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1284 } elseif ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
1285 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1286 } elseif ( ( -1 == $nt->getNamespace() ) ||
1287 ( Namespace::getImage() == $nt->getNamespace() ) ) {
1288 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1290 $aid = $nt->getArticleID() ;
1292 $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail, $prefix );
1294 $threshold = $wgUser->getOption("stubthreshold") ;
1295 if ( $threshold > 0 ) {
1296 $res = wfQuery ( "SELECT LENGTH(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ
) ;
1298 if ( wfNumRows( $res ) > 0 ) {
1299 $s = wfFetchObject( $res );
1301 if ( $s->cur_is_redirect
OR $s->cur_namespace
!= 0 ) {
1302 $size = $threshold*2 ; # Really big
1304 wfFreeResult( $res );
1306 $size = $threshold*2 ; # Really big
1311 if ( $size < $threshold ) {
1312 $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
1314 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1321 # Pass a title object, not a title string
1322 function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1324 global $wgOut, $wgTitle;
1326 $fname = "Skin::makeKnownLinkObj";
1327 wfProfileIn( $fname );
1329 $link = $nt->getPrefixedURL();
1331 if ( "" == $link ) {
1333 if ( "" == $text ) { $text = $nt->getFragment(); }
1335 $u = $nt->escapeLocalURL( $query );
1337 if ( "" != $nt->getFragment() ) {
1338 $u .= "#" . wfEscapeHTML( $nt->getFragment() );
1340 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1341 $style = $this->getInternalLinkAttributesObj( $nt, $text );
1344 if ( "" != $trail ) {
1345 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1350 $r = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1351 wfProfileOut( $fname );
1355 # Pass a title object, not a title string
1356 function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1358 global $wgOut, $wgUser;
1360 $fname = "Skin::makeBrokenLinkObj";
1361 wfProfileIn( $fname );
1363 if ( "" == $query ) {
1366 $q = "action=edit&{$query}";
1368 $u = $nt->escapeLocalURL( $q );
1370 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1371 $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
1374 if ( "" != $trail ) {
1375 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1380 if ( $wgUser->getOption( "highlightbroken" ) ) {
1381 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1383 $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
1386 wfProfileOut( $fname );
1390 # Pass a title object, not a title string
1391 function makeStubLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1393 global $wgOut, $wgUser;
1395 $link = $nt->getPrefixedURL();
1397 $u = $nt->escapeLocalURL( $query );
1399 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1400 $style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
1403 if ( "" != $trail ) {
1404 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1409 if ( $wgUser->getOption( "highlightbroken" ) ) {
1410 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1412 $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1417 function fnamePart( $url )
1419 $basename = strrchr( $url, "/" );
1420 if ( false === $basename ) { $basename = $url; }
1421 else { $basename = substr( $basename, 1 ); }
1422 return wfEscapeHTML( $basename );
1425 function makeImage( $url, $alt = "" )
1429 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1430 $s = "<img src=\"{$url}\" alt=\"{$alt}\" />";
1434 function makeImageLink( $name, $url, $alt = "" ) {
1435 $nt = Title
::makeTitle( Namespace::getImage(), $name );
1436 return $this->makeImageLinkObj( $nt, $alt );
1439 function makeImageLinkObj( $nt, $alt = "" ) {
1440 global $wgLang, $wgUseImageResize;
1441 $name = $nt->getDBKey();
1442 $url = wfImageUrl( $name );
1444 $prefix = $postfix = "";
1446 if ( $wgUseImageResize ) {
1447 # Check if the alt text is of the form "options|alt text"
1449 # * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang
1450 # * left no resizing, just left align. label is used for alt= only
1451 # * right same, but right aligned
1452 # * none same, but not aligned
1453 # * ___px scale to ___ pixels width, no aligning. e.g. use in taxobox
1455 $part = explode( "|", $alt);
1457 $mwThumb =& MagicWord
::get( MAG_IMG_THUMBNAIL
);
1458 $mwLeft =& MagicWord
::get( MAG_IMG_LEFT
);
1459 $mwRight =& MagicWord
::get( MAG_IMG_RIGHT
);
1460 $mwNone =& MagicWord
::get( MAG_IMG_NONE
);
1461 $mwWidth =& MagicWord
::get( MAG_IMG_WIDTH
);
1462 $mwCenter =& MagicWord
::get( MAG_IMG_CENTER
);
1463 $alt = $part[count($part)-1];
1467 foreach( $part as $key => $val ) {
1468 if ( ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
1470 } elseif ( ! is_null( $mwRight->matchVariableStartToEnd($val) ) ) {
1471 # remember to set an alignment, don't render immediately
1473 } elseif ( ! is_null( $mwLeft->matchVariableStartToEnd($val) ) ) {
1474 # remember to set an alignment, don't render immediately
1476 } elseif ( ! is_null( $mwCenter->matchVariableStartToEnd($val) ) ) {
1477 # remember to set an alignment, don't render immediately
1479 } elseif ( ! is_null( $mwNone->matchVariableStartToEnd($val) ) ) {
1480 # remember to set an alignment, don't render immediately
1482 } elseif ( ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {
1483 # $match is the image width in pixels
1484 $width = intval($match);
1487 if ( "center" == $align )
1489 $prefix = "<center>";
1490 $postfix = "</center>";
1496 # Create a thumbnail. Alignment depends on language
1497 # writing direction, # right aligned for left-to-right-
1498 # languages ("Western languages"), left-aligned
1499 # for right-to-left-languages ("Semitic languages")
1501 # If thumbnail width has not been provided, it is set
1502 # here to 180 pixels
1503 if ( $align == "" ) {
1504 $align = $wgLang->isRTL() ?
"left" : "right";
1506 if ( ! isset($width) ) {
1509 return $prefix.$this->makeThumbLinkObj( $nt, $alt, $align, $width ).$postfix;
1511 } elseif ( isset($width) ) {
1513 # Create a resized image, without the additional thumbnail
1515 $url = $this->createThumb( $name, $width );
1517 } # endif $wgUseImageResize
1519 if ( empty( $alt ) ) {
1520 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1522 $alt = htmlspecialchars( $alt );
1524 $u = $nt->escapeLocalURL();
1527 $s = str_replace( "$1", $name, wfMsg("missingimage") );
1529 $s = "\n <a href=\"{$u}\" class='image' title=\"{$alt}\">\n" .
1530 " <img border=\"0\" src=\"{$url}\" alt=\"{$alt}\" />\n </a>";
1532 if ( "" != $align ) {
1533 $s = "<div class=\"float{$align}\">{$s}\n</div>";
1535 return $prefix.$s.$postfix;
1538 function createThumb( $name, $width ) {
1539 global $wgUploadDirectory;
1540 global $wgImageMagickConvertCommand;
1541 global $wgUseImageMagick;
1542 global $wgUseSquid, $wgInternalServer;
1543 $imgPath = wfImagePath( $name );
1544 $thumbName = $width."px-".$icon.$name;
1545 $thumbPath = wfImageThumbDir( $thumbName )."/".$thumbName;
1546 $thumbUrl = wfImageThumbUrl( $thumbName );
1548 if ( ! file_exists( $imgPath ) )
1550 # If there is no image, there will be no thumbnail
1554 if ( (! file_exists( $thumbPath ) )
1555 ||
( filemtime($thumbPath) < filemtime($imgPath) ) ) {
1557 if ( $wgUseSquid ) {
1559 $wgInternalServer.$thumbUrl
1561 wfPurgeSquidServers($urlArr);
1564 if ( $wgUseImageMagick ) {
1566 $cmd = $wgImageMagickConvertCommand .
1567 " -quality 85 -geometry {$width} ".
1568 escapeshellarg($imgPath) . " " .
1569 escapeshellarg($thumbPath);
1570 $conv = shell_exec( $cmd );
1572 # Use PHP's builtin GD library functions.
1574 # First find out what kind of file this is, and select the correct
1575 # input routine for this.
1576 list($src_width, $src_height, $src_type, $src_attr) = getimagesize( $imgPath );
1577 switch( $src_type ) {
1579 $src_image = imagecreatefromgif( $imgPath );
1582 $src_image = imagecreatefromjpeg( $imgPath );
1585 $src_image = imagecreatefrompng( $imgPath );
1587 case 15: # WBMP for WML
1588 $src_image = imagecreatefromwbmp( $imgPath );
1591 $src_image = imagecreatefromxbm( $imgPath );
1594 return "Image type not supported";
1597 $height = floor( $src_height * ( $width/$src_width ) );
1598 $dst_image = imagecreatetruecolor( $width, $height );
1599 imagecopyresampled( $dst_image, $src_image,
1601 $width, $height, $src_width, $src_height );
1602 switch( $src_type ) {
1607 #$thumbUrl .= ".png";
1608 #$thumbPath .= ".png";
1609 imagepng( $dst_image, $thumbPath );
1612 #$thumbUrl .= ".jpg";
1613 #$thumbPath .= ".jpg";
1614 imageinterlace( $dst_image );
1615 imagejpeg( $dst_image, $thumbPath, 95 );
1620 imagedestroy( $dst_image );
1621 imagedestroy( $src_image );
1626 # Check for zero-sized thumbnails. Those can be generated when
1627 # no disk space is available or some other error occurs
1629 $thumbstat = stat( $thumbPath );
1630 $imgstat = stat( $imgPath );
1631 if( $thumbstat["size"] == 0 )
1633 unlink( $thumbPath );
1640 function makeThumbLinkObj( $nt, $label = "", $align = "right", $boxwidth = 180 ) {
1641 global $wgUploadPath, $wgLang;
1642 $name = $nt->getDBKey();
1643 $image = Title
::makeTitle( Namespace::getImage(), $name );
1644 $url = wfImageUrl( $name );
1645 $path = wfImagePath( $name );
1647 #$label = htmlspecialchars( $label );
1648 $alt = preg_replace( "/<[^>]*>/", "", $label);
1649 $alt = htmlspecialchars( $alt );
1651 if ( file_exists( $path ) )
1653 list($width, $height, $type, $attr) = getimagesize( $path );
1655 $width = $height = 200;
1657 $boxheight = intval( $height/($width/$boxwidth) );
1658 if ( $boxwidth > $width ) {
1660 $boxheight = $height;
1663 $thumbUrl = $this->createThumb( $name, $boxwidth );
1665 $u = $nt->escapeLocalURL();
1667 $more = htmlspecialchars( wfMsg( "thumbnail-more" ) );
1668 $magnifyalign = $wgLang->isRTL() ?
"left" : "right";
1669 $textalign = $wgLang->isRTL() ?
" style=\"text-align:right\"" : "";
1671 $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$boxwidth}px;\">";
1672 if ( $thumbUrl == "" ) {
1673 $s .= str_replace( "$1", $name, wfMsg("missingimage") );
1675 $s .= "\n".' <a href="'.$u.'" class="internal" title="'.$alt.'">'."\n".
1676 ' <img border="0" src="'.$thumbUrl.'" alt="'.$alt.'" ' .
1677 ' width="'.$boxwidth.'" height="'.$boxheight.'" /></a>' ."\n".
1678 ' <a href="'.$u.'" class="internal" title="'.$more.'"> ' ."\n".
1679 ' <img border="0" src="'.$wgUploadPath.'/magnify-clip.png" ' .
1680 'width="26" height="24" align="'.$magnifyalign.'" alt="'.$more.'" /> </a>'."\n";
1682 $s .= ' <p'.$textalign.'>'.$label."</p>\n</div>";
1686 function makeMediaLink( $name, $url, $alt = "" ) {
1687 $nt = Title
::makeTitle( Namespace::getMedia(), $name );
1688 return $this->makeMediaLinkObj( $nt, $alt );
1691 function makeMediaLinkObj( $nt, $alt = "" )
1693 $name = $nt->getDBKey();
1694 $url = wfImageUrl( $name );
1695 if ( empty( $alt ) ) {
1696 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1699 $u = htmlspecialchars( $url );
1700 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1704 function specialLink( $name, $key = "" )
1708 if ( "" == $key ) { $key = strtolower( $name ); }
1709 $pn = $wgLang->ucfirst( $name );
1710 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1714 # Called by history lists and recent changes
1717 # Returns text for the start of the tabular part of RC
1718 function beginRecentChangesList()
1720 $this->rc_cache
= array() ;
1721 $this->rcMoveIndex
= 0;
1722 $this->rcCacheIndex
= 0 ;
1723 $this->lastdate
= "";
1727 function beginImageHistoryList()
1729 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1730 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul class='special'>";
1734 # Returns text for the end of RC
1735 # If enhanced RC is in use, returns pretty much all the text
1736 function endRecentChangesList()
1738 $s = $this->recentChangesBlock() ;
1743 # Enhanced RC ungrouped line
1744 function recentChangesBlockLine ( $rcObj )
1746 global $wgUploadPath, $wgLang ;
1748 # Get rc_xxxx variables
1749 extract( $rcObj->mAttribs
) ;
1750 $curIdEq = "curid=$rc_cur_id";
1755 $r .= "<img src='{$wgUploadPath}/Arr_.png' width='12' height='12' border='0' />" ; $r .= "<tt>" ;
1757 if ( $rc_type == RC_MOVE
) {
1758 $r .= " ";
1760 # M & N (minor & new)
1761 $M = wfMsg( "minoreditletter" );
1762 $N = wfMsg( "newpageletter" );
1764 if ( $rc_type == RC_NEW
) {
1777 $r .= " ".$rcObj->timestamp
." " ;
1781 $link = $rcObj->link
;
1782 if ( $rcObj->watched
) $link = "<strong>{$link}</strong>" ;
1787 $r .= $rcObj->curlink
;
1791 $r .= $this->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
1794 $r .= ") . . ".$rcObj->userlink
;
1795 $r .= $rcObj->usertalklink
;
1798 if ( $rc_comment != "" && $rc_type != RC_MOVE
) {
1799 $rc_comment=$this->formatComment($rc_comment);
1800 $r .= $wgLang->emphasize( " (".$rc_comment.")" );
1808 function recentChangesBlockGroup ( $block )
1810 global $wgUploadPath, $wgLang ;
1813 $M = wfMsg( "minoreditletter" );
1814 $N = wfMsg( "newpageletter" );
1816 # Collate list of users
1818 $userlinks = array () ;
1819 foreach ( $block AS $rcObj ) {
1820 $oldid = $rcObj->mAttribs
['rc_last_oldid'];
1821 if ( $rcObj->mAttribs
['rc_new'] ) $isnew = true ;
1822 $u = $rcObj->userlink
;
1823 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1827 # Sort the list and convert to text
1828 krsort ( $userlinks ) ;
1829 asort ( $userlinks ) ;
1831 foreach ( $userlinks as $userlink => $count) {
1833 if ( $count > 1 ) $text .= " ({$count}×)" ;
1834 array_push ( $users , $text ) ;
1836 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1839 $rci = "RCI{$this->rcCacheIndex}" ;
1840 $rcl = "RCL{$this->rcCacheIndex}" ;
1841 $rcm = "RCM{$this->rcCacheIndex}" ;
1842 $toggleLink = "javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")" ;
1843 $arrowdir = $wgLang->isRTL() ?
"l" : "r";
1844 $tl = "<span id='{$rcm}'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_{$arrowdir}.png' width='12' height='12' border='0' /></a></span>" ;
1845 $tl .= "<span id='{$rcl}' style='display:none'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_d.png' width='12' height='12' border='0' /></a></span>" ;
1851 if ( $isnew ) $r .= $N ;
1852 else $r .= " " ;
1853 $r .= " " ; # Minor
1856 $r .= " ".$block[0]->timestamp
." " ;
1860 $link = $block[0]->link
;
1861 if ( $block[0]->watched
) $link = "<strong>{$link}</strong>" ;
1864 $curIdEq = "curid=" . $block[0]->mAttribs
['rc_cur_id'];
1865 if ( $block[0]->mAttribs
['rc_type'] != RC_LOG
) {
1867 $r .= " (".count($block)." " ;
1868 if ( $isnew ) $r .= wfMsg("changes");
1869 else $r .= $this->makeKnownLinkObj( $block[0]->getTitle() , wfMsg("changes") ,
1870 "{$curIdEq}&diff=0&oldid=".$oldid ) ;
1874 $r .= $this->makeKnownLinkObj( $block[0]->getTitle(), wfMsg( "history" ), "{$curIdEq}&action=history" );
1882 $r .= "<div id='{$rci}' style='display:none'>" ;
1883 foreach ( $block AS $rcObj ) {
1884 # Get rc_xxxx variables
1885 extract( $rcObj->mAttribs
);
1887 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0 />";
1888 $r .= "<tt> " ;
1889 if ( $rc_new ) $r .= $N ;
1890 else $r .= " " ;
1891 if ( $rc_minor ) $r .= $M ;
1892 else $r .= " " ;
1896 if ( $rc_last_oldid != 0 ) {
1897 $o = "oldid=".$rc_last_oldid ;
1899 if ( $rc_type == RC_LOG
) {
1900 $link = $rcObj->timestamp
;
1902 $link = $this->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp
, "{$curIdEq}&$o" ) ;
1904 $link = "<tt>{$link}</tt>" ;
1908 $r .= $rcObj->curlink
;
1910 $r .= $rcObj->lastlink
;
1911 $r .= ") . . ".$rcObj->userlink
;
1912 $r .= $rcObj->usertalklink
;
1913 if ( $rc_comment != "" ) {
1914 $rc_comment=$this->formatComment($rc_comment);
1915 $r .= $wgLang->emphasize( " (".$rc_comment.")" ) ;
1921 $this->rcCacheIndex++
;
1925 # If enhanced RC is in use, this function takes the previously cached
1926 # RC lines, arranges them, and outputs the HTML
1927 function recentChangesBlock ()
1929 global $wgUploadPath ;
1930 if ( count ( $this->rc_cache
) == 0 ) return "" ;
1932 foreach ( $this->rc_cache
AS $secureName => $block ) {
1933 if ( count ( $block ) < 2 ) {
1934 $blockOut .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ;
1936 $blockOut .= $this->recentChangesBlockGroup ( $block ) ;
1940 return "<div>{$blockOut}</div>" ;
1943 # Called in a loop over all displayed RC entries
1944 # Either returns the line, or caches it for later use
1945 function recentChangesLine( &$rc, $watched = false )
1948 $usenew = $wgUser->getOption( "usenewrc" );
1950 $line = $this->recentChangesLineNew ( $rc, $watched ) ;
1952 $line = $this->recentChangesLineOld ( $rc, $watched ) ;
1956 function recentChangesLineOld( &$rc, $watched = false )
1958 global $wgTitle, $wgLang, $wgUser;
1960 # Extract DB fields into local scope
1961 extract( $rc->mAttribs
);
1962 $curIdEq = "curid=" . $rc_cur_id;
1964 # Make date header if necessary
1965 $date = $wgLang->date( $rc_timestamp, true);
1967 if ( $date != $this->lastdate
) {
1968 if ( "" != $this->lastdate
) { $s .= "</ul>\n"; }
1969 $s .= "<h4>{$date}</h4>\n<ul class='special'>";
1970 $this->lastdate
= $date;
1974 if ( $rc_type == RC_MOVE
) {
1976 $s .= "(" . wfMsg( "diff" ) . ") (";
1978 $s .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), wfMsg( "hist" ), "action=history" ) .
1981 # "[[x]] moved to [[y]]"
1983 $s .= wfMsg( "1movedto2", $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" ),
1984 $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" ) );
1988 if ( $rc_type == RC_NEW ||
$rc_type == RC_LOG
) {
1989 $diffLink = wfMsg( "diff" );
1991 $diffLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "diff" ),
1992 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
1994 $s .= "($diffLink) (";
1997 $s .= $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
2000 # M and N (minor and new)
2001 $M = wfMsg( "minoreditletter" );
2002 $N = wfMsg( "newpageletter" );
2003 if ( $rc_minor ) { $s .= " <strong>{$M}</strong>"; }
2004 if ( $rc_type == RC_NEW
) { $s .= "<strong>{$N}</strong>"; }
2007 $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), "" );
2010 $articleLink = "<strong>{$articleLink}</strong>";
2012 $s .= " $articleLink";
2017 $s .= "; " . $wgLang->time( $rc_timestamp, true ) . " . . ";
2019 # User link (or contributions for unregistered users)
2020 if ( 0 == $rc_user ) {
2021 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2022 $rc_user_text, "target=" . $rc_user_text );
2024 $userLink = $this->makeLink( $wgLang->getNsText( NS_USER
) . ":{$rc_user_text}", $rc_user_text );
2029 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2030 global $wgDisableAnonTalk;
2031 if( 0 == $rc_user && $wgDisableAnonTalk ) {
2034 $utns=$wgLang->getNsText(NS_USER_TALK
);
2035 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2039 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2040 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2041 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2045 if($userTalkLink) $userTalkLink .= " | ";
2046 $userTalkLink .= $blockLink;
2048 if($userTalkLink) $s.=" ({$userTalkLink})";
2051 if ( "" != $rc_comment && "*" != $rc_comment && $rc_type != RC_MOVE
) {
2052 $rc_comment=$this->formatComment($rc_comment);
2053 $s .= $wgLang->emphasize(" (" . $rc_comment . ")");
2060 # function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
2061 function recentChangesLineNew( &$baseRC, $watched = false )
2063 global $wgTitle, $wgLang, $wgUser;
2065 # Create a specialised object
2066 $rc = RCCacheEntry
::newFromParent( $baseRC ) ;
2068 # Extract fields from DB into the function scope (rc_xxxx variables)
2069 extract( $rc->mAttribs
);
2070 $curIdEq = "curid=" . $rc_cur_id;
2072 # If it's a new day, add the headline and flush the cache
2073 $date = $wgLang->date( $rc_timestamp, true);
2075 if ( $date != $this->lastdate
) {
2076 # Process current cache
2077 $ret = $this->recentChangesBlock () ;
2078 $this->rc_cache
= array() ;
2079 $ret .= "<h4>{$date}</h4>\n";
2080 $this->lastdate
= $date;
2084 if ( $rc_type == RC_MOVE
) {
2085 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" );
2086 $clink .= " " . wfMsg("movedto") . " ";
2087 $clink .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" );
2089 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "" ) ;
2092 $time = $wgLang->time( $rc_timestamp, true );
2093 $rc->watched
= $watched ;
2094 $rc->link
= $clink ;
2095 $rc->timestamp
= $time;
2098 if ( ( $rc_type == RC_NEW
&& $rc_this_oldid == 0 ) ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2099 $curLink = wfMsg( "cur" );
2101 $curLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "cur" ),
2102 "{$curIdEq}&diff=0&oldid={$rc_this_oldid}" );
2106 $titleObj = $rc->getTitle();
2107 if ( $rc_last_oldid == 0 ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2108 $lastLink = wfMsg( "last" );
2110 $lastLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "last" ),
2111 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
2114 # Make user link (or user contributions for unregistered users)
2115 if ( 0 == $rc_user ) {
2116 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2117 $rc_user_text, "target=" . $rc_user_text );
2119 $userLink = $this->makeLink( $wgLang->getNsText(
2120 Namespace::getUser() ) . ":{$rc_user_text}", $rc_user_text );
2123 $rc->userlink
= $userLink ;
2124 $rc->lastlink
= $lastLink ;
2125 $rc->curlink
= $curLink ;
2127 # Make user talk link
2128 $utns=$wgLang->getNsText(NS_USER_TALK
);
2129 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2130 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2132 global $wgDisableAnonTalk;
2133 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2134 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2135 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2136 if( $wgDisableAnonTalk )
2137 $rc->usertalklink
= " ({$blockLink})";
2139 $rc->usertalklink
= " ({$userTalkLink} | {$blockLink})";
2141 if( $wgDisableAnonTalk && ($rc_user == 0) )
2142 $rc->usertalklink
= "";
2144 $rc->usertalklink
= " ({$userTalkLink})";
2147 # Put accumulated information into the cache, for later display
2148 # Page moves go on their own line
2149 $title = $rc->getTitle();
2150 $secureName = $title->getPrefixedDBkey();
2151 if ( $rc_type == RC_MOVE
) {
2152 # Use an @ character to prevent collision with page names
2153 $this->rc_cache
["@@" . ($this->rcMoveIndex++
)] = array($rc);
2155 if ( !isset ( $this->rc_cache
[$secureName] ) ) $this->rc_cache
[$secureName] = array() ;
2156 array_push ( $this->rc_cache
[$secureName] , $rc ) ;
2161 function endImageHistoryList()
2167 /* This function is called by all recent changes variants, by the page history,
2168 and by the user contributions list. It is responsible for formatting edit
2169 comments. It escapes any HTML in the comment, but adds some CSS to format
2170 auto-generated comments (from section editing).
2172 function formatComment($comment)
2174 $comment=wfEscapeHTML($comment);
2176 # format text between /* .. */ with autocomment CSS class
2177 $comment=preg_replace("/\/\*\s*(.*?)\s*\*\//i",
2178 "<span id=\"autocomment\">$1</span>",$comment);
2182 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
2184 global $wgUser, $wgLang, $wgTitle;
2186 $dt = $wgLang->timeanddate( $ts, true );
2187 $del = wfMsg( "deleteimg" );
2188 $cur = wfMsg( "cur" );
2191 $url = wfImageUrl( $img );
2193 if ( $wgUser->isSysop() ) {
2194 $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
2196 $style = $this->getInternalLinkAttributes( $link, $del );
2198 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
2203 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
2204 if( $wgUser->getID() != 0 ) {
2205 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2206 wfMsg( "revertimg" ), "action=revert&oldimage=" .
2207 urlencode( $img ) );
2208 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2209 $del, "action=delete&oldimage=" . urlencode( $img ) );
2211 # Having live active links for non-logged in users
2212 # means that bots and spiders crawling our site can
2213 # inadvertently change content. Baaaad idea.
2214 $rlink = wfMsg( "revertimg" );
2218 if ( 0 == $u ) { $ul = $ut; }
2219 else { $ul = $this->makeLink( $wgLang->getNsText(
2220 Namespace::getUser() ) . ":{$ut}", $ut ); }
2222 $nb = wfMsg( "nbytes", $size );
2223 $style = $this->getInternalLinkAttributes( $url, $dt );
2225 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
2226 . " . . {$ul} ({$nb})";
2228 if ( "" != $c && "*" != $c ) {
2229 $s .= $wgLang->emphasize(" (" . wfEscapeHTML( $c ) . ")");
2235 function tocIndent($level) {
2236 return str_repeat( "<div class='tocindent'>\n", $level );
2239 function tocUnindent($level) {
2240 return str_repeat( "</div>\n", $level );
2243 # parameter level defines if we are on an indentation level
2244 function tocLine( $anchor, $tocline, $level ) {
2245 $link = "<a href=\"#$anchor\">$tocline</a><br />";
2249 return "<div class='tocline'>$link</div>\n";
2254 function tocTable($toc) {
2255 # note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
2256 # try min-width & co when somebody gets a chance
2257 $hideline = " <script type='text/javascript'>showTocToggle(\"" . addslashes( wfMsg("showtoc") ) . "\",\"" . addslashes( wfMsg("hidetoc") ) . "\")</script>";
2259 "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
2260 "<b>".wfMsg("toc")."</b>" .
2262 "</td></tr><tr id='tocinside'><td>\n".
2263 $toc."</td></tr></table><P>\n";
2266 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
2267 function editSectionScript( $section, $head ) {
2268 global $wgTitle, $wgRequest;
2269 if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
2272 $url = $wgTitle->escapeLocalURL( "action=edit§ion=$section" );
2273 return "<span oncontextmenu='document.location=\"$url\";return false;'>{$head}</span>";
2276 function editSectionLink( $section ) {
2278 global $wgTitle, $wgUser, $wgLang;
2280 if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
2281 # Section edit links would be out of sync on an old page.
2282 # But, if we're diffing to the current page, they'll be
2287 $editurl = "§ion={$section}";
2288 $url = $this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
2290 if( $wgLang->isRTL() ) {
2292 $nearside = "right";
2297 return "<div class=\"editsection\" style=\"float:$farside;margin-$nearside:5px;\">[".$url."]</div>";
2301 // This function is called by EditPage.php and shows a bulletin board style
2302 // toolbar for common editing functions. It can be disabled in the user preferences.
2303 // The necsesary JavaScript code can be found in style/wikibits.js.
2304 function getEditToolbar() {
2306 global $wgUploadPath,$wgLang;
2308 // toolarray an array of arrays which each include the filename of
2309 // the button image (without path), the opening tag, the closing tag,
2310 // and optionally a sample text that is inserted between the two when no
2311 // selection is highlighted.
2312 // The tip text is shown when the user moves the mouse over the button.
2314 array( "image"=>"button_bold.png",
2317 "sample"=>wfMsg("bold_sample"),
2318 "tip"=>wfMsg("bold_tip")),
2319 array( "image"=>"button_italic.png",
2322 "sample"=>wfMsg("italic_sample"),
2323 "tip"=>wfMsg("italic_tip")),
2324 array( "image"=>"button_link.png",
2327 "sample"=>wfMsg("link_sample"),
2328 "tip"=>wfMsg("link_tip")),
2329 array( "image"=>"button_extlink.png",
2332 "sample"=>wfMsg("extlink_sample"),
2333 "tip"=>wfMsg("extlink_tip")),
2334 array( "image"=>"button_headline.png",
2337 "sample"=>wfMsg("headline_sample"),
2338 "tip"=>wfMsg("headline_tip")),
2339 array( "image"=>"button_image.png",
2340 "open"=>"[[".$wgLang->getNsText(NS_IMAGE
).":",
2342 "sample"=>wfMsg("image_sample"),
2343 "tip"=>wfMsg("image_tip")),
2344 array( "image"=>"button_media.png",
2345 "open"=>"[[".$wgLang->getNsText(NS_MEDIA
).":",
2347 "sample"=>wfMsg("media_sample"),
2348 "tip"=>wfMsg("media_tip")),
2349 array( "image"=>"button_math.png",
2350 "open"=>"\\<math\\>",
2351 "close"=>"\\</math\\>",
2352 "sample"=>wfMsg("math_sample"),
2353 "tip"=>wfMsg("math_tip")),
2354 array( "image"=>"button_nowiki.png",
2355 "open"=>"\\<nowiki\\>",
2356 "close"=>"\\</nowiki\\>",
2357 "sample"=>wfMsg("nowiki_sample"),
2358 "tip"=>wfMsg("nowiki_tip")),
2359 array( "image"=>"button_sig.png",
2363 "tip"=>wfMsg("sig_tip")),
2364 array( "image"=>"button_hr.png",
2365 "open"=>"\\n----\\n",
2368 "tip"=>wfMsg("hr_tip"))
2370 $toolbar ="<script type='text/javascript'>\n";
2371 $toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
2372 foreach($toolarray as $tool) {
2374 $image=$wgUploadPath."/".$tool["image"];
2375 $open=$tool["open"];
2376 $close=$tool["close"];
2377 $sample = addslashes( $tool["sample"] );
2379 // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
2380 // Older browsers show a "speedtip" type message only for ALT.
2381 // Ideally these should be different, realistically they
2382 // probably don't need to be.
2383 $tip = addslashes( $tool["tip"] );
2384 $toolbar.="addButton('$image','$tip','$open','$close','$sample');\n";
2387 $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "','" . addslashes(wfMsg("infobox_alert")) . "','" . addslashes(wfMsg("infobox_mozvote"))."');\n";
2388 $toolbar.="document.writeln(\"</div>\");\n</script>";
2393 include_once( "SkinStandard.php" );
2394 include_once( "SkinNostalgia.php" );
2395 include_once( "SkinCologneBlue.php" );
2397 if( $wgUseSmarty ) {
2398 include_once( "SkinSmarty.php" );
2400 if( $wgUsePHPTal ) {
2401 include_once( "SkinPHPTal.php" );