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";
24 $wgValidSkinNames['monobook'] = "MonoBook";
27 include_once( "RecentChange.php" );
29 # For some odd PHP bug, this function can't be part of a class
30 function getCategories ()
32 global $wgOut , $wgTitle , $wgUseCategoryMagic , $wgUser , $wgParser ;
33 if ( !isset ( $wgUseCategoryMagic ) ||
!$wgUseCategoryMagic ) return "" ;
34 if ( count ( $wgParser->mCategoryLinks
) == 0 ) return "" ;
35 if ( !$wgOut->isArticle() ) return "" ;
36 $sk = $wgUser->getSkin() ;
39 $s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ;
40 $t = implode ( " | " , $wgParser->mCategoryLinks
) ;
41 if ( $t != "" ) $s .= " : " ;
46 class RCCacheEntry
extends RecentChange
48 var $secureName, $link;
49 var $curlink , $lastlink , $usertalklink , $versionlink ;
50 var $userlink, $timestamp, $watched;
52 function newFromParent( $rc )
54 $rc2 = new RCCacheEntry
;
55 $rc2->mAttribs
= $rc->mAttribs
;
56 $rc2->mExtra
= $rc->mExtra
;
63 /* private */ var $lastdate, $lastline;
64 var $linktrail ; # linktrail regexp
65 var $rc_cache ; # Cache for Enhanced Recent Changes
66 var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
71 $this->linktrail
= wfMsg("linktrail");
74 function getSkinNames()
76 global $wgValidSkinNames;
77 return $wgValidSkinNames;
80 function getStylesheet()
82 return "wikistandard.css";
87 global $wgOut, $wgUser;
89 if ( $wgOut->isQuickbarSuppressed() ) { return 0; }
90 $q = $wgUser->getOption( "quickbar" );
91 if ( "" == $q ) { $q = 0; }
95 function initPage( &$out )
97 global $wgStyleSheetPath;
98 $fname = "Skin::initPage";
99 wfProfileIn( $fname );
101 $out->addLink( "shortcut icon", "", "/favicon.ico" );
103 wfProfileOut( $fname );
106 function outputPage( &$out ) {
107 global $wgDebugComments;
109 wfProfileIn( "Skin::outputPage" );
110 $this->initPage( $out );
111 $out->out( $out->headElement() );
113 $out->out( "\n<body" );
114 $ops = $this->getBodyOptions();
115 foreach ( $ops as $name => $val ) {
116 $out->out( " $name='$val'" );
119 if ( $wgDebugComments ) {
120 $out->out( "<!-- Wiki debugging output:\n" .
121 $out->mDebugtext
. "-->\n" );
123 $out->out( $this->beforeContent() );
125 $out->out( $out->mBodytext
);
127 $out->out( $this->afterContent() );
130 $out->out( $out->reportTime() );
132 $out->out( "\n</body></html>" );
135 function getHeadScripts() {
136 global $wgStyleSheetPath;
137 $r = "<script type=\"text/javascript\" src=\"{$wgStyleSheetPath}/wikibits.js\"></script>\n";
141 function getUserStyles()
143 global $wgOut, $wgStyleSheetPath;
144 $sheet = $this->getStylesheet();
145 $s = "<style type='text/css'><!--\n";
146 $s .= "/*/*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
147 $s .= "@import url(\"$wgStyleSheetPath/$sheet\");\n";
148 $s .= $this->doGetUserStyles();
150 $s .= "//--></style>\n";
154 function doGetUserStyles()
159 if ( 1 == $wgUser->getOption( "underline" ) ) {
160 # Don't override browser settings
164 $s .= "a.stub, a.new, a.internal, a.external { " .
165 "text-decoration: none; }\n";
167 if ( 1 == $wgUser->getOption( "highlightbroken" ) ) {
168 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
170 if ( 1 == $wgUser->getOption( "justify" ) ) {
171 $s .= "#article { text-align: justify; }\n";
176 function getBodyOptions()
178 global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $wgRequest;
180 extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
182 if ( 0 != $wgTitle->getNamespace() ) {
183 $a = array( "bgcolor" => "#ffffec" );
185 else $a = array( "bgcolor" => "#FFFFFF" );
186 if($wgOut->isArticle() && $wgUser->getOption("editondblclick") &&
187 (!$wgTitle->isProtected() ||
$wgUser->isSysop()) ) {
188 $t = wfMsg( "editthispage" );
191 $red = "&redirect={$redirect}";
193 if ( !empty($oldid) && ! isset( $diff ) ) {
194 $oid = "&oldid={$oldid}";
196 $s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" );
197 $s = "document.location = \"" .$s ."\";";
198 $a +
= array ("ondblclick" => $s);
201 $a['onload'] = $wgOut->getOnloadHandler();
205 function getExternalLinkAttributes( $link, $text )
207 global $wgUser, $wgOut, $wgLang;
209 $link = urldecode( $link );
210 $link = $wgLang->checkTitleEncoding( $link );
211 $link = str_replace( "_", " ", $link );
212 $link = wfEscapeHTML( $link );
214 $r = " class='external'";
216 if ( 1 == $wgUser->getOption( "hover" ) ) {
217 $r .= " title=\"{$link}\"";
222 function getInternalLinkAttributes( $link, $text, $broken = false )
224 global $wgUser, $wgOut;
226 $link = urldecode( $link );
227 $link = str_replace( "_", " ", $link );
228 $link = wfEscapeHTML( $link );
230 if ( $broken == "stub" ) {
231 $r = " class='stub'";
232 } else if ( $broken == "yes" ) {
238 if ( 1 == $wgUser->getOption( "hover" ) ) {
239 $r .= " title=\"{$link}\"";
244 function getInternalLinkAttributesObj( &$nt, $text, $broken = false )
246 global $wgUser, $wgOut;
248 if ( $broken == "stub" ) {
249 $r = " class='stub'";
250 } else if ( $broken == "yes" ) {
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( $wgSiteNotice ) {
276 $note = "\n<div id='notice' style='font-weight: bold; color: red; text-align: center'>$wgSiteNotice</div>\n";
280 return $this->doBeforeContent() . $note;
283 function doBeforeContent()
285 global $wgUser, $wgOut, $wgTitle, $wgLang;
286 $fname = "Skin::doBeforeContent";
287 wfProfileIn( $fname );
290 $qb = $this->qbSetting();
292 if( $langlinks = $this->otherLanguages() ) {
298 $borderhack = "class='top'";
301 $s .= "\n<div id='content'>\n<div id='topbar'>" .
302 "<table border=0 cellspacing=0 width='98%'><tr>";
305 $left = ($qb == 1 ||
$qb == 3);
306 if($wgLang->isRTL()) $left = !$left;
309 $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>" .
310 $this->logoText() . "</td>";
312 $s .= $this->getQuickbarCompensator( $rows );
314 $l = $wgLang->isRTL() ?
"right" : "left";
315 $s .= "<td {$borderhack} align='$l' valign='top'>";
317 $s .= $this->topLinks() ;
318 $s .= "<p class='subtitle'>" . $this->pageTitleLinks();
320 $r = $wgLang->isRTL() ?
"left" : "right";
321 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap>";
322 $s .= $this->nameAndLogin();
323 $s .= "\n<br>" . $this->searchForm() . "</td>";
326 $s .= "</tr>\n<tr><td class='top' colspan=\"2\">$langlinks</td>";
329 if ( $shove && !$left ) { # Right
330 $s .= $this->getQuickbarCompensator( $rows );
332 $s .= "</tr></table>\n</div>\n";
333 $s .= "\n<div id='article'>";
335 $s .= $this->pageTitle();
336 $s .= $this->pageSubtitle() ;
337 $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
339 wfProfileOut( $fname );
343 function getQuickbarCompensator( $rows = 1 )
345 return "<td width='152' rowspan='{$rows}'> </td>";
348 # This gets called immediately before the </body> tag.
350 function afterContent()
352 global $wgUser, $wgOut, $wgServer;
353 global $wgTitle, $wgLang;
355 $printfooter = "<div class=\"printfooter\">" . $this->printFooter() . "</div>\n";
356 return $printfooter . $this->doAfterContent();
359 function printFooter() {
361 $url = htmlspecialchars( $wgTitle->getFullURL() );
362 return "<p>" . wfMsg( "retrievedfrom", "<a href=\"$url\">$url</a>" ) .
363 "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
366 function doAfterContent()
368 global $wgUser, $wgOut, $wgLang;
369 $fname = "Skin::doAfterContent";
370 wfProfileIn( $fname );
371 wfProfileIn( "$fname-1" );
373 $s = "\n</div><br clear=all>\n";
374 $s .= "\n<div id='footer'>";
375 $s .= "<table border=0 cellspacing=0><tr>";
377 wfProfileOut( "$fname-1" );
378 wfProfileIn( "$fname-2" );
380 $qb = $this->qbSetting();
382 $left = ($qb == 1 ||
$qb == 3);
383 if($wgLang->isRTL()) $left = !$left;
385 if ( $shove && $left ) { # Left
386 $s .= $this->getQuickbarCompensator();
388 wfProfileOut( "$fname-2" );
389 wfProfileIn( "$fname-3" );
390 $l = $wgLang->isRTL() ?
"right" : "left";
391 $s .= "<td class='bottom' align='$l' valign='top'>";
393 $s .= $this->bottomLinks();
394 $s .= "\n<br>" . $this->mainPageLink()
395 . " | " . $this->aboutLink()
396 . " | " . $this->specialLink( "recentchanges" )
397 . " | " . $this->searchForm()
398 . "<br><span id='pagestats'>" . $this->pageStats() . "</span>";
401 if ( $shove && !$left ) { # Right
402 $s .= $this->getQuickbarCompensator();
404 $s .= "</tr></table>\n</div>\n</div>\n";
406 wfProfileOut( "$fname-3" );
407 wfProfileIn( "$fname-4" );
408 if ( 0 != $qb ) { $s .= $this->quickBar(); }
409 wfProfileOut( "$fname-4" );
410 wfProfileOut( $fname );
414 function pageTitleLinks()
416 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgUseApproval, $wgRequest;
418 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
419 $action = $wgRequest->getText( 'action' );
421 $s = $this->printableLink();
422 if ( wfMsg ( "disclaimers" ) != "-" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
424 if ( $wgOut->isArticleRelated() ) {
425 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
426 $name = $wgTitle->getDBkey();
427 $link = wfEscapeHTML( wfImageUrl( $name ) );
428 $style = $this->getInternalLinkAttributes( $link, $name );
429 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
431 # This will show the "Approve" link if $wgUseApproval=true;
432 if ( isset ( $wgUseApproval ) && $wgUseApproval )
434 $t = $wgTitle->getDBkey();
435 $name = "Approve this article" ;
436 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
437 #wfEscapeHTML( wfImageUrl( $name ) );
438 $style = $this->getExternalLinkAttributes( $link, $name );
439 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
442 if ( "history" == $action ||
isset( $diff ) ||
isset( $oldid ) ) {
443 $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
444 wfMsg( "currentrev" ) );
447 if ( $wgUser->getNewtalk() ) {
448 # do not show "You have new messages" text when we are viewing our
451 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
452 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
453 $n =$wgUser->getName();
454 $tl = $this->makeKnownLink( $wgLang->getNsText(
455 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
456 wfMsg("newmessageslink") );
457 $s.=" | <strong>". wfMsg( "newmessages", $tl ) . "</strong>";
460 if( $wgUser->isSysop() &&
461 (($wgTitle->getArticleId() == 0) ||
($action == "history")) &&
462 ($n = $wgTitle->isDeleted() ) ) {
463 $s .= " | " . wfMsg( "thisisdeleted",
464 $this->makeKnownLink(
465 $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
466 wfMsg( "restorelink", $n ) ) );
471 function printableLink()
473 global $wgOut, $wgFeedClasses, $wgRequest;
475 $baseurl = $_SERVER['REQUEST_URI'];
476 if( strpos( "?", $baseurl ) == false ) {
481 $baseurl = htmlspecialchars( $baseurl );
482 $printurl = $wgRequest->escapeAppendQuery( "printable=yes" );
484 $s = "<a href=\"$printurl\">" . wfMsg( "printableversion" ) . "</a>";
485 if( $wgOut->isSyndicated() ) {
486 foreach( $wgFeedClasses as $format => $class ) {
487 $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
488 $s .= " | <a href=\"$feedurl\">{$format}</a>";
496 global $wgOut, $wgTitle, $wgUser;
498 $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
499 if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
503 function pageSubtitle()
505 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
507 $sub = $wgOut->getSubtitle();
509 global $wgExtraSubtitle;
510 $sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
512 if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
513 $ptext=$wgTitle->getPrefixedText();
514 if(preg_match("/\//",$ptext)) {
515 $sub.="</p><p class='subpages'>";
516 $links=explode("/",$ptext);
519 foreach($links as $link) {
521 if ($c<count($links)) {
522 $growinglink .= $link;
523 $getlink = $this->makeLink( $growinglink, $link );
524 if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
537 $s = "<p class='subtitle'>{$sub}\n";
541 function nameAndLogin()
543 global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader, $wgIP;
545 $li = $wgLang->specialPage( "Userlogin" );
546 $lo = $wgLang->specialPage( "Userlogout" );
549 if ( 0 == $wgUser->getID() ) {
550 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
553 $tl = $this->makeKnownLink( $wgLang->getNsText(
554 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
555 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
557 $s .= $n . " (".$tl.")";
559 $s .= wfMsg("notloggedin");
562 $rt = $wgTitle->getPrefixedURL();
563 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
565 } else { $q = "returnto={$rt}"; }
567 $s .= "\n<br>" . $this->makeKnownLink( $li,
568 wfMsg( "login" ), $q );
570 $n = $wgUser->getName();
571 $rt = $wgTitle->getPrefixedURL();
572 $tl = $this->makeKnownLink( $wgLang->getNsText(
573 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
574 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
578 $s .= $this->makeKnownLink( $wgLang->getNsText(
579 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br>" .
580 $this->makeKnownLink( $lo, wfMsg( "logout" ),
581 "returnto={$rt}" ) . " | " .
582 $this->specialLink( "preferences" );
584 $s .= " | " . $this->makeKnownLink( wfMsg( "helppage" ),
590 function searchForm()
594 $search = $wgRequest->getText( 'search' );;
596 $s = "<form name='search' class='inline' method=post action=\""
597 . wfLocalUrl( "" ) . "\">"
598 . "<input type=text name=\"search\" size=19 value=\""
599 . htmlspecialchars(substr($search,0,256)) . "\">\n"
600 . "<input type=submit name=\"go\" value=\"" . wfMsg ("go") . "\"> "
601 . "<input type=submit name=\"fulltext\" value=\"" . wfMsg ("search") . "\"></form>";
611 $s = $this->mainPageLink() . $sep
612 . $this->specialLink( "recentchanges" );
614 if ( $wgOut->isArticleRelated() ) {
615 $s .= $sep . $this->editThisPage()
616 . $sep . $this->historyLink();
618 # Many people don't like this dropdown box
619 #$s .= $sep . $this->specialPagesList();
624 function bottomLinks()
626 global $wgOut, $wgUser, $wgTitle;
630 if ( $wgOut->isArticleRelated() ) {
631 $s .= "<strong>" . $this->editThisPage() . "</strong>";
632 if ( 0 != $wgUser->getID() ) {
633 $s .= $sep . $this->watchThisPage();
635 $s .= $sep . $this->talkLink()
636 . $sep . $this->historyLink()
637 . $sep . $this->whatLinksHere()
638 . $sep . $this->watchPageLinksLink();
640 if ( $wgTitle->getNamespace() == Namespace::getUser()
641 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
644 $id=User
::idFromName($wgTitle->getText());
645 $ip=User
::isIP($wgTitle->getText());
647 if($id ||
$ip) { # both anons and non-anons have contri list
648 $s .= $sep . $this->userContribsLink();
650 if ( 0 != $wgUser->getID() ) { # show only to signed in users
651 if($id) { # can only email non-anons
652 $s .= $sep . $this->emailUserLink();
656 if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
657 $s .= "\n<br>" . $this->deleteThisPage() .
658 $sep . $this->protectThisPage() .
659 $sep . $this->moveThisPage();
661 $s .= "<br>\n" . $this->otherLanguages();
668 global $wgOut, $wgLang, $wgArticle, $wgRequest;
669 global $wgDisableCounters;
671 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
672 if ( ! $wgOut->isArticle() ) { return ""; }
673 if ( isset( $oldid ) ||
isset( $diff ) ) { return ""; }
674 if ( 0 == $wgArticle->getID() ) { return ""; }
676 if ( $wgDisableCounters ) {
679 $count = $wgLang->formatNum( $wgArticle->getCount() );
680 $s = wfMsg( "viewcount", $count );
682 $s .= $this->lastModified();
683 $s .= " " . wfMsg( "gnunote" );
687 function lastModified()
689 global $wgLang, $wgArticle;
691 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
692 $s = " " . wfMsg( "lastmodified", $d );
696 function logoText( $align = "" )
698 if ( "" != $align ) { $a = " align='{$align}'"; }
701 $mp = wfMsg( "mainpage" );
702 $titleObj = Title
::newFromText( $mp );
703 $s = "<a href=\"" . $titleObj->escapeLocalURL()
704 . "\"><img{$a} border=0 src=\""
705 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\" /></a>";
711 global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang;
712 global $wgDisableUploads, $wgRemoteUploads;
714 $fname = "Skin::quickBar";
715 wfProfileIn( $fname );
717 $action = $wgRequest->getText( 'action' );
718 $wpPreview = $wgRequest->getBool( 'wpPreview' );
719 $tns=$wgTitle->getNamespace();
721 $s = "\n<div id='quickbar'>";
722 $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
725 $s .= $this->mainPageLink()
726 . $sep . $this->specialLink( "recentchanges" )
727 . $sep . $this->specialLink( "randompage" );
728 if ($wgUser->getID()) {
729 $s.= $sep . $this->specialLink( "watchlist" ) ;
730 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
731 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
734 // only show watchlist link if logged in
735 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
736 $s .= "\n<br><hr class='sep'>";
737 $articleExists = $wgTitle->getArticleId();
738 if ( $wgOut->isArticle() ||
$action =="edit" ||
$action =="history" ||
$wpPreview) {
739 if($wgOut->isArticle()) {
740 $s .= "<strong>" . $this->editThisPage() . "</strong>";
741 } else { # backlink to the article in edit or history mode
742 if($articleExists){ # no backlink if no article
745 $text = wfMsg("articlepage");
748 $text = wfMsg("viewtalkpage");
751 $text = wfMsg("userpage");
754 $text = wfMsg("viewtalkpage");
757 $text = wfMsg("wikipediapage");
760 $text = wfMsg("viewtalkpage");
763 $text = wfMsg("imagepage");
766 $text = wfMsg("viewtalkpage");
769 $text= wfMsg("articlepage");
772 $link = $wgTitle->getText();
773 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
774 $link = $nstext . ":" . $link ;
777 $s .= $this->makeLink( $link, $text );
778 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
779 # we just throw in a "New page" text to tell the user that he's in edit mode,
780 # and to avoid messing with the separator that is prepended to the next item
781 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
787 if( $tns%2
&& $action!="edit" && !$wpPreview) {
788 $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
792 watching could cause problems in edit mode:
793 if user edits article, then loads "watch this article" in background and then saves
794 article with "Watch this article" checkbox disabled, the article is transparently
795 unwatched. Therefore we do not show the "Watch this page" link in edit mode
797 if ( 0 != $wgUser->getID() && $articleExists) {
798 if($action!="edit" && $action != "submit" )
800 $s .= $sep . $this->watchThisPage();
802 if ( $wgTitle->userCanEdit() )
803 $s .= $sep . $this->moveThisPage();
805 if ( $wgUser->isSysop() and $articleExists ) {
806 $s .= $sep . $this->deleteThisPage() .
807 $sep . $this->protectThisPage();
809 $s .= $sep . $this->talkLink();
810 if ($articleExists && $action !="history") {
811 $s .= $sep . $this->historyLink();
813 $s.=$sep . $this->whatLinksHere();
815 if($wgOut->isArticleRelated()) {
816 $s .= $sep . $this->watchPageLinksLink();
819 if ( Namespace::getUser() == $wgTitle->getNamespace()
820 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
823 $id=User
::idFromName($wgTitle->getText());
824 $ip=User
::isIP($wgTitle->getText());
827 $s .= $sep . $this->userContribsLink();
829 if ( 0 != $wgUser->getID() ) {
830 if($id) { # can only email real users
831 $s .= $sep . $this->emailUserLink();
835 $s .= "\n<br><hr class='sep'>";
838 if ( 0 != $wgUser->getID() && ( !$wgDisableUploads ||
$wgRemoteUploads ) ) {
839 $s .= $this->specialLink( "upload" ) . $sep;
841 $s .= $this->specialLink( "specialpages" )
842 . $sep . $this->bugReportsLink();
844 global $wgSiteSupportPage;
845 if( $wgSiteSupportPage ) {
846 $s .= "\n<br><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
847 "\" class=\"internal\">" . wfMsg( "sitesupport" ) . "</a>";
850 $s .= "\n<br></div>\n";
851 wfProfileOut( $fname );
855 function specialPagesList()
857 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
860 $validSP = $wgLang->getValidSpecialPages();
862 foreach ( $validSP as $name => $desc ) {
863 if ( "" == $desc ) { continue; }
866 if ( $wgUser->isSysop() )
868 $sysopSP = $wgLang->getSysopSpecialPages();
870 foreach ( $sysopSP as $name => $desc ) {
871 if ( "" == $desc ) { continue; }
875 if ( $wgUser->isDeveloper() )
877 $devSP = $wgLang->getDeveloperSpecialPages();
879 foreach ( $devSP as $name => $desc ) {
880 if ( "" == $desc ) { continue; }
885 $sp = wfMsg( "specialpages" );
886 $spp = $wgLang->specialPage( "Specialpages" );
888 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
889 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
890 $s .= "<select name=\"wpDropdown\">\n";
891 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
893 foreach ( $a as $name => $desc ) {
894 $p = $wgLang->specialPage( $name );
895 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
898 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
903 function mainPageLink()
905 $mp = wfMsg( "mainpage" );
906 $s = $this->makeKnownLink( $mp, $mp );
910 function copyrightLink()
912 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
913 wfMsg( "copyrightpagename" ) );
919 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
920 wfMsg( "aboutwikipedia" ) );
925 function disclaimerLink()
927 $s = $this->makeKnownLink( wfMsg( "disclaimerpage" ),
928 wfMsg( "disclaimers" ) );
932 function editThisPage()
934 global $wgOut, $wgTitle, $wgRequest;
936 $oldid = $wgRequest->getVal( 'oldid' );
937 $diff = $wgRequest->getVal( 'diff' );
938 $redirect = $wgRequest->getVal( 'redirect' );
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 ( !is_null( $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, $wgRequest;
965 $diff = $wgRequest->getVal( 'diff' );
966 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
967 $n = $wgTitle->getPrefixedText();
968 $t = wfMsg( "deletethispage" );
970 $s = $this->makeKnownLink( $n, $t, "action=delete" );
977 function protectThisPage()
979 global $wgUser, $wgOut, $wgTitle, $wgRequest;
981 $diff = $wgRequest->getVal( 'diff' );
982 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
983 $n = $wgTitle->getPrefixedText();
985 if ( $wgTitle->isProtected() ) {
986 $t = wfMsg( "unprotectthispage" );
987 $q = "action=unprotect";
989 $t = wfMsg( "protectthispage" );
990 $q = "action=protect";
992 $s = $this->makeKnownLink( $n, $t, $q );
999 function watchThisPage()
1001 global $wgUser, $wgOut, $wgTitle;
1003 if ( $wgOut->isArticleRelated() ) {
1004 $n = $wgTitle->getPrefixedText();
1006 if ( $wgTitle->userIsWatching() ) {
1007 $t = wfMsg( "unwatchthispage" );
1008 $q = "action=unwatch";
1010 $t = wfMsg( "watchthispage" );
1011 $q = "action=watch";
1013 $s = $this->makeKnownLink( $n, $t, $q );
1015 $s = wfMsg( "notanarticle" );
1020 function moveThisPage()
1022 global $wgTitle, $wgLang;
1024 if ( $wgTitle->userCanEdit() ) {
1025 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
1026 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
1027 } // no message if page is protected - would be redundant
1031 function historyLink()
1035 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1036 wfMsg( "history" ), "action=history" );
1040 function whatLinksHere()
1042 global $wgTitle, $wgLang;
1044 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
1045 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
1049 function userContribsLink()
1051 global $wgTitle, $wgLang;
1053 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1054 wfMsg( "contributions" ), "target=" . $wgTitle->getPartialURL() );
1058 function emailUserLink()
1060 global $wgTitle, $wgLang;
1062 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
1063 wfMsg( "emailuser" ), "target=" . $wgTitle->getPartialURL() );
1067 function watchPageLinksLink()
1069 global $wgOut, $wgTitle, $wgLang;
1071 if ( ! $wgOut->isArticleRelated() ) {
1072 $s = "(" . wfMsg( "notanarticle" ) . ")";
1074 $s = $this->makeKnownLink( $wgLang->specialPage(
1075 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
1076 "target=" . $wgTitle->getPrefixedURL() );
1081 function otherLanguages()
1083 global $wgOut, $wgLang, $wgTitle, $wgUseNewInterlanguage;
1085 $a = $wgOut->getLanguageLinks();
1086 if ( 0 == count( $a ) ) {
1087 if ( !$wgUseNewInterlanguage ) return "";
1088 $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
1089 if ( $ns != 0 AND $ns != 1 ) return "" ;
1091 $x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
1092 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1093 wfMsg( "intl" ) , $x );
1096 if ( !$wgUseNewInterlanguage ) {
1097 $s = wfMsg( "otherlanguages" ) . ": ";
1099 global $wgLanguageCode ;
1100 $x = "mode=zoom&xt=".$wgTitle->getDBkey() ;
1101 $x .= "&xl=".$wgLanguageCode ;
1102 $s = $this->makeKnownLink( $wgLang->specialPage( "Intl" ),
1103 wfMsg( "otherlanguages" ) , $x ) . ": " ;
1106 $s = wfMsg( "otherlanguages" ) . ": ";
1108 if($wgLang->isRTL()) $s .= "<span dir='LTR'>";
1109 foreach( $a as $l ) {
1110 if ( ! $first ) { $s .= " | "; }
1113 $nt = Title
::newFromText( $l );
1114 $url = $nt->getFullURL();
1115 $text = $wgLang->getLanguageName( $nt->getInterwiki() );
1117 if ( "" == $text ) { $text = $l; }
1118 $style = $this->getExternalLinkAttributes( $l, $text );
1119 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
1121 if($wgLang->isRTL()) $s .= "</span>";
1125 function bugReportsLink()
1127 $s = $this->makeKnownLink( wfMsg( "bugreportspage" ),
1128 wfMsg( "bugreports" ) );
1134 global $wgLinkCache;
1135 $t1 = Title
::newFromText( gmdate( "F j" ) );
1136 $t2 = Title
::newFromText( gmdate( "Y" ) );
1138 $wgLinkCache->suspend();
1139 $id = $t1->getArticleID();
1140 $wgLinkCache->resume();
1143 $s = $this->makeBrokenLink( $t1->getText() );
1145 $s = $this->makeKnownLink( $t1->getText() );
1149 $wgLinkCache->suspend();
1150 $id = $t2->getArticleID();
1151 $wgLinkCache->resume();
1154 $s .= $this->makeBrokenLink( $t2->getText() );
1156 $s .= $this->makeKnownLink( $t2->getText() );
1163 global $wgLang, $wgTitle, $wgLinkCache;
1165 $tns = $wgTitle->getNamespace();
1166 if ( -1 == $tns ) { return ""; }
1168 $pn = $wgTitle->getText();
1169 $tp = wfMsg( "talkpage" );
1170 if ( Namespace::isTalk( $tns ) ) {
1171 $lns = Namespace::getSubject( $tns );
1174 $text = wfMsg("articlepage");
1177 $text = wfMsg("userpage");
1180 $text = wfMsg("wikipediapage");
1183 $text = wfMsg("imagepage");
1186 $text= wfMsg("articlepage");
1190 $lns = Namespace::getTalk( $tns );
1193 $n = $wgLang->getNsText( $lns );
1194 if ( "" == $n ) { $link = $pn; }
1195 else { $link = "{$n}:{$pn}"; }
1197 $wgLinkCache->suspend();
1198 $s = $this->makeLink( $link, $text );
1199 $wgLinkCache->resume();
1204 function commentLink()
1206 global $wgLang, $wgTitle, $wgLinkCache;
1208 $tns = $wgTitle->getNamespace();
1209 if ( -1 == $tns ) { return ""; }
1211 $lns = ( Namespace::isTalk( $tns ) ) ?
$tns : Namespace::getTalk( $tns );
1213 # assert Namespace::isTalk( $lns )
1215 $n = $wgLang->getNsText( $lns );
1216 $pn = $wgTitle->getText();
1218 $link = "{$n}:{$pn}";
1220 $wgLinkCache->suspend();
1221 $s = $this->makeKnownLink($link, wfMsg("postcomment"), "action=edit§ion=new");
1222 $wgLinkCache->resume();
1227 # After all the page content is transformed into HTML, it makes
1228 # a final pass through here for things like table backgrounds.
1230 function transformContent( $text )
1235 # Note: This function MUST call getArticleID() on the link,
1236 # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
1238 function makeLink( $title, $text = "", $query = "", $trail = "" ) {
1239 wfProfileIn( "Skin::makeLink" );
1240 $nt = Title
::newFromText( $title );
1242 $result = $this->makeLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1244 wfDebug( "Invalid title passed to Skin::makeLink(): \"$title\"\n" );
1245 $result = $text == "" ?
$title : $text;
1248 wfProfileOut( "Skin::makeLink" );
1252 function makeKnownLink( $title, $text = "", $query = "", $trail = "" ) {
1253 $nt = Title
::newFromText( $title );
1255 return $this->makeKnownLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1257 wfDebug( "Invalid title passed to Skin::makeKnownLink(): \"$title\"\n" );
1258 return $text == "" ?
$title : $text;
1262 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" ) {
1263 $nt = Title
::newFromText( $title );
1265 return $this->makeBrokenLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1267 wfDebug( "Invalid title passed to Skin::makeBrokenLink(): \"$title\"\n" );
1268 return $text == "" ?
$title : $text;
1272 function makeStubLink( $title, $text = "", $query = "", $trail = "" ) {
1273 $nt = Title
::newFromText( $title );
1275 return $this->makeStubLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1277 wfDebug( "Invalid title passed to Skin::makeStubLink(): \"$title\"\n" );
1278 return $text == "" ?
$title : $text;
1282 # Pass a title object, not a title string
1283 function makeLinkObj( &$nt, $text= "", $query = "", $trail = "", $prefix = "" )
1285 global $wgOut, $wgUser;
1286 if ( $nt->isExternal() ) {
1287 $u = $nt->getFullURL();
1288 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1289 $style = $this->getExternalLinkAttributes( $link, $text );
1292 if ( "" != $trail ) {
1293 if ( preg_match( "/^([a-z]+)(.*)$$/sD", $trail, $m ) ) {
1298 $retVal = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1299 } elseif ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
1300 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1301 } elseif ( ( -1 == $nt->getNamespace() ) ||
1302 ( Namespace::getImage() == $nt->getNamespace() ) ) {
1303 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1305 $aid = $nt->getArticleID() ;
1307 $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail, $prefix );
1309 $threshold = $wgUser->getOption("stubthreshold") ;
1310 if ( $threshold > 0 ) {
1311 $res = wfQuery ( "SELECT LENGTH(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ
) ;
1313 if ( wfNumRows( $res ) > 0 ) {
1314 $s = wfFetchObject( $res );
1316 if ( $s->cur_is_redirect
OR $s->cur_namespace
!= 0 ) {
1317 $size = $threshold*2 ; # Really big
1319 wfFreeResult( $res );
1321 $size = $threshold*2 ; # Really big
1326 if ( $size < $threshold ) {
1327 $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
1329 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1336 # Pass a title object, not a title string
1337 function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1339 global $wgOut, $wgTitle;
1341 $fname = "Skin::makeKnownLinkObj";
1342 wfProfileIn( $fname );
1344 $link = $nt->getPrefixedURL();
1346 if ( "" == $link ) {
1348 if ( "" == $text ) { $text = $nt->getFragment(); }
1350 $u = $nt->escapeLocalURL( $query );
1352 if ( "" != $nt->getFragment() ) {
1353 $u .= "#" . wfEscapeHTML( $nt->getFragment() );
1355 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1356 $style = $this->getInternalLinkAttributesObj( $nt, $text );
1359 if ( "" != $trail ) {
1360 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1365 $r = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1366 wfProfileOut( $fname );
1370 # Pass a title object, not a title string
1371 function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1373 global $wgOut, $wgUser;
1375 $fname = "Skin::makeBrokenLinkObj";
1376 wfProfileIn( $fname );
1378 if ( "" == $query ) {
1381 $q = "action=edit&{$query}";
1383 $u = $nt->escapeLocalURL( $q );
1385 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1386 $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
1389 if ( "" != $trail ) {
1390 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1395 if ( $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 ( $wgUser->getOption( "highlightbroken" ) ) {
1425 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1427 $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1432 function fnamePart( $url )
1434 $basename = strrchr( $url, "/" );
1435 if ( false === $basename ) { $basename = $url; }
1436 else { $basename = substr( $basename, 1 ); }
1437 return wfEscapeHTML( $basename );
1440 function makeImage( $url, $alt = "" )
1444 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1445 $s = "<img src=\"{$url}\" alt=\"{$alt}\" />";
1449 function makeImageLink( $name, $url, $alt = "" ) {
1450 $nt = Title
::makeTitle( Namespace::getImage(), $name );
1451 return $this->makeImageLinkObj( $nt, $alt );
1454 function makeImageLinkObj( $nt, $alt = "" ) {
1455 global $wgLang, $wgUseImageResize;
1456 $name = $nt->getDBKey();
1457 $url = wfImageUrl( $name );
1459 $prefix = $postfix = "";
1461 if ( $wgUseImageResize ) {
1462 # Check if the alt text is of the form "options|alt text"
1464 # * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang
1465 # * left no resizing, just left align. label is used for alt= only
1466 # * right same, but right aligned
1467 # * none same, but not aligned
1468 # * ___px scale to ___ pixels width, no aligning. e.g. use in taxobox
1470 $part = explode( "|", $alt);
1472 $mwThumb =& MagicWord
::get( MAG_IMG_THUMBNAIL
);
1473 $mwLeft =& MagicWord
::get( MAG_IMG_LEFT
);
1474 $mwRight =& MagicWord
::get( MAG_IMG_RIGHT
);
1475 $mwNone =& MagicWord
::get( MAG_IMG_NONE
);
1476 $mwWidth =& MagicWord
::get( MAG_IMG_WIDTH
);
1477 $mwCenter =& MagicWord
::get( MAG_IMG_CENTER
);
1478 $alt = $part[count($part)-1];
1482 foreach( $part as $key => $val ) {
1483 if ( ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
1485 } elseif ( ! is_null( $mwRight->matchVariableStartToEnd($val) ) ) {
1486 # remember to set an alignment, don't render immediately
1488 } elseif ( ! is_null( $mwLeft->matchVariableStartToEnd($val) ) ) {
1489 # remember to set an alignment, don't render immediately
1491 } elseif ( ! is_null( $mwCenter->matchVariableStartToEnd($val) ) ) {
1492 # remember to set an alignment, don't render immediately
1494 } elseif ( ! is_null( $mwNone->matchVariableStartToEnd($val) ) ) {
1495 # remember to set an alignment, don't render immediately
1497 } elseif ( ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {
1498 # $match is the image width in pixels
1499 $width = intval($match);
1502 if ( "center" == $align )
1504 $prefix = "<center>";
1505 $postfix = "</center>";
1511 # Create a thumbnail. Alignment depends on language
1512 # writing direction, # right aligned for left-to-right-
1513 # languages ("Western languages"), left-aligned
1514 # for right-to-left-languages ("Semitic languages")
1516 # If thumbnail width has not been provided, it is set
1517 # here to 180 pixels
1518 if ( $align == "" ) {
1519 $align = $wgLang->isRTL() ?
"left" : "right";
1521 if ( ! isset($width) ) {
1524 return $prefix.$this->makeThumbLinkObj( $nt, $alt, $align, $width ).$postfix;
1526 } elseif ( isset($width) ) {
1528 # Create a resized image, without the additional thumbnail
1530 $url = $this->createThumb( $name, $width );
1532 } # endif $wgUseImageResize
1534 if ( empty( $alt ) ) {
1535 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1537 $alt = htmlspecialchars( $alt );
1539 $u = $nt->escapeLocalURL();
1542 $s = str_replace( "$1", $name, wfMsg("missingimage") );
1544 $s = "\n <a href=\"{$u}\" class='image' title=\"{$alt}\">\n" .
1545 " <img border=\"0\" src=\"{$url}\" alt=\"{$alt}\" />\n </a>";
1547 if ( "" != $align ) {
1548 $s = "<div class=\"float{$align}\">{$s}\n</div>";
1550 return $prefix.$s.$postfix;
1553 function createThumb( $name, $width ) {
1554 global $wgUploadDirectory;
1555 global $wgImageMagickConvertCommand;
1556 global $wgUseImageMagick;
1557 global $wgUseSquid, $wgInternalServer;
1558 $imgPath = wfImagePath( $name );
1559 $thumbName = $width."px-".$icon.$name;
1560 $thumbPath = wfImageThumbDir( $thumbName )."/".$thumbName;
1561 $thumbUrl = wfImageThumbUrl( $thumbName );
1563 if ( ! file_exists( $imgPath ) )
1565 # If there is no image, there will be no thumbnail
1569 if ( (! file_exists( $thumbPath ) )
1570 ||
( filemtime($thumbPath) < filemtime($imgPath) ) ) {
1572 if ( $wgUseSquid ) {
1574 $wgInternalServer.$thumbUrl
1576 wfPurgeSquidServers($urlArr);
1579 if ( $wgUseImageMagick ) {
1581 $cmd = $wgImageMagickConvertCommand .
1582 " -quality 85 -geometry {$width} ".
1583 escapeshellarg($imgPath) . " " .
1584 escapeshellarg($thumbPath);
1585 $conv = shell_exec( $cmd );
1587 # Use PHP's builtin GD library functions.
1589 # First find out what kind of file this is, and select the correct
1590 # input routine for this.
1591 list($src_width, $src_height, $src_type, $src_attr) = getimagesize( $imgPath );
1592 switch( $src_type ) {
1594 $src_image = imagecreatefromgif( $imgPath );
1597 $src_image = imagecreatefromjpeg( $imgPath );
1600 $src_image = imagecreatefrompng( $imgPath );
1602 case 15: # WBMP for WML
1603 $src_image = imagecreatefromwbmp( $imgPath );
1606 $src_image = imagecreatefromxbm( $imgPath );
1609 return "Image type not supported";
1612 $height = floor( $src_height * ( $width/$src_width ) );
1613 $dst_image = imagecreatetruecolor( $width, $height );
1614 imagecopyresampled( $dst_image, $src_image,
1616 $width, $height, $src_width, $src_height );
1617 switch( $src_type ) {
1622 #$thumbUrl .= ".png";
1623 #$thumbPath .= ".png";
1624 imagepng( $dst_image, $thumbPath );
1627 #$thumbUrl .= ".jpg";
1628 #$thumbPath .= ".jpg";
1629 imageinterlace( $dst_image );
1630 imagejpeg( $dst_image, $thumbPath, 95 );
1635 imagedestroy( $dst_image );
1636 imagedestroy( $src_image );
1641 # Check for zero-sized thumbnails. Those can be generated when
1642 # no disk space is available or some other error occurs
1644 $thumbstat = stat( $thumbPath );
1645 $imgstat = stat( $imgPath );
1646 if( $thumbstat["size"] == 0 )
1648 unlink( $thumbPath );
1655 function makeThumbLinkObj( $nt, $label = "", $align = "right", $boxwidth = 180 ) {
1656 global $wgUploadPath, $wgLang;
1657 $name = $nt->getDBKey();
1658 $image = Title
::makeTitle( Namespace::getImage(), $name );
1659 $url = wfImageUrl( $name );
1660 $path = wfImagePath( $name );
1662 #$label = htmlspecialchars( $label );
1663 $alt = preg_replace( "/<[^>]*>/", "", $label);
1664 $alt = htmlspecialchars( $alt );
1666 if ( file_exists( $path ) )
1668 list($width, $height, $type, $attr) = getimagesize( $path );
1670 $width = $height = 200;
1672 $boxheight = intval( $height/($width/$boxwidth) );
1673 if ( $boxwidth > $width ) {
1675 $boxheight = $height;
1678 $thumbUrl = $this->createThumb( $name, $boxwidth );
1680 $u = $nt->escapeLocalURL();
1682 $more = htmlspecialchars( wfMsg( "thumbnail-more" ) );
1683 $magnifyalign = $wgLang->isRTL() ?
"left" : "right";
1684 $textalign = $wgLang->isRTL() ?
" style=\"text-align:right\"" : "";
1686 $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$boxwidth}px;\">";
1687 if ( $thumbUrl == "" ) {
1688 $s .= str_replace( "$1", $name, wfMsg("missingimage") );
1690 $s .= "\n".' <a href="'.$u.'" class="internal" title="'.$alt.'">'."\n".
1691 ' <img border="0" src="'.$thumbUrl.'" alt="'.$alt.'" ' .
1692 ' width="'.$boxwidth.'" height="'.$boxheight.'" /></a>' ."\n".
1693 ' <a href="'.$u.'" class="internal" title="'.$more.'"> ' ."\n".
1694 ' <img border="0" src="'.$wgUploadPath.'/magnify-clip.png" ' .
1695 'width="26" height="24" align="'.$magnifyalign.'" alt="'.$more.'" /> </a>'."\n";
1697 $s .= ' <p'.$textalign.'>'.$label."</p>\n</div>";
1701 function makeMediaLink( $name, $url, $alt = "" ) {
1702 $nt = Title
::makeTitle( Namespace::getMedia(), $name );
1703 return $this->makeMediaLinkObj( $nt, $alt );
1706 function makeMediaLinkObj( $nt, $alt = "" )
1708 $name = $nt->getDBKey();
1709 $url = wfImageUrl( $name );
1710 if ( empty( $alt ) ) {
1711 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1714 $u = htmlspecialchars( $url );
1715 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1719 function specialLink( $name, $key = "" )
1723 if ( "" == $key ) { $key = strtolower( $name ); }
1724 $pn = $wgLang->ucfirst( $name );
1725 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1729 # Called by history lists and recent changes
1732 # Returns text for the start of the tabular part of RC
1733 function beginRecentChangesList()
1735 $this->rc_cache
= array() ;
1736 $this->rcMoveIndex
= 0;
1737 $this->rcCacheIndex
= 0 ;
1738 $this->lastdate
= "";
1742 function beginImageHistoryList()
1744 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1745 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul class='special'>";
1749 # Returns text for the end of RC
1750 # If enhanced RC is in use, returns pretty much all the text
1751 function endRecentChangesList()
1753 $s = $this->recentChangesBlock() ;
1758 # Enhanced RC ungrouped line
1759 function recentChangesBlockLine ( $rcObj )
1761 global $wgUploadPath, $wgLang ;
1763 # Get rc_xxxx variables
1764 extract( $rcObj->mAttribs
) ;
1765 $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 $rc_comment=$this->formatComment($rc_comment);
1815 $r .= $wgLang->emphasize( " (".$rc_comment.")" );
1823 function recentChangesBlockGroup ( $block )
1825 global $wgUploadPath, $wgLang ;
1828 $M = wfMsg( "minoreditletter" );
1829 $N = wfMsg( "newpageletter" );
1831 # Collate list of users
1833 $userlinks = array () ;
1834 foreach ( $block AS $rcObj ) {
1835 $oldid = $rcObj->mAttribs
['rc_last_oldid'];
1836 if ( $rcObj->mAttribs
['rc_new'] ) $isnew = true ;
1837 $u = $rcObj->userlink
;
1838 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1842 # Sort the list and convert to text
1843 krsort ( $userlinks ) ;
1844 asort ( $userlinks ) ;
1846 foreach ( $userlinks as $userlink => $count) {
1848 if ( $count > 1 ) $text .= " ({$count}×)" ;
1849 array_push ( $users , $text ) ;
1851 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1854 $rci = "RCI{$this->rcCacheIndex}" ;
1855 $rcl = "RCL{$this->rcCacheIndex}" ;
1856 $rcm = "RCM{$this->rcCacheIndex}" ;
1857 $toggleLink = "javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")" ;
1858 $arrowdir = $wgLang->isRTL() ?
"l" : "r";
1859 $tl = "<span id='{$rcm}'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_{$arrowdir}.png' width='12' height='12' border='0' /></a></span>" ;
1860 $tl .= "<span id='{$rcl}' style='display:none'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_d.png' width='12' height='12' border='0' /></a></span>" ;
1866 if ( $isnew ) $r .= $N ;
1867 else $r .= " " ;
1868 $r .= " " ; # Minor
1871 $r .= " ".$block[0]->timestamp
." " ;
1875 $link = $block[0]->link
;
1876 if ( $block[0]->watched
) $link = "<strong>{$link}</strong>" ;
1879 $curIdEq = "curid=" . $block[0]->mAttribs
['rc_cur_id'];
1880 if ( $block[0]->mAttribs
['rc_type'] != RC_LOG
) {
1882 $r .= " (".count($block)." " ;
1883 if ( $isnew ) $r .= wfMsg("changes");
1884 else $r .= $this->makeKnownLinkObj( $block[0]->getTitle() , wfMsg("changes") ,
1885 "{$curIdEq}&diff=0&oldid=".$oldid ) ;
1889 $r .= $this->makeKnownLinkObj( $block[0]->getTitle(), wfMsg( "history" ), "{$curIdEq}&action=history" );
1897 $r .= "<div id='{$rci}' style='display:none'>" ;
1898 foreach ( $block AS $rcObj ) {
1899 # Get rc_xxxx variables
1900 extract( $rcObj->mAttribs
);
1902 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0 />";
1903 $r .= "<tt> " ;
1904 if ( $rc_new ) $r .= $N ;
1905 else $r .= " " ;
1906 if ( $rc_minor ) $r .= $M ;
1907 else $r .= " " ;
1911 if ( $rc_last_oldid != 0 ) {
1912 $o = "oldid=".$rc_last_oldid ;
1914 if ( $rc_type == RC_LOG
) {
1915 $link = $rcObj->timestamp
;
1917 $link = $this->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp
, "{$curIdEq}&$o" ) ;
1919 $link = "<tt>{$link}</tt>" ;
1923 $r .= $rcObj->curlink
;
1925 $r .= $rcObj->lastlink
;
1926 $r .= ") . . ".$rcObj->userlink
;
1927 $r .= $rcObj->usertalklink
;
1928 if ( $rc_comment != "" ) {
1929 $rc_comment=$this->formatComment($rc_comment);
1930 $r .= $wgLang->emphasize( " (".$rc_comment.")" ) ;
1936 $this->rcCacheIndex++
;
1940 # If enhanced RC is in use, this function takes the previously cached
1941 # RC lines, arranges them, and outputs the HTML
1942 function recentChangesBlock ()
1944 global $wgUploadPath ;
1945 if ( count ( $this->rc_cache
) == 0 ) return "" ;
1947 foreach ( $this->rc_cache
AS $secureName => $block ) {
1948 if ( count ( $block ) < 2 ) {
1949 $blockOut .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ;
1951 $blockOut .= $this->recentChangesBlockGroup ( $block ) ;
1955 return "<div>{$blockOut}</div>" ;
1958 # Called in a loop over all displayed RC entries
1959 # Either returns the line, or caches it for later use
1960 function recentChangesLine( &$rc, $watched = false )
1963 $usenew = $wgUser->getOption( "usenewrc" );
1965 $line = $this->recentChangesLineNew ( $rc, $watched ) ;
1967 $line = $this->recentChangesLineOld ( $rc, $watched ) ;
1971 function recentChangesLineOld( &$rc, $watched = false )
1973 global $wgTitle, $wgLang, $wgUser;
1975 # Extract DB fields into local scope
1976 extract( $rc->mAttribs
);
1977 $curIdEq = "curid=" . $rc_cur_id;
1979 # Make date header if necessary
1980 $date = $wgLang->date( $rc_timestamp, true);
1982 if ( $date != $this->lastdate
) {
1983 if ( "" != $this->lastdate
) { $s .= "</ul>\n"; }
1984 $s .= "<h4>{$date}</h4>\n<ul class='special'>";
1985 $this->lastdate
= $date;
1989 if ( $rc_type == RC_MOVE
) {
1991 $s .= "(" . wfMsg( "diff" ) . ") (";
1993 $s .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), wfMsg( "hist" ), "action=history" ) .
1996 # "[[x]] moved to [[y]]"
1998 $s .= wfMsg( "1movedto2", $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" ),
1999 $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" ) );
2003 if ( $rc_type == RC_NEW ||
$rc_type == RC_LOG
) {
2004 $diffLink = wfMsg( "diff" );
2006 $diffLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "diff" ),
2007 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
2009 $s .= "($diffLink) (";
2012 $s .= $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
2015 # M and N (minor and new)
2016 $M = wfMsg( "minoreditletter" );
2017 $N = wfMsg( "newpageletter" );
2018 if ( $rc_minor ) { $s .= " <strong>{$M}</strong>"; }
2019 if ( $rc_type == RC_NEW
) { $s .= "<strong>{$N}</strong>"; }
2022 $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), "" );
2025 $articleLink = "<strong>{$articleLink}</strong>";
2027 $s .= " $articleLink";
2032 $s .= "; " . $wgLang->time( $rc_timestamp, true ) . " . . ";
2034 # User link (or contributions for unregistered users)
2035 if ( 0 == $rc_user ) {
2036 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2037 $rc_user_text, "target=" . $rc_user_text );
2039 $userLink = $this->makeLink( $wgLang->getNsText( NS_USER
) . ":{$rc_user_text}", $rc_user_text );
2044 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2045 global $wgDisableAnonTalk;
2046 if( 0 == $rc_user && $wgDisableAnonTalk ) {
2049 $utns=$wgLang->getNsText(NS_USER_TALK
);
2050 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2054 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2055 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2056 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2060 if($userTalkLink) $userTalkLink .= " | ";
2061 $userTalkLink .= $blockLink;
2063 if($userTalkLink) $s.=" ({$userTalkLink})";
2066 if ( "" != $rc_comment && "*" != $rc_comment && $rc_type != RC_MOVE
) {
2067 $rc_comment=$this->formatComment($rc_comment);
2068 $s .= $wgLang->emphasize(" (" . $rc_comment . ")");
2075 # function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
2076 function recentChangesLineNew( &$baseRC, $watched = false )
2078 global $wgTitle, $wgLang, $wgUser;
2080 # Create a specialised object
2081 $rc = RCCacheEntry
::newFromParent( $baseRC ) ;
2083 # Extract fields from DB into the function scope (rc_xxxx variables)
2084 extract( $rc->mAttribs
);
2085 $curIdEq = "curid=" . $rc_cur_id;
2087 # If it's a new day, add the headline and flush the cache
2088 $date = $wgLang->date( $rc_timestamp, true);
2090 if ( $date != $this->lastdate
) {
2091 # Process current cache
2092 $ret = $this->recentChangesBlock () ;
2093 $this->rc_cache
= array() ;
2094 $ret .= "<h4>{$date}</h4>\n";
2095 $this->lastdate
= $date;
2099 if ( $rc_type == RC_MOVE
) {
2100 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" );
2101 $clink .= " " . wfMsg("movedto") . " ";
2102 $clink .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" );
2104 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "" ) ;
2107 $time = $wgLang->time( $rc_timestamp, true );
2108 $rc->watched
= $watched ;
2109 $rc->link
= $clink ;
2110 $rc->timestamp
= $time;
2113 if ( ( $rc_type == RC_NEW
&& $rc_this_oldid == 0 ) ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2114 $curLink = wfMsg( "cur" );
2116 $curLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "cur" ),
2117 "{$curIdEq}&diff=0&oldid={$rc_this_oldid}" );
2121 $titleObj = $rc->getTitle();
2122 if ( $rc_last_oldid == 0 ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2123 $lastLink = wfMsg( "last" );
2125 $lastLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "last" ),
2126 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
2129 # Make user link (or user contributions for unregistered users)
2130 if ( 0 == $rc_user ) {
2131 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2132 $rc_user_text, "target=" . $rc_user_text );
2134 $userLink = $this->makeLink( $wgLang->getNsText(
2135 Namespace::getUser() ) . ":{$rc_user_text}", $rc_user_text );
2138 $rc->userlink
= $userLink ;
2139 $rc->lastlink
= $lastLink ;
2140 $rc->curlink
= $curLink ;
2142 # Make user talk link
2143 $utns=$wgLang->getNsText(NS_USER_TALK
);
2144 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2145 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2147 global $wgDisableAnonTalk;
2148 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2149 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2150 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2151 if( $wgDisableAnonTalk )
2152 $rc->usertalklink
= " ({$blockLink})";
2154 $rc->usertalklink
= " ({$userTalkLink} | {$blockLink})";
2156 if( $wgDisableAnonTalk && ($rc_user == 0) )
2157 $rc->usertalklink
= "";
2159 $rc->usertalklink
= " ({$userTalkLink})";
2162 # Put accumulated information into the cache, for later display
2163 # Page moves go on their own line
2164 $title = $rc->getTitle();
2165 $secureName = $title->getPrefixedDBkey();
2166 if ( $rc_type == RC_MOVE
) {
2167 # Use an @ character to prevent collision with page names
2168 $this->rc_cache
["@@" . ($this->rcMoveIndex++
)] = array($rc);
2170 if ( !isset ( $this->rc_cache
[$secureName] ) ) $this->rc_cache
[$secureName] = array() ;
2171 array_push ( $this->rc_cache
[$secureName] , $rc ) ;
2176 function endImageHistoryList()
2182 /* This function is called by all recent changes variants, by the page history,
2183 and by the user contributions list. It is responsible for formatting edit
2184 comments. It escapes any HTML in the comment, but adds some CSS to format
2185 auto-generated comments (from section editing).
2187 function formatComment($comment)
2189 $comment=wfEscapeHTML($comment);
2191 # format text between /* .. */ with autocomment CSS class
2192 $comment=preg_replace("/\/\*\s*(.*?)\s*\*\//i",
2193 "<span id=\"autocomment\">$1</span>",$comment);
2197 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
2199 global $wgUser, $wgLang, $wgTitle;
2201 $dt = $wgLang->timeanddate( $ts, true );
2202 $del = wfMsg( "deleteimg" );
2203 $cur = wfMsg( "cur" );
2206 $url = wfImageUrl( $img );
2208 if ( $wgUser->isSysop() ) {
2209 $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
2211 $style = $this->getInternalLinkAttributes( $link, $del );
2213 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
2218 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
2219 if( $wgUser->getID() != 0 ) {
2220 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2221 wfMsg( "revertimg" ), "action=revert&oldimage=" .
2222 urlencode( $img ) );
2223 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2224 $del, "action=delete&oldimage=" . urlencode( $img ) );
2226 # Having live active links for non-logged in users
2227 # means that bots and spiders crawling our site can
2228 # inadvertently change content. Baaaad idea.
2229 $rlink = wfMsg( "revertimg" );
2233 if ( 0 == $u ) { $ul = $ut; }
2234 else { $ul = $this->makeLink( $wgLang->getNsText(
2235 Namespace::getUser() ) . ":{$ut}", $ut ); }
2237 $nb = wfMsg( "nbytes", $size );
2238 $style = $this->getInternalLinkAttributes( $url, $dt );
2240 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
2241 . " . . {$ul} ({$nb})";
2243 if ( "" != $c && "*" != $c ) {
2244 $s .= $wgLang->emphasize(" (" . wfEscapeHTML( $c ) . ")");
2250 function tocIndent($level) {
2251 return str_repeat( "<div class='tocindent'>\n", $level>0 ?
$level : 0 );
2254 function tocUnindent($level) {
2255 return str_repeat( "</div>\n", $level>0 ?
$level : 0 );
2258 # parameter level defines if we are on an indentation level
2259 function tocLine( $anchor, $tocline, $level ) {
2260 $link = "<a href=\"#$anchor\">$tocline</a><br />";
2264 return "<div class='tocline'>$link</div>\n";
2269 function tocTable($toc) {
2270 # note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
2271 # try min-width & co when somebody gets a chance
2272 $hideline = " <script type='text/javascript'>showTocToggle(\"" . addslashes( wfMsg("showtoc") ) . "\",\"" . addslashes( wfMsg("hidetoc") ) . "\")</script>";
2274 "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
2275 "<b>".wfMsg("toc")."</b>" .
2277 "</td></tr><tr id='tocinside'><td>\n".
2278 $toc."</td></tr></table><P>\n";
2281 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
2282 function editSectionScript( $section, $head ) {
2283 global $wgTitle, $wgRequest;
2284 if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
2287 $url = $wgTitle->escapeLocalURL( "action=edit§ion=$section" );
2288 return "<span oncontextmenu='document.location=\"$url\";return false;'>{$head}</span>";
2291 function editSectionLink( $section ) {
2293 global $wgTitle, $wgUser, $wgLang;
2295 if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
2296 # Section edit links would be out of sync on an old page.
2297 # But, if we're diffing to the current page, they'll be
2302 $editurl = "§ion={$section}";
2303 $url = $this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
2305 if( $wgLang->isRTL() ) {
2307 $nearside = "right";
2312 return "<div class=\"editsection\" style=\"float:$farside;margin-$nearside:5px;\">[".$url."]</div>";
2316 // This function is called by EditPage.php and shows a bulletin board style
2317 // toolbar for common editing functions. It can be disabled in the user preferences.
2318 // The necsesary JavaScript code can be found in style/wikibits.js.
2319 function getEditToolbar() {
2321 global $wgUploadPath,$wgLang;
2323 // toolarray an array of arrays which each include the filename of
2324 // the button image (without path), the opening tag, the closing tag,
2325 // and optionally a sample text that is inserted between the two when no
2326 // selection is highlighted.
2327 // The tip text is shown when the user moves the mouse over the button.
2329 array( "image"=>"button_bold.png",
2332 "sample"=>wfMsg("bold_sample"),
2333 "tip"=>wfMsg("bold_tip")),
2334 array( "image"=>"button_italic.png",
2337 "sample"=>wfMsg("italic_sample"),
2338 "tip"=>wfMsg("italic_tip")),
2339 array( "image"=>"button_link.png",
2342 "sample"=>wfMsg("link_sample"),
2343 "tip"=>wfMsg("link_tip")),
2344 array( "image"=>"button_extlink.png",
2347 "sample"=>wfMsg("extlink_sample"),
2348 "tip"=>wfMsg("extlink_tip")),
2349 array( "image"=>"button_headline.png",
2352 "sample"=>wfMsg("headline_sample"),
2353 "tip"=>wfMsg("headline_tip")),
2354 array( "image"=>"button_image.png",
2355 "open"=>"[[".$wgLang->getNsText(NS_IMAGE
).":",
2357 "sample"=>wfMsg("image_sample"),
2358 "tip"=>wfMsg("image_tip")),
2359 array( "image"=>"button_media.png",
2360 "open"=>"[[".$wgLang->getNsText(NS_MEDIA
).":",
2362 "sample"=>wfMsg("media_sample"),
2363 "tip"=>wfMsg("media_tip")),
2364 array( "image"=>"button_math.png",
2365 "open"=>"\\<math\\>",
2366 "close"=>"\\</math\\>",
2367 "sample"=>wfMsg("math_sample"),
2368 "tip"=>wfMsg("math_tip")),
2369 array( "image"=>"button_nowiki.png",
2370 "open"=>"\\<nowiki\\>",
2371 "close"=>"\\</nowiki\\>",
2372 "sample"=>wfMsg("nowiki_sample"),
2373 "tip"=>wfMsg("nowiki_tip")),
2374 array( "image"=>"button_sig.png",
2378 "tip"=>wfMsg("sig_tip")),
2379 array( "image"=>"button_hr.png",
2380 "open"=>"\\n----\\n",
2383 "tip"=>wfMsg("hr_tip"))
2385 $toolbar ="<script type='text/javascript'>\n";
2386 $toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
2387 foreach($toolarray as $tool) {
2389 $image=$wgUploadPath."/".$tool["image"];
2390 $open=$tool["open"];
2391 $close=$tool["close"];
2392 $sample = addslashes( $tool["sample"] );
2394 // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
2395 // Older browsers show a "speedtip" type message only for ALT.
2396 // Ideally these should be different, realistically they
2397 // probably don't need to be.
2398 $tip = addslashes( $tool["tip"] );
2399 $toolbar.="addButton('$image','$tip','$open','$close','$sample');\n";
2402 $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "','" . addslashes(wfMsg("infobox_alert")) . "','" . addslashes(wfMsg("infobox_mozvote"))."');\n";
2403 $toolbar.="document.writeln(\"</div>\");\n</script>";
2408 include_once( "SkinStandard.php" );
2409 include_once( "SkinNostalgia.php" );
2410 include_once( "SkinCologneBlue.php" );
2412 if( $wgUseSmarty ) {
2413 include_once( "SkinSmarty.php" );
2415 if( $wgUsePHPTal ) {
2416 include_once( "SkinPHPTal.php" );