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 include_once( "RecentChange.php" );
21 # For some odd PHP bug, this function can't be part of a class
22 function getCategories ()
24 global $wgOut , $wgTitle , $wgUseCategoryMagic , $wgUser , $wgParser ;
25 if ( !isset ( $wgUseCategoryMagic ) ||
!$wgUseCategoryMagic ) return "" ;
26 if ( count ( $wgParser->mCategoryLinks
) == 0 ) return "" ;
27 if ( !$wgOut->isArticle() ) return "" ;
28 $sk = $wgUser->getSkin() ;
31 $s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ;
32 $t = implode ( " | " , $wgParser->mCategoryLinks
) ;
33 if ( $t != "" ) $s .= " : " ;
38 class RCCacheEntry
extends RecentChange
40 var $secureName, $link;
41 var $curlink , $lastlink , $usertalklink , $versionlink ;
42 var $userlink, $timestamp, $watched;
44 function newFromParent( $rc )
46 $rc2 = new RCCacheEntry
;
47 $rc2->mAttribs
= $rc->mAttribs
;
48 $rc2->mExtra
= $rc->mExtra
;
55 /* private */ var $lastdate, $lastline;
56 var $linktrail ; # linktrail regexp
57 var $rc_cache ; # Cache for Enhanced Recent Changes
58 var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
63 $this->linktrail
= wfMsg("linktrail");
66 function getSkinNames()
68 global $wgValidSkinNames;
69 return $wgValidSkinNames;
72 function getStylesheet()
74 return "wikistandard.css";
79 global $wgOut, $wgUser;
81 if ( $wgOut->isQuickbarSuppressed() ) { return 0; }
82 $q = $wgUser->getOption( "quickbar" );
83 if ( "" == $q ) { $q = 0; }
87 function initPage( &$out )
89 global $wgStyleSheetPath;
90 $fname = "Skin::initPage";
91 wfProfileIn( $fname );
93 $out->addLink( "shortcut icon", "", "/favicon.ico" );
95 wfProfileOut( $fname );
98 function outputPage( &$out ) {
99 global $wgDebugComments;
101 wfProfileIn( "Skin::outputPage" );
102 $this->initPage( $out );
103 $out->out( $out->headElement() );
105 $out->out( "\n<body" );
106 $ops = $this->getBodyOptions();
107 foreach ( $ops as $name => $val ) {
108 $out->out( " $name='$val'" );
111 if ( $wgDebugComments ) {
112 $out->out( "<!-- Wiki debugging output:\n" .
113 $out->mDebugtext
. "-->\n" );
115 $out->out( $this->beforeContent() );
117 $out->out( $out->mBodytext
);
119 $out->out( $this->afterContent() );
122 $out->out( $out->reportTime() );
124 $out->out( "\n</body></html>" );
127 function getHeadScripts() {
128 global $wgStyleSheetPath;
129 $r = "<script type=\"text/javascript\" src=\"{$wgStyleSheetPath}/wikibits.js\"></script>\n";
133 function getUserStyles()
135 global $wgOut, $wgStyleSheetPath;
136 if( $wgOut->isPrintable() ) {
137 $sheet = "wikiprintable.css";
139 $sheet = $this->getStylesheet();
141 $s = "<style type='text/css'><!--\n";
142 $s .= "@import url(\"$wgStyleSheetPath/$sheet\");\n";
143 $s .= "/*/*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
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 if ( $wgOut->isPrintable() ) { $r = " class='printable'"; }
210 else { $r = " class='external'"; }
212 if ( 1 == $wgUser->getOption( "hover" ) ) {
213 $r .= " title=\"{$link}\"";
218 function getInternalLinkAttributes( $link, $text, $broken = false )
220 global $wgUser, $wgOut;
222 $link = urldecode( $link );
223 $link = str_replace( "_", " ", $link );
224 $link = wfEscapeHTML( $link );
226 if ( $wgOut->isPrintable() ) {
227 $r = " class='printable'";
228 } else if ( $broken == "stub" ) {
229 $r = " class='stub'";
230 } else if ( $broken == "yes" ) {
233 $r = " class='internal'";
236 if ( 1 == $wgUser->getOption( "hover" ) ) {
237 $r .= " title=\"{$link}\"";
242 function getInternalLinkAttributesObj( &$nt, $text, $broken = false )
244 global $wgUser, $wgOut;
246 if ( $wgOut->isPrintable() ) {
247 $r = " class='printable'";
248 } else if ( $broken == "stub" ) {
249 $r = " class='stub'";
250 } else if ( $broken == "yes" ) {
253 $r = " class='internal'";
256 if ( 1 == $wgUser->getOption( "hover" ) ) {
257 $r .= ' title ="' . $nt->getEscapedText() . '"';
268 # This will be called immediately after the <body> tag. Split into
269 # two functions to make it easier to subclass.
271 function beforeContent()
273 global $wgUser, $wgOut, $wgSiteNotice;
275 if ( $wgOut->isPrintable() ) {
276 $s = $this->pageTitle() . $this->pageSubtitle() . "\n";
277 $s .= "\n<div class='bodytext'>";
280 if( $wgSiteNotice ) {
281 $note = "\n<div id='notice' style='font-weight: bold; color: red; text-align: center'>$wgSiteNotice</div>\n";
285 return $this->doBeforeContent() . $note;
288 function doBeforeContent()
290 global $wgUser, $wgOut, $wgTitle, $wgLang;
291 $fname = "Skin::doBeforeContent";
292 wfProfileIn( $fname );
295 $qb = $this->qbSetting();
297 if( $langlinks = $this->otherLanguages() ) {
303 $borderhack = "class='top'";
306 $s .= "\n<div id='content'>\n<div id='topbar'>" .
307 "<table width='98%' border=0 cellspacing=0><tr>";
310 $left = ($qb == 1 ||
$qb == 3);
311 if($wgLang->isRTL()) $left = !$left;
314 $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>" .
315 $this->logoText() . "</td>";
317 $s .= $this->getQuickbarCompensator( $rows );
319 $l = $wgLang->isRTL() ?
"right" : "left";
320 $s .= "<td {$borderhack} align='$l' valign='top'>";
322 $s .= $this->topLinks() ;
323 $s .= "<p class='subtitle'>" . $this->pageTitleLinks();
325 $r = $wgLang->isRTL() ?
"left" : "right";
326 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap>";
327 $s .= $this->nameAndLogin();
328 $s .= "\n<br>" . $this->searchForm() . "</td>";
331 $s .= "</tr>\n<tr><td class='top' colspan=\"2\">$langlinks</td>";
334 if ( $shove && !$left ) { # Right
335 $s .= $this->getQuickbarCompensator( $rows );
337 $s .= "</tr></table>\n</div>\n";
338 $s .= "\n<div id='article'>";
340 $s .= $this->pageTitle();
341 $s .= $this->pageSubtitle() ;
342 $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
344 wfProfileOut( $fname );
348 function getQuickbarCompensator( $rows = 1 )
350 return "<td width='152' rowspan='{$rows}'> </td>";
353 # This gets called immediately before the </body> tag.
355 function afterContent()
357 global $wgUser, $wgOut, $wgServer;
358 global $wgTitle, $wgLang;
360 if ( $wgOut->isPrintable() ) {
363 $u = htmlspecialchars( $wgServer . $wgTitle->getFullURL() );
364 $u = "<a href=\"$u\">$u</a>";
365 $rf = wfMsg( "retrievedfrom", $u );
367 if ( $wgOut->isArticle() ) {
368 $lm = "<br>" . $this->lastModified();
371 $cr = wfMsg( "gnunote" );
372 $s .= "<p>" . $wgLang->emphasize("{$rf}{$lm} {$cr}\n");
375 return $this->doAfterContent();
378 function doAfterContent()
380 global $wgUser, $wgOut, $wgLang;
381 $fname = "Skin::doAfterContent";
382 wfProfileIn( $fname );
383 wfProfileIn( "$fname-1" );
385 $s = "\n</div><br clear=all>\n";
386 $s .= "\n<div id='footer'>";
387 $s .= "<table width='98%' border=0 cellspacing=0><tr>";
389 wfProfileOut( "$fname-1" );
390 wfProfileIn( "$fname-2" );
392 $qb = $this->qbSetting();
394 $left = ($qb == 1 ||
$qb == 3);
395 if($wgLang->isRTL()) $left = !$left;
397 if ( $shove && $left ) { # Left
398 $s .= $this->getQuickbarCompensator();
400 wfProfileOut( "$fname-2" );
401 wfProfileIn( "$fname-3" );
402 $l = $wgLang->isRTL() ?
"right" : "left";
403 $s .= "<td class='bottom' align='$l' valign='top'>";
405 $s .= $this->bottomLinks();
406 $s .= "\n<br>" . $this->mainPageLink()
407 . " | " . $this->aboutLink()
408 . " | " . $this->specialLink( "recentchanges" )
409 . " | " . $this->searchForm()
410 . "<br>" . $this->pageStats();
413 if ( $shove && !$left ) { # Right
414 $s .= $this->getQuickbarCompensator();
416 $s .= "</tr></table>\n</div>\n</div>\n";
418 wfProfileOut( "$fname-3" );
419 wfProfileIn( "$fname-4" );
420 if ( 0 != $qb ) { $s .= $this->quickBar(); }
421 wfProfileOut( "$fname-4" );
422 wfProfileOut( $fname );
426 function pageTitleLinks()
428 global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval;
430 $s = $this->printableLink();
431 if ( wfMsg ( "disclaimers" ) != "-" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
433 if ( $wgOut->isArticleRelated() ) {
434 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
435 $name = $wgTitle->getDBkey();
436 $link = wfEscapeHTML( wfImageUrl( $name ) );
437 $style = $this->getInternalLinkAttributes( $link, $name );
438 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
440 # This will show the "Approve" link if $wgUseApproval=true;
441 if ( isset ( $wgUseApproval ) && $wgUseApproval )
443 $t = $wgTitle->getDBkey();
444 $name = "Approve this article" ;
445 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
446 #wfEscapeHTML( wfImageUrl( $name ) );
447 $style = $this->getExternalLinkAttributes( $link, $name );
448 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
451 if ( "history" == $action ||
isset( $diff ) ||
isset( $oldid ) ) {
452 $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
453 wfMsg( "currentrev" ) );
456 if ( $wgUser->getNewtalk() ) {
457 # do not show "You have new messages" text when we are viewing our
460 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
461 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
462 $n =$wgUser->getName();
463 $tl = $this->makeKnownLink( $wgLang->getNsText(
464 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
465 wfMsg("newmessageslink") );
466 $s.=" | <strong>". wfMsg( "newmessages", $tl ) . "</strong>";
469 if( $wgUser->isSysop() &&
470 (($wgTitle->getArticleId() == 0) ||
($action == "history")) &&
471 ($n = $wgTitle->isDeleted() ) ) {
472 $s .= " | " . wfMsg( "thisisdeleted",
473 $this->makeKnownLink(
474 $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
475 wfMsg( "restorelink", $n ) ) );
480 function printableLink()
482 global $wgOut, $wgFeedClasses, $wgRequest;
484 $baseurl = $_SERVER['REQUEST_URI'];
485 if( strpos( "?", $baseurl ) == false ) {
490 $baseurl = htmlspecialchars( $baseurl );
491 $printurl = $wgRequest->escapeAppendQuery( "printable=yes" );
493 $s = "<a href=\"$printurl\">" . wfMsg( "printableversion" ) . "</a>";
494 if( $wgOut->isSyndicated() ) {
495 foreach( $wgFeedClasses as $format => $class ) {
496 $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
497 $s .= " | <a href=\"$feedurl\">{$format}</a>";
505 global $wgOut, $wgTitle, $wgUser;
507 $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
508 if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
512 function pageSubtitle()
514 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
516 $sub = $wgOut->getSubtitle();
518 global $wgExtraSubtitle;
519 $sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
521 if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
522 $ptext=$wgTitle->getPrefixedText();
523 if(preg_match("/\//",$ptext)) {
524 $sub.="</p><p class='subpages'>";
525 $links=explode("/",$ptext);
528 foreach($links as $link) {
530 if ($c<count($links)) {
531 $growinglink .= $link;
532 $getlink = $this->makeLink( $growinglink, $link );
533 if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
546 $s = "<p class='subtitle'>{$sub}\n";
550 function nameAndLogin()
552 global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader, $wgIP;
554 $li = $wgLang->specialPage( "Userlogin" );
555 $lo = $wgLang->specialPage( "Userlogout" );
558 if ( 0 == $wgUser->getID() ) {
559 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
562 $tl = $this->makeKnownLink( $wgLang->getNsText(
563 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
564 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
566 $s .= $n . " (".$tl.")";
568 $s .= wfMsg("notloggedin");
571 $rt = $wgTitle->getPrefixedURL();
572 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
574 } else { $q = "returnto={$rt}"; }
576 $s .= "\n<br>" . $this->makeKnownLink( $li,
577 wfMsg( "login" ), $q );
579 $n = $wgUser->getName();
580 $rt = $wgTitle->getPrefixedURL();
581 $tl = $this->makeKnownLink( $wgLang->getNsText(
582 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
583 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
587 $s .= $this->makeKnownLink( $wgLang->getNsText(
588 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br>" .
589 $this->makeKnownLink( $lo, wfMsg( "logout" ),
590 "returnto={$rt}" ) . " | " .
591 $this->specialLink( "preferences" );
593 $s .= " | " . $this->makeKnownLink( wfMsg( "helppage" ),
599 function searchForm()
603 $s = "<form name='search' class='inline' method=post action=\""
604 . wfLocalUrl( "" ) . "\">"
605 . "<input type=text name=\"search\" size=19 value=\""
606 . htmlspecialchars(substr($search,0,256)) . "\">\n"
607 . "<input type=submit name=\"go\" value=\"" . wfMsg ("go") . "\"> "
608 . "<input type=submit name=\"fulltext\" value=\"" . wfMsg ("search") . "\"></form>";
618 $s = $this->mainPageLink() . $sep
619 . $this->specialLink( "recentchanges" );
621 if ( $wgOut->isArticleRelated() ) {
622 $s .= $sep . $this->editThisPage()
623 . $sep . $this->historyLink();
625 # Many people don't like this dropdown box
626 #$s .= $sep . $this->specialPagesList();
631 function bottomLinks()
633 global $wgOut, $wgUser, $wgTitle;
637 if ( $wgOut->isArticleRelated() ) {
638 $s .= "<strong>" . $this->editThisPage() . "</strong>";
639 if ( 0 != $wgUser->getID() ) {
640 $s .= $sep . $this->watchThisPage();
642 $s .= $sep . $this->talkLink()
643 . $sep . $this->historyLink()
644 . $sep . $this->whatLinksHere()
645 . $sep . $this->watchPageLinksLink();
647 if ( $wgTitle->getNamespace() == Namespace::getUser()
648 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
651 $id=User
::idFromName($wgTitle->getText());
652 $ip=User
::isIP($wgTitle->getText());
654 if($id ||
$ip) { # both anons and non-anons have contri list
655 $s .= $sep . $this->userContribsLink();
657 if ( 0 != $wgUser->getID() ) { # show only to signed in users
658 if($id) { # can only email non-anons
659 $s .= $sep . $this->emailUserLink();
663 if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
664 $s .= "\n<br>" . $this->deleteThisPage() .
665 $sep . $this->protectThisPage() .
666 $sep . $this->moveThisPage();
668 $s .= "<br>\n" . $this->otherLanguages();
675 global $wgOut, $wgLang, $wgArticle;
676 global $oldid, $diff, $wgDisableCounters;
678 if ( ! $wgOut->isArticle() ) { return ""; }
679 if ( isset( $oldid ) ||
isset( $diff ) ) { return ""; }
680 if ( 0 == $wgArticle->getID() ) { return ""; }
682 if ( $wgDisableCounters ) {
685 $count = $wgLang->formatNum( $wgArticle->getCount() );
686 $s = wfMsg( "viewcount", $count );
688 $s .= $this->lastModified();
689 $s .= " " . wfMsg( "gnunote" );
690 return "<span id='pagestats'>{$s}</span>";
693 function lastModified()
695 global $wgLang, $wgArticle;
697 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
698 $s = " " . wfMsg( "lastmodified", $d );
702 function logoText( $align = "" )
704 if ( "" != $align ) { $a = " align='{$align}'"; }
707 $mp = wfMsg( "mainpage" );
708 $titleObj = Title
::newFromText( $mp );
709 $s = "<a href=\"" . $titleObj->escapeLocalURL()
710 . "\"><img{$a} border=0 src=\""
711 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\"></a>";
717 global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
718 global $wpPreview, $wgDisableUploads, $wgRemoteUploads;
720 $fname = "Skin::quickBar";
721 wfProfileIn( $fname );
723 $tns=$wgTitle->getNamespace();
725 $s = "\n<div id='quickbar'>";
726 $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
729 $s .= $this->mainPageLink()
730 . $sep . $this->specialLink( "recentchanges" )
731 . $sep . $this->specialLink( "randompage" );
732 if ($wgUser->getID()) {
733 $s.= $sep . $this->specialLink( "watchlist" ) ;
734 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
735 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
738 // only show watchlist link if logged in
739 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
740 $s .= "\n<br><hr class='sep'>";
741 $articleExists = $wgTitle->getArticleId();
742 if ( $wgOut->isArticle() ||
$action =="edit" ||
$action =="history" ||
$wpPreview) {
743 if($wgOut->isArticle()) {
744 $s .= "<strong>" . $this->editThisPage() . "</strong>";
745 } else { # backlink to the article in edit or history mode
746 if($articleExists){ # no backlink if no article
749 $text = wfMsg("articlepage");
752 $text = wfMsg("viewtalkpage");
755 $text = wfMsg("userpage");
758 $text = wfMsg("viewtalkpage");
761 $text = wfMsg("wikipediapage");
764 $text = wfMsg("viewtalkpage");
767 $text = wfMsg("imagepage");
770 $text = wfMsg("viewtalkpage");
773 $text= wfMsg("articlepage");
776 $link = $wgTitle->getText();
777 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
778 $link = $nstext . ":" . $link ;
781 $s .= $this->makeLink( $link, $text );
782 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
783 # we just throw in a "New page" text to tell the user that he's in edit mode,
784 # and to avoid messing with the separator that is prepended to the next item
785 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
791 if( $tns%2
&& $action!="edit" && !$wpPreview) {
792 $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
796 watching could cause problems in edit mode:
797 if user edits article, then loads "watch this article" in background and then saves
798 article with "Watch this article" checkbox disabled, the article is transparently
799 unwatched. Therefore we do not show the "Watch this page" link in edit mode
801 if ( 0 != $wgUser->getID() && $articleExists) {
802 if($action!="edit" && $action != "submit" )
804 $s .= $sep . $this->watchThisPage();
806 if ( $wgTitle->userCanEdit() )
807 $s .= $sep . $this->moveThisPage();
809 if ( $wgUser->isSysop() and $articleExists ) {
810 $s .= $sep . $this->deleteThisPage() .
811 $sep . $this->protectThisPage();
813 $s .= $sep . $this->talkLink();
814 if ($articleExists && $action !="history") {
815 $s .= $sep . $this->historyLink();
817 $s.=$sep . $this->whatLinksHere();
819 if($wgOut->isArticleRelated()) {
820 $s .= $sep . $this->watchPageLinksLink();
823 if ( Namespace::getUser() == $wgTitle->getNamespace()
824 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
827 $id=User
::idFromName($wgTitle->getText());
828 $ip=User
::isIP($wgTitle->getText());
831 $s .= $sep . $this->userContribsLink();
833 if ( 0 != $wgUser->getID() ) {
834 if($id) { # can only email real users
835 $s .= $sep . $this->emailUserLink();
839 $s .= "\n<br><hr class='sep'>";
842 if ( 0 != $wgUser->getID() && ( !$wgDisableUploads ||
$wgRemoteUploads ) ) {
843 $s .= $this->specialLink( "upload" ) . $sep;
845 $s .= $this->specialLink( "specialpages" )
846 . $sep . $this->bugReportsLink();
848 global $wgSiteSupportPage;
849 if( $wgSiteSupportPage ) {
850 $s .= "\n<br><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
851 "\" class=\"internal\">" . wfMsg( "sitesupport" ) . "</a>";
854 $s .= "\n<br></div>\n";
855 wfProfileOut( $fname );
859 function specialPagesList()
861 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
864 $validSP = $wgLang->getValidSpecialPages();
866 foreach ( $validSP as $name => $desc ) {
867 if ( "" == $desc ) { continue; }
870 if ( $wgUser->isSysop() )
872 $sysopSP = $wgLang->getSysopSpecialPages();
874 foreach ( $sysopSP as $name => $desc ) {
875 if ( "" == $desc ) { continue; }
879 if ( $wgUser->isDeveloper() )
881 $devSP = $wgLang->getDeveloperSpecialPages();
883 foreach ( $devSP as $name => $desc ) {
884 if ( "" == $desc ) { continue; }
889 $sp = wfMsg( "specialpages" );
890 $spp = $wgLang->specialPage( "Specialpages" );
892 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
893 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
894 $s .= "<select name=\"wpDropdown\">\n";
895 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
897 foreach ( $a as $name => $desc ) {
898 $p = $wgLang->specialPage( $name );
899 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
902 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
907 function mainPageLink()
909 $mp = wfMsg( "mainpage" );
910 $s = $this->makeKnownLink( $mp, $mp );
914 function copyrightLink()
916 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
917 wfMsg( "copyrightpagename" ) );
923 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
924 wfMsg( "aboutwikipedia" ) );
929 function disclaimerLink()
931 $s = $this->makeKnownLink( wfMsg( "disclaimerpage" ),
932 wfMsg( "disclaimers" ) );
936 function editThisPage()
938 global $wgOut, $wgTitle, $oldid, $redirect, $diff;
940 if ( ! $wgOut->isArticleRelated() ) {
941 $s = wfMsg( "protectedpage" );
943 $n = $wgTitle->getPrefixedText();
944 if ( $wgTitle->userCanEdit() ) {
945 $t = wfMsg( "editthispage" );
947 #$t = wfMsg( "protectedpage" );
948 $t = wfMsg( "viewsource" );
952 if ( $redirect ) { $red = "&redirect={$redirect}"; }
953 if ( $oldid && ! isset( $diff ) ) {
954 $oid = "&oldid={$oldid}";
956 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
961 function deleteThisPage()
963 global $wgUser, $wgOut, $wgTitle, $diff;
965 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
966 $n = $wgTitle->getPrefixedText();
967 $t = wfMsg( "deletethispage" );
969 $s = $this->makeKnownLink( $n, $t, "action=delete" );
976 function protectThisPage()
978 global $wgUser, $wgOut, $wgTitle, $diff;
980 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
981 $n = $wgTitle->getPrefixedText();
983 if ( $wgTitle->isProtected() ) {
984 $t = wfMsg( "unprotectthispage" );
985 $q = "action=unprotect";
987 $t = wfMsg( "protectthispage" );
988 $q = "action=protect";
990 $s = $this->makeKnownLink( $n, $t, $q );
997 function watchThisPage()
999 global $wgUser, $wgOut, $wgTitle, $diff;
1001 if ( $wgOut->isArticleRelated() ) {
1002 $n = $wgTitle->getPrefixedText();
1004 if ( $wgTitle->userIsWatching() ) {
1005 $t = wfMsg( "unwatchthispage" );
1006 $q = "action=unwatch";
1008 $t = wfMsg( "watchthispage" );
1009 $q = "action=watch";
1011 $s = $this->makeKnownLink( $n, $t, $q );
1013 $s = wfMsg( "notanarticle" );
1018 function moveThisPage()
1020 global $wgTitle, $wgLang;
1022 if ( $wgTitle->userCanEdit() ) {
1023 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
1024 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
1025 } // no message if page is protected - would be redundant
1029 function historyLink()
1033 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1034 wfMsg( "history" ), "action=history" );
1038 function whatLinksHere()
1040 global $wgTitle, $wgLang;
1042 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
1043 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
1047 function userContribsLink()
1049 global $wgTitle, $wgLang;
1051 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1052 wfMsg( "contributions" ), "target=" . $wgTitle->getPartialURL() );
1056 function emailUserLink()
1058 global $wgTitle, $wgLang;
1060 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
1061 wfMsg( "emailuser" ), "target=" . $wgTitle->getPartialURL() );
1065 function watchPageLinksLink()
1067 global $wgOut, $wgTitle, $wgLang;
1069 if ( ! $wgOut->isArticleRelated() ) {
1070 $s = "(" . wfMsg( "notanarticle" ) . ")";
1072 $s = $this->makeKnownLink( $wgLang->specialPage(
1073 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
1074 "target=" . $wgTitle->getPrefixedURL() );
1079 function otherLanguages()
1081 global $wgOut, $wgLang, $wgTitle, $wgUseNewInterlanguage;
1083 $a = $wgOut->getLanguageLinks();
1085 if ( 0 == count( $a ) ) {
1086 if ( !$wgUseNewInterlanguage ) return "";
1087 $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
1088 if ( $ns != 0 AND $ns != 1 ) return "" ;
1090 $x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
1091 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1092 wfMsg( "intl" ) , $x );
1095 if ( !$wgUseNewInterlanguage ) {
1096 $s = wfMsg( "otherlanguages" ) . ": ";
1098 global $wgLanguageCode ;
1099 $x = "mode=zoom&xt=".$wgTitle->getDBkey() ;
1100 $x .= "&xl=".$wgLanguageCode ;
1101 $s = $this->makeKnownLink( $wgLang->specialPage( "Intl" ),
1102 wfMsg( "otherlanguages" ) , $x ) . ": " ;
1105 $s = wfMsg( "otherlanguages" ) . ": ";
1107 if($wgLang->isRTL()) $s .= "<span dir='LTR'>";
1108 foreach( $a as $l ) {
1109 if ( ! $first ) { $s .= " | "; }
1112 $nt = Title
::newFromText( $l );
1113 $url = $nt->getFullURL();
1114 $text = $wgLang->getLanguageName( $nt->getInterwiki() );
1116 if ( "" == $text ) { $text = $l; }
1117 $style = $this->getExternalLinkAttributes( $l, $text );
1118 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
1120 if($wgLang->isRTL()) $s .= "</span>";
1124 function bugReportsLink()
1126 $s = $this->makeKnownLink( wfMsg( "bugreportspage" ),
1127 wfMsg( "bugreports" ) );
1133 global $wgLinkCache;
1134 $t1 = Title
::newFromText( gmdate( "F j" ) );
1135 $t2 = Title
::newFromText( gmdate( "Y" ) );
1137 $wgLinkCache->suspend();
1138 $id = $t1->getArticleID();
1139 $wgLinkCache->resume();
1142 $s = $this->makeBrokenLink( $t1->getText() );
1144 $s = $this->makeKnownLink( $t1->getText() );
1148 $wgLinkCache->suspend();
1149 $id = $t2->getArticleID();
1150 $wgLinkCache->resume();
1153 $s .= $this->makeBrokenLink( $t2->getText() );
1155 $s .= $this->makeKnownLink( $t2->getText() );
1162 global $wgLang, $wgTitle, $wgLinkCache;
1164 $tns = $wgTitle->getNamespace();
1165 if ( -1 == $tns ) { return ""; }
1167 $pn = $wgTitle->getText();
1168 $tp = wfMsg( "talkpage" );
1169 if ( Namespace::isTalk( $tns ) ) {
1170 $lns = Namespace::getSubject( $tns );
1173 $text = wfMsg("articlepage");
1176 $text = wfMsg("userpage");
1179 $text = wfMsg("wikipediapage");
1182 $text = wfMsg("imagepage");
1185 $text= wfMsg("articlepage");
1189 $lns = Namespace::getTalk( $tns );
1192 $n = $wgLang->getNsText( $lns );
1193 if ( "" == $n ) { $link = $pn; }
1194 else { $link = "{$n}:{$pn}"; }
1196 $wgLinkCache->suspend();
1197 $s = $this->makeLink( $link, $text );
1198 $wgLinkCache->resume();
1203 function commentLink()
1205 global $wgLang, $wgTitle, $wgLinkCache;
1207 $tns = $wgTitle->getNamespace();
1208 if ( -1 == $tns ) { return ""; }
1210 $lns = ( Namespace::isTalk( $tns ) ) ?
$tns : Namespace::getTalk( $tns );
1212 # assert Namespace::isTalk( $lns )
1214 $n = $wgLang->getNsText( $lns );
1215 $pn = $wgTitle->getText();
1217 $link = "{$n}:{$pn}";
1219 $wgLinkCache->suspend();
1220 $s = $this->makeKnownLink($link, wfMsg("postcomment"), "action=edit§ion=new");
1221 $wgLinkCache->resume();
1226 # After all the page content is transformed into HTML, it makes
1227 # a final pass through here for things like table backgrounds.
1229 function transformContent( $text )
1234 # Note: This function MUST call getArticleID() on the link,
1235 # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
1237 function makeLink( $title, $text = "", $query = "", $trail = "" ) {
1238 wfProfileIn( "Skin::makeLink" );
1239 $nt = Title
::newFromText( $title );
1241 $result = $this->makeLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1243 wfDebug( "Invalid title passed to Skin::makeLink(): \"$title\"\n" );
1244 $result = $text == "" ?
$title : $text;
1247 wfProfileOut( "Skin::makeLink" );
1251 function makeKnownLink( $title, $text = "", $query = "", $trail = "" ) {
1252 $nt = Title
::newFromText( $title );
1254 return $this->makeKnownLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1256 wfDebug( "Invalid title passed to Skin::makeKnownLink(): \"$title\"\n" );
1257 return $text == "" ?
$title : $text;
1261 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" ) {
1262 $nt = Title
::newFromText( $title );
1264 return $this->makeBrokenLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1266 wfDebug( "Invalid title passed to Skin::makeBrokenLink(): \"$title\"\n" );
1267 return $text == "" ?
$title : $text;
1271 function makeStubLink( $title, $text = "", $query = "", $trail = "" ) {
1272 $nt = Title
::newFromText( $title );
1274 return $this->makeStubLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1276 wfDebug( "Invalid title passed to Skin::makeStubLink(): \"$title\"\n" );
1277 return $text == "" ?
$title : $text;
1281 # Pass a title object, not a title string
1282 function makeLinkObj( &$nt, $text= "", $query = "", $trail = "", $prefix = "" )
1284 global $wgOut, $wgUser;
1285 if ( $nt->isExternal() ) {
1286 $u = $nt->getFullURL();
1287 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1288 $style = $this->getExternalLinkAttributes( $link, $text );
1291 if ( "" != $trail ) {
1292 if ( preg_match( "/^([a-z]+)(.*)$$/sD", $trail, $m ) ) {
1297 $retVal = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1298 } elseif ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
1299 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1300 } elseif ( ( -1 == $nt->getNamespace() ) ||
1301 ( Namespace::getImage() == $nt->getNamespace() ) ) {
1302 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1304 $aid = $nt->getArticleID() ;
1306 $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail, $prefix );
1308 $threshold = $wgUser->getOption("stubthreshold") ;
1309 if ( $threshold > 0 ) {
1310 $res = wfQuery ( "SELECT LENGTH(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ
) ;
1312 if ( wfNumRows( $res ) > 0 ) {
1313 $s = wfFetchObject( $res );
1315 if ( $s->cur_is_redirect
OR $s->cur_namespace
!= 0 ) {
1316 $size = $threshold*2 ; # Really big
1318 wfFreeResult( $res );
1320 $size = $threshold*2 ; # Really big
1325 if ( $size < $threshold ) {
1326 $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
1328 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1335 # Pass a title object, not a title string
1336 function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1338 global $wgOut, $wgTitle;
1340 $fname = "Skin::makeKnownLinkObj";
1341 wfProfileIn( $fname );
1343 $link = $nt->getPrefixedURL();
1345 if ( "" == $link ) {
1347 if ( "" == $text ) { $text = $nt->getFragment(); }
1349 $u = $nt->escapeLocalURL( $query );
1351 if ( "" != $nt->getFragment() ) {
1352 $u .= "#" . wfEscapeHTML( $nt->getFragment() );
1354 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1355 $style = $this->getInternalLinkAttributesObj( $nt, $text );
1358 if ( "" != $trail ) {
1359 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1364 $r = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1365 wfProfileOut( $fname );
1369 # Pass a title object, not a title string
1370 function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1372 global $wgOut, $wgUser;
1374 $fname = "Skin::makeBrokenLinkObj";
1375 wfProfileIn( $fname );
1377 if ( "" == $query ) {
1380 $q = "action=edit&{$query}";
1382 $u = $nt->escapeLocalURL( $q );
1384 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1385 $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
1388 if ( "" != $trail ) {
1389 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1394 if ( $wgOut->isPrintable() ||
1395 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1396 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1398 $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
1401 wfProfileOut( $fname );
1405 # Pass a title object, not a title string
1406 function makeStubLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1408 global $wgOut, $wgUser;
1410 $link = $nt->getPrefixedURL();
1412 $u = $nt->escapeLocalURL( $query );
1414 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1415 $style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
1418 if ( "" != $trail ) {
1419 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1424 if ( $wgOut->isPrintable() ||
1425 ( 1 == $wgUser->getOption( "highlightbroken" ) ) ) {
1426 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1428 $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1433 function fnamePart( $url )
1435 $basename = strrchr( $url, "/" );
1436 if ( false === $basename ) { $basename = $url; }
1437 else { $basename = substr( $basename, 1 ); }
1438 return wfEscapeHTML( $basename );
1441 function makeImage( $url, $alt = "" )
1445 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1446 $s = "<img src=\"{$url}\" alt=\"{$alt}\">";
1450 function makeImageLink( $name, $url, $alt = "" ) {
1451 $nt = Title
::makeTitle( Namespace::getImage(), $name );
1452 return $this->makeImageLinkObj( $nt, $alt );
1455 function makeImageLinkObj( $nt, $alt = "" ) {
1456 global $wgLang, $wgUseImageResize;
1457 $name = $nt->getDBKey();
1458 $url = wfImageUrl( $name );
1460 $prefix = $postfix = "";
1462 if ( $wgUseImageResize ) {
1463 # Check if the alt text is of the form "options|alt text"
1465 # * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang
1466 # * left no resizing, just left align. label is used for alt= only
1467 # * right same, but right aligned
1468 # * none same, but not aligned
1469 # * ___px scale to ___ pixels width, no aligning. e.g. use in taxobox
1471 $part = explode( "|", $alt);
1473 $mwThumb =& MagicWord
::get( MAG_IMG_THUMBNAIL
);
1474 $mwLeft =& MagicWord
::get( MAG_IMG_LEFT
);
1475 $mwRight =& MagicWord
::get( MAG_IMG_RIGHT
);
1476 $mwNone =& MagicWord
::get( MAG_IMG_NONE
);
1477 $mwWidth =& MagicWord
::get( MAG_IMG_WIDTH
);
1478 $mwCenter =& MagicWord
::get( MAG_IMG_CENTER
);
1479 $alt = $part[count($part)-1];
1483 foreach( $part as $key => $val ) {
1484 if ( ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
1486 } elseif ( ! is_null( $mwRight->matchVariableStartToEnd($val) ) ) {
1487 # remember to set an alignment, don't render immediately
1489 } elseif ( ! is_null( $mwLeft->matchVariableStartToEnd($val) ) ) {
1490 # remember to set an alignment, don't render immediately
1492 } elseif ( ! is_null( $mwCenter->matchVariableStartToEnd($val) ) ) {
1493 # remember to set an alignment, don't render immediately
1495 } elseif ( ! is_null( $mwNone->matchVariableStartToEnd($val) ) ) {
1496 # remember to set an alignment, don't render immediately
1498 } elseif ( ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {
1499 # $match is the image width in pixels
1500 $width = intval($match);
1503 if ( "center" == $align )
1505 $prefix = "<center>";
1506 $postfix = "</center>";
1512 # Create a thumbnail. Alignment depends on language
1513 # writing direction, # right aligned for left-to-right-
1514 # languages ("Western languages"), left-aligned
1515 # for right-to-left-languages ("Semitic languages")
1517 # If thumbnail width has not been provided, it is set
1518 # here to 180 pixels
1519 if ( $align == "" ) {
1520 $align = $wgLang->isRTL() ?
"left" : "right";
1522 if ( ! isset($width) ) {
1525 return $prefix.$this->makeThumbLinkObj( $nt, $alt, $align, $width ).$postfix;
1527 } elseif ( isset($width) ) {
1529 # Create a resized image, without the additional thumbnail
1531 $url = $this->createThumb( $name, $width );
1533 } # endif $wgUseImageResize
1535 if ( empty( $alt ) ) {
1536 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1538 $alt = htmlspecialchars( $alt );
1540 $u = $nt->escapeLocalURL();
1543 $s = str_replace( "$1", $name, wfMsg("missingimage") );
1545 $s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
1546 "<img border=\"0\" src=\"{$url}\" alt=\"{$alt}\"></a>";
1548 if ( "" != $align ) {
1549 $s = "<div class=\"float{$align}\">{$s}</div>";
1551 return $prefix.$s.$postfix;
1554 function createThumb( $name, $width ) {
1555 global $wgUploadDirectory;
1556 global $wgImageMagickConvertCommand;
1557 global $wgUseImageMagick;
1558 global $wgUseSquid, $wgInternalServer;
1559 $imgPath = wfImagePath( $name );
1560 $thumbName = $width."px-".$icon.$name;
1561 $thumbPath = wfImageThumbDir( $thumbName )."/".$thumbName;
1562 $thumbUrl = wfImageThumbUrl( $thumbName );
1564 if ( ! file_exists( $imgPath ) )
1566 # If there is no image, there will be no thumbnail
1570 if ( (! file_exists( $thumbPath ) )
1571 ||
( filemtime($thumbPath) < filemtime($imgPath) ) ) {
1573 if ( $wgUseSquid ) {
1575 $wgInternalServer.$thumbUrl
1577 wfPurgeSquidServers($urlArr);
1580 if ( $wgUseImageMagick ) {
1582 $cmd = $wgImageMagickConvertCommand .
1583 " -quality 85 -geometry {$width} ".
1584 escapeshellarg($imgPath) . " " .
1585 escapeshellarg($thumbPath);
1586 $conv = shell_exec( $cmd );
1588 # Use PHP's builtin GD library functions.
1590 # First find out what kind of file this is, and select the correct
1591 # input routine for this.
1592 list($src_width, $src_height, $src_type, $src_attr) = getimagesize( $imgPath );
1593 switch( $src_type ) {
1595 $src_image = imagecreatefromgif( $imgPath );
1598 $src_image = imagecreatefromjpeg( $imgPath );
1601 $src_image = imagecreatefrompng( $imgPath );
1603 case 15: # WBMP for WML
1604 $src_image = imagecreatefromwbmp( $imgPath );
1607 $src_image = imagecreatefromxbm( $imgPath );
1610 return "Image type not supported";
1613 $height = floor( $src_height * ( $width/$src_width ) );
1614 $dst_image = imagecreatetruecolor( $width, $height );
1615 imagecopyresampled( $dst_image, $src_image,
1617 $width, $height, $src_width, $src_height );
1618 switch( $src_type ) {
1623 #$thumbUrl .= ".png";
1624 #$thumbPath .= ".png";
1625 imagepng( $dst_image, $thumbPath );
1628 #$thumbUrl .= ".jpg";
1629 #$thumbPath .= ".jpg";
1630 imageinterlace( $dst_image );
1631 imagejpeg( $dst_image, $thumbPath, 95 );
1636 imagedestroy( $dst_image );
1637 imagedestroy( $src_image );
1642 # Check for zero-sized thumbnails. Those can be generated when
1643 # no disk space is available or some other error occurs
1645 $thumbstat = stat( $thumbPath );
1646 $imgstat = stat( $imgPath );
1647 if( $thumbstat["size"] == 0 )
1649 unlink( $thumbPath );
1656 function makeThumbLinkObj( $nt, $label = "", $align = "right", $boxwidth = 180 ) {
1657 global $wgUploadPath, $wgLang;
1658 $name = $nt->getDBKey();
1659 $image = Title
::makeTitle( Namespace::getImage(), $name );
1660 $url = wfImageUrl( $name );
1661 $path = wfImagePath( $name );
1663 #$label = htmlspecialchars( $label );
1664 $alt = preg_replace( "/<[^>]*>/", "", $label);
1665 $alt = htmlspecialchars( $alt );
1667 if ( file_exists( $path ) )
1669 list($width, $height, $type, $attr) = getimagesize( $path );
1671 $width = $height = 200;
1673 $boxheight = intval( $height/($width/$boxwidth) );
1674 if ( $boxwidth > $width ) {
1676 $boxheight = $height;
1679 $thumbUrl = $this->createThumb( $name, $boxwidth );
1681 $u = $nt->escapeLocalURL();
1683 $more = htmlspecialchars( wfMsg( "thumbnail-more" ) );
1684 $magnifyalign = $wgLang->isRTL() ?
"left" : "right";
1685 $textalign = $wgLang->isRTL() ?
" style=\"text-align:right\"" : "";
1687 $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$boxwidth}px;\">";
1688 if ( $thumbUrl == "" ) {
1689 $s .= str_replace( "$1", $name, wfMsg("missingimage") );
1691 $s .= "<a href=\"{$u}\" class=\"internal\" title=\"{$alt}\">" .
1692 "<img border=\"0\" src=\"{$thumbUrl}\" alt=\"{$alt}\" " .
1693 " width=\"{$boxwidth}\" height=\"{$boxheight}\"></a>" .
1694 "<a href=\"{$u}\" class=\"internal\" title=\"{$more}\">" .
1695 "<img border=\"0\" src=\"{$wgUploadPath}/magnify-clip.png\" " .
1696 " width=\"26\" height=\"24\" align=\"{$magnifyalign}\" alt=\"{$more}\"></a>";
1698 $s .= "<p{$textalign}>{$label}</p></div>";
1702 function makeMediaLink( $name, $url, $alt = "" ) {
1703 $nt = Title
::makeTitle( Namespace::getMedia(), $name );
1704 return $this->makeMediaLinkObj( $nt, $alt );
1707 function makeMediaLinkObj( $nt, $alt = "" )
1709 $name = $nt->getDBKey();
1710 $url = wfImageUrl( $name );
1711 if ( empty( $alt ) ) {
1712 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1715 $u = htmlspecialchars( $url );
1716 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1720 function specialLink( $name, $key = "" )
1724 if ( "" == $key ) { $key = strtolower( $name ); }
1725 $pn = $wgLang->ucfirst( $name );
1726 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1730 # Called by history lists and recent changes
1733 # Returns text for the start of the tabular part of RC
1734 function beginRecentChangesList()
1736 $this->rc_cache
= array() ;
1737 $this->rcMoveIndex
= 0;
1738 $this->rcCacheIndex
= 0 ;
1739 $this->lastdate
= "";
1743 function beginImageHistoryList()
1745 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1746 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul>";
1750 # Returns text for the end of RC
1751 # If enhanced RC is in use, returns pretty much all the text
1752 function endRecentChangesList()
1754 $s = $this->recentChangesBlock() ;
1759 # Enhanced RC ungrouped line
1760 function recentChangesBlockLine ( $rcObj )
1762 global $wgUploadPath, $wgLang ;
1764 # Get rc_xxxx variables
1765 extract( $rcObj->mAttribs
) ;
1766 $curIdEq = "curid=$rc_cur_id";
1770 $r .= "<img src='{$wgUploadPath}/Arr_.png' width='12' height='12' border='0'>" ; $r .= "<tt>" ;
1772 if ( $rc_type == RC_MOVE
) {
1773 $r .= " ";
1775 # M & N (minor & new)
1776 $M = wfMsg( "minoreditletter" );
1777 $N = wfMsg( "newpageletter" );
1779 if ( $rc_type == RC_NEW
) {
1792 $r .= " ".$rcObj->timestamp
." " ;
1796 $link = $rcObj->link
;
1797 if ( $rcObj->watched
) $link = "<strong>{$link}</strong>" ;
1802 $r .= $rcObj->curlink
;
1806 $r .= $this->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
1809 $r .= ") . . ".$rcObj->userlink
;
1810 $r .= $rcObj->usertalklink
;
1813 if ( $rc_comment != "" && $rc_type != RC_MOVE
) {
1814 $r .= $wgLang->emphasize( " (".wfEscapeHTML($rc_comment).")" );
1821 function recentChangesBlockGroup ( $block )
1823 global $wgUploadPath, $wgLang ;
1826 $M = wfMsg( "minoreditletter" );
1827 $N = wfMsg( "newpageletter" );
1829 # Collate list of users
1831 $userlinks = array () ;
1832 foreach ( $block AS $rcObj ) {
1833 $oldid = $rcObj->mAttribs
['rc_last_oldid'];
1834 if ( $rcObj->mAttribs
['rc_new'] ) $isnew = true ;
1835 $u = $rcObj->userlink
;
1836 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1840 # Sort the list and convert to text
1841 krsort ( $userlinks ) ;
1842 asort ( $userlinks ) ;
1844 foreach ( $userlinks as $userlink => $count) {
1846 if ( $count > 1 ) $text .= " ({$count}×)" ;
1847 array_push ( $users , $text ) ;
1849 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1852 $rci = "RCI{$this->rcCacheIndex}" ;
1853 $rcl = "RCL{$this->rcCacheIndex}" ;
1854 $rcm = "RCM{$this->rcCacheIndex}" ;
1855 $toggleLink = "javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")" ;
1856 $arrowdir = $wgLang->isRTL() ?
"l" : "r";
1857 $tl = "<span id='{$rcm}'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_{$arrowdir}.png' width='12' height='12' border='0' /></a></span>" ;
1858 $tl .= "<span id='{$rcl}' style='display:none'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_d.png' width='12' height='12' border='0' /></a></span>" ;
1864 if ( $isnew ) $r .= $N ;
1865 else $r .= " " ;
1866 $r .= " " ; # Minor
1869 $r .= " ".$block[0]->timestamp
." " ;
1873 $link = $block[0]->link
;
1874 if ( $block[0]->watched
) $link = "<strong>{$link}</strong>" ;
1877 $curIdEq = "curid=" . $block[0]->mAttribs
['rc_cur_id'];
1878 if ( $block[0]->mAttribs
['rc_type'] != RC_LOG
) {
1880 $r .= " (".count($block)." " ;
1881 if ( $isnew ) $r .= wfMsg("changes");
1882 else $r .= $this->makeKnownLinkObj( $block[0]->getTitle() , wfMsg("changes") ,
1883 "{$curIdEq}&diff=0&oldid=".$oldid ) ;
1887 $r .= $this->makeKnownLinkObj( $block[0]->getTitle(), wfMsg( "history" ), "{$curIdEq}&action=history" );
1895 $r .= "<div id='{$rci}' style='display:none'>" ;
1896 foreach ( $block AS $rcObj ) {
1897 # Get rc_xxxx variables
1898 extract( $rcObj->mAttribs
);
1900 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0>";
1901 $r .= "<tt> " ;
1902 if ( $rc_new ) $r .= $N ;
1903 else $r .= " " ;
1904 if ( $rc_minor ) $r .= $M ;
1905 else $r .= " " ;
1909 if ( $rc_last_oldid != 0 ) {
1910 $o = "oldid=".$rc_last_oldid ;
1912 if ( $rc_type == RC_LOG
) {
1913 $link = $rcObj->timestamp
;
1915 $link = $this->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp
, "{$curIdEq}&$o" ) ;
1917 $link = "<tt>{$link}</tt>" ;
1921 $r .= $rcObj->curlink
;
1923 $r .= $rcObj->lastlink
;
1924 $r .= ") . . ".$rcObj->userlink
;
1925 $r .= $rcObj->usertalklink
;
1926 if ( $rc_comment != "" ) {
1927 $r .= $wgLang->emphasize( " (".wfEscapeHTML($rc_comment).")" ) ;
1933 $this->rcCacheIndex++
;
1937 # If enhanced RC is in use, this function takes the previously cached
1938 # RC lines, arranges them, and outputs the HTML
1939 function recentChangesBlock ()
1941 global $wgUploadPath ;
1942 if ( count ( $this->rc_cache
) == 0 ) return "" ;
1944 foreach ( $this->rc_cache
AS $secureName => $block ) {
1945 if ( count ( $block ) < 2 ) {
1946 $blockOut .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ;
1948 $blockOut .= $this->recentChangesBlockGroup ( $block ) ;
1952 return "<div>{$blockOut}</div>" ;
1955 # Called in a loop over all displayed RC entries
1956 # Either returns the line, or caches it for later use
1957 function recentChangesLine( &$rc, $watched = false )
1960 $usenew = $wgUser->getOption( "usenewrc" );
1962 $line = $this->recentChangesLineNew ( $rc, $watched ) ;
1964 $line = $this->recentChangesLineOld ( $rc, $watched ) ;
1968 function recentChangesLineOld( &$rc, $watched = false )
1970 global $wgTitle, $wgLang, $wgUser;
1972 # Extract DB fields into local scope
1973 extract( $rc->mAttribs
);
1974 $curIdEq = "curid=" . $rc_cur_id;
1976 # Make date header if necessary
1977 $date = $wgLang->date( $rc_timestamp, true);
1979 if ( $date != $this->lastdate
) {
1980 if ( "" != $this->lastdate
) { $s .= "</ul>\n"; }
1981 $s .= "<h4>{$date}</h4>\n<ul>";
1982 $this->lastdate
= $date;
1986 if ( $rc_type == RC_MOVE
) {
1988 $s .= "(" . wfMsg( "diff" ) . ") (";
1990 $s .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), wfMsg( "hist" ), "action=history" ) .
1993 # "[[x]] moved to [[y]]"
1995 $s .= wfMsg( "1movedto2", $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" ),
1996 $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" ) );
2000 if ( $rc_type == RC_NEW ||
$rc_type == RC_LOG
) {
2001 $diffLink = wfMsg( "diff" );
2003 $diffLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "diff" ),
2004 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
2006 $s .= "($diffLink) (";
2009 $s .= $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
2012 # M and N (minor and new)
2013 $M = wfMsg( "minoreditletter" );
2014 $N = wfMsg( "newpageletter" );
2015 if ( $rc_minor ) { $s .= " <strong>{$M}</strong>"; }
2016 if ( $rc_type == RC_NEW
) { $s .= "<strong>{$N}</strong>"; }
2019 $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), "" );
2022 $articleLink = "<strong>{$articleLink}</strong>";
2024 $s .= " $articleLink";
2029 $s .= "; " . $wgLang->time( $rc_timestamp, true ) . " . . ";
2031 # User link (or contributions for unregistered users)
2032 if ( 0 == $rc_user ) {
2033 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2034 $rc_user_text, "target=" . $rc_user_text );
2036 $userLink = $this->makeLink( $wgLang->getNsText( NS_USER
) . ":{$rc_user_text}", $rc_user_text );
2041 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2042 global $wgDisableAnonTalk;
2043 if( 0 == $rc_user && $wgDisableAnonTalk ) {
2046 $utns=$wgLang->getNsText(NS_USER_TALK
);
2047 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2051 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2052 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2053 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2057 if($userTalkLink) $userTalkLink .= " | ";
2058 $userTalkLink .= $blockLink;
2060 if($userTalkLink) $s.=" ({$userTalkLink})";
2063 if ( "" != $rc_comment && "*" != $rc_comment && $rc_type != RC_MOVE
) {
2064 $s .= $wgLang->emphasize(" (" . wfEscapeHTML( $rc_comment ) . ")");
2071 # function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
2072 function recentChangesLineNew( &$baseRC, $watched = false )
2074 global $wgTitle, $wgLang, $wgUser;
2076 # Create a specialised object
2077 $rc = RCCacheEntry
::newFromParent( $baseRC ) ;
2079 # Extract fields from DB into the function scope (rc_xxxx variables)
2080 extract( $rc->mAttribs
);
2081 $curIdEq = "curid=" . $rc_cur_id;
2083 # If it's a new day, add the headline and flush the cache
2084 $date = $wgLang->date( $rc_timestamp, true);
2086 if ( $date != $this->lastdate
) {
2087 # Process current cache
2088 $ret = $this->recentChangesBlock () ;
2089 $this->rc_cache
= array() ;
2090 $ret .= "<h4>{$date}</h4>\n";
2091 $this->lastdate
= $date;
2095 if ( $rc_type == RC_MOVE
) {
2096 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" );
2097 $clink .= " " . wfMsg("movedto") . " ";
2098 $clink .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" );
2100 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "" ) ;
2103 $time = $wgLang->time( $rc_timestamp, true );
2104 $rc->watched
= $watched ;
2105 $rc->link
= $clink ;
2106 $rc->timestamp
= $time;
2109 if ( ( $rc_type == RC_NEW
&& $rc_this_oldid == 0 ) ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2110 $curLink = wfMsg( "cur" );
2112 $curLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "cur" ),
2113 "{$curIdEq}&diff=0&oldid={$rc_this_oldid}" );
2117 $titleObj = $rc->getTitle();
2118 if ( $rc_last_oldid == 0 ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2119 $lastLink = wfMsg( "last" );
2121 $lastLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "last" ),
2122 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
2125 # Make user link (or user contributions for unregistered users)
2126 if ( 0 == $rc_user ) {
2127 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2128 $rc_user_text, "target=" . $rc_user_text );
2130 $userLink = $this->makeLink( $wgLang->getNsText(
2131 Namespace::getUser() ) . ":{$rc_user_text}", $rc_user_text );
2134 $rc->userlink
= $userLink ;
2135 $rc->lastlink
= $lastLink ;
2136 $rc->curlink
= $curLink ;
2138 # Make user talk link
2139 $utns=$wgLang->getNsText(NS_USER_TALK
);
2140 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2141 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2143 global $wgDisableAnonTalk;
2144 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2145 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2146 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2147 if( $wgDisableAnonTalk )
2148 $rc->usertalklink
= " ({$blockLink})";
2150 $rc->usertalklink
= " ({$userTalkLink} | {$blockLink})";
2152 if( $wgDisableAnonTalk && ($rc_user == 0) )
2153 $rc->usertalklink
= "";
2155 $rc->usertalklink
= " ({$userTalkLink})";
2158 # Put accumulated information into the cache, for later display
2159 # Page moves go on their own line
2160 $title = $rc->getTitle();
2161 $secureName = $title->getPrefixedDBkey();
2162 if ( $rc_type == RC_MOVE
) {
2163 # Use an @ character to prevent collision with page names
2164 $this->rc_cache
["@@" . ($this->rcMoveIndex++
)] = array($rc);
2166 if ( !isset ( $this->rc_cache
[$secureName] ) ) $this->rc_cache
[$secureName] = array() ;
2167 array_push ( $this->rc_cache
[$secureName] , $rc ) ;
2172 function endImageHistoryList()
2178 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
2180 global $wgUser, $wgLang, $wgTitle;
2182 $dt = $wgLang->timeanddate( $ts, true );
2183 $del = wfMsg( "deleteimg" );
2184 $cur = wfMsg( "cur" );
2187 $url = wfImageUrl( $img );
2189 if ( $wgUser->isSysop() ) {
2190 $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
2192 $style = $this->getInternalLinkAttributes( $link, $del );
2194 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
2199 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
2200 if( $wgUser->getID() != 0 ) {
2201 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2202 wfMsg( "revertimg" ), "action=revert&oldimage=" .
2203 urlencode( $img ) );
2204 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2205 $del, "action=delete&oldimage=" . urlencode( $img ) );
2207 # Having live active links for non-logged in users
2208 # means that bots and spiders crawling our site can
2209 # inadvertently change content. Baaaad idea.
2210 $rlink = wfMsg( "revertimg" );
2214 if ( 0 == $u ) { $ul = $ut; }
2215 else { $ul = $this->makeLink( $wgLang->getNsText(
2216 Namespace::getUser() ) . ":{$ut}", $ut ); }
2218 $nb = wfMsg( "nbytes", $size );
2219 $style = $this->getInternalLinkAttributes( $url, $dt );
2221 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
2222 . " . . {$ul} ({$nb})";
2224 if ( "" != $c && "*" != $c ) {
2225 $s .= $wgLang->emphasize(" (" . wfEscapeHTML( $c ) . ")");
2231 function tocIndent($level) {
2233 while($level-->0) $rv.="<div style=\"margin-left:2em;\">\n";
2238 function tocUnindent($level) {
2240 while($level-->0) $rv.="</div>\n";
2244 // parameter level defines if we are on an indentation level
2245 function tocLine($anchor,$tocline,$level) {
2249 return "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n";
2252 return "<div style=\"margin-bottom:0px;\">\n".
2253 "<A CLASS=\"internal\" HREF=\"#".$anchor."\">".$tocline."</A><BR>\n".
2259 function tocTable($toc) {
2260 // note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
2264 $hideline = " <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>";
2267 "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
2268 "<b>".wfMsg("toc")."</b>" .
2270 "</td></tr><tr id='tocinside'><td>\n".
2271 $toc."</td></tr></table><P>\n";
2274 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
2275 function editSectionScript($section,$head) {
2277 global $wgTitle,$wgUser,$oldid;
2278 if($oldid) return $head;
2279 $url = $wgTitle->escapeLocalURL( "action=edit§ion=$section" );
2280 return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
2283 function editSectionLink($section) {
2284 global $printable,$oldid;
2285 global $wgTitle, $wgUser, $wgLang;
2287 if( isset( $oldid ) ) return "";
2288 if( isset( $printable ) ) return "";
2290 $editurl = "§ion={$section}";
2291 $url = $this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
2293 if( $wgLang->isRTL() ) {
2295 $nearside = "right";
2300 return "<div style=\"float:$farside;margin-$nearside:5px;\"><small>[".$url."]</small></div>";
2304 // This function is called by EditPage.php and shows a bulletin board style
2305 // toolbar for common editing functions. It can be disabled in the user preferences.
2306 // The necsesary JavaScript code can be found in style/wikibits.js.
2307 function getEditToolbar() {
2309 global $wgUploadPath,$wgLang;
2311 // toolarray an array of arrays which each include the filename of
2312 // the button image (without path), the opening tag, the closing tag,
2313 // and optionally a sample text that is inserted between the two when no
2314 // selection is highlighted.
2315 // The tip text is shown when the user moves the mouse over the button.
2317 array( "image"=>"button_bold.png",
2320 "sample"=>wfMsg("bold_sample"),
2321 "tip"=>wfMsg("bold_tip")),
2322 array( "image"=>"button_italic.png",
2325 "sample"=>wfMsg("italic_sample"),
2326 "tip"=>wfMsg("italic_tip")),
2327 array( "image"=>"button_link.png",
2330 "sample"=>wfMsg("link_sample"),
2331 "tip"=>wfMsg("link_tip")),
2332 array( "image"=>"button_extlink.png",
2335 "sample"=>wfMsg("extlink_sample"),
2336 "tip"=>wfMsg("extlink_tip")),
2337 array( "image"=>"button_headline.png",
2340 "sample"=>wfMsg("headline_sample"),
2341 "tip"=>wfMsg("headline_tip")),
2342 array( "image"=>"button_image.png",
2343 "open"=>"[[".$wgLang->getNsText(NS_IMAGE
).":",
2345 "sample"=>wfMsg("image_sample"),
2346 "tip"=>wfMsg("image_tip")),
2347 array( "image"=>"button_media.png",
2348 "open"=>"[[".$wgLang->getNsText(NS_MEDIA
).":",
2350 "sample"=>wfMsg("media_sample"),
2351 "tip"=>wfMsg("media_tip")),
2352 array( "image"=>"button_math.png",
2353 "open"=>"\\<math\\>",
2354 "close"=>"\\</math\\>",
2355 "sample"=>wfMsg("math_sample"),
2356 "tip"=>wfMsg("math_tip")),
2357 array( "image"=>"button_nowiki.png",
2358 "open"=>"\\<nowiki\\>",
2359 "close"=>"\\</nowiki\\>",
2360 "sample"=>wfMsg("nowiki_sample"),
2361 "tip"=>wfMsg("nowiki_tip")),
2362 array( "image"=>"button_sig.png",
2366 "tip"=>wfMsg("sig_tip")),
2367 array( "image"=>"button_hr.png",
2368 "open"=>"\\n----\\n",
2371 "tip"=>wfMsg("hr_tip"))
2373 $toolbar ="<script type='text/javascript'>\n";
2374 $toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
2375 foreach($toolarray as $tool) {
2377 $image=$wgUploadPath."/".$tool["image"];
2378 $open=$tool["open"];
2379 $close=$tool["close"];
2380 $sample = addslashes( $tool["sample"] );
2382 // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
2383 // Older browsers show a "speedtip" type message only for ALT.
2384 // Ideally these should be different, realistically they
2385 // probably don't need to be.
2386 $tip = addslashes( $tool["tip"] );
2387 $toolbar.="addButton('$image','$tip','$open','$close','$sample');\n";
2390 $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "','" . addslashes(wfMsg("infobox_alert")) . "','" . addslashes(wfMsg("infobox_mozvote"))."');\n";
2391 $toolbar.="document.writeln(\"</div>\");\n</script>";
2396 include_once( "SkinStandard.php" );
2397 include_once( "SkinNostalgia.php" );
2398 include_once( "SkinCologneBlue.php" );
2400 if( $wgUseSmarty ) {
2401 include_once( "SkinSmarty.php" );