3 include_once( "Feed.php" );
7 # These are the INTERNAL names, which get mapped
8 # directly to class names. For display purposes, the
9 # Language class has internationalized names
11 /* private */ $wgValidSkinNames = array(
12 'standard' => "Standard",
13 'nostalgia' => "Nostalgia",
14 'cologneblue' => "CologneBlue"
17 $wgValidSkinNames['smarty'] = "Smarty";
18 $wgValidSkinNames['montparnasse'] = "Montparnasse";
21 #$wgValidSkinNames[] = "PHPTal";
22 $wgValidSkinNames['davinci'] = "DaVinci";
23 $wgValidSkinNames['mono'] = "Mono";
26 include_once( "RecentChange.php" );
28 # For some odd PHP bug, this function can't be part of a class
29 function getCategories ()
31 global $wgOut , $wgTitle , $wgUseCategoryMagic , $wgUser , $wgParser ;
32 if ( !isset ( $wgUseCategoryMagic ) ||
!$wgUseCategoryMagic ) return "" ;
33 if ( count ( $wgParser->mCategoryLinks
) == 0 ) return "" ;
34 if ( !$wgOut->isArticle() ) return "" ;
35 $sk = $wgUser->getSkin() ;
38 $s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ;
39 $t = implode ( " | " , $wgParser->mCategoryLinks
) ;
40 if ( $t != "" ) $s .= " : " ;
45 class RCCacheEntry
extends RecentChange
47 var $secureName, $link;
48 var $curlink , $lastlink , $usertalklink , $versionlink ;
49 var $userlink, $timestamp, $watched;
51 function newFromParent( $rc )
53 $rc2 = new RCCacheEntry
;
54 $rc2->mAttribs
= $rc->mAttribs
;
55 $rc2->mExtra
= $rc->mExtra
;
62 /* private */ var $lastdate, $lastline;
63 var $linktrail ; # linktrail regexp
64 var $rc_cache ; # Cache for Enhanced Recent Changes
65 var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
70 $this->linktrail
= wfMsg("linktrail");
73 function getSkinNames()
75 global $wgValidSkinNames;
76 return $wgValidSkinNames;
79 function getStylesheet()
81 return "wikistandard.css";
86 global $wgOut, $wgUser;
88 if ( $wgOut->isQuickbarSuppressed() ) { return 0; }
89 $q = $wgUser->getOption( "quickbar" );
90 if ( "" == $q ) { $q = 0; }
94 function initPage( &$out )
96 global $wgStyleSheetPath;
97 $fname = "Skin::initPage";
98 wfProfileIn( $fname );
100 $out->addLink( "shortcut icon", "", "/favicon.ico" );
102 wfProfileOut( $fname );
105 function outputPage( &$out ) {
106 global $wgDebugComments;
108 wfProfileIn( "Skin::outputPage" );
109 $this->initPage( $out );
110 $out->out( $out->headElement() );
112 $out->out( "\n<body" );
113 $ops = $this->getBodyOptions();
114 foreach ( $ops as $name => $val ) {
115 $out->out( " $name='$val'" );
118 if ( $wgDebugComments ) {
119 $out->out( "<!-- Wiki debugging output:\n" .
120 $out->mDebugtext
. "-->\n" );
122 $out->out( $this->beforeContent() );
124 $out->out( $out->mBodytext
);
126 $out->out( $this->afterContent() );
129 $out->out( $out->reportTime() );
131 $out->out( "\n</body></html>" );
134 function getHeadScripts() {
135 global $wgStyleSheetPath;
136 $r = "<script type=\"text/javascript\" src=\"{$wgStyleSheetPath}/wikibits.js\"></script>\n";
140 function getUserStyles()
142 global $wgOut, $wgStyleSheetPath;
143 $sheet = $this->getStylesheet();
144 $s = "<style type='text/css'><!--\n";
145 $s .= "/*/*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
146 $s .= "@import url(\"$wgStyleSheetPath/$sheet\");\n";
147 $s .= $this->doGetUserStyles();
149 $s .= "//--></style>\n";
153 function doGetUserStyles()
158 if ( 1 == $wgUser->getOption( "underline" ) ) {
159 # Don't override browser settings
163 $s .= "a.stub, a.new, a.internal, a.external { " .
164 "text-decoration: none; }\n";
166 if ( 1 == $wgUser->getOption( "highlightbroken" ) ) {
167 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
169 if ( 1 == $wgUser->getOption( "justify" ) ) {
170 $s .= "#article { text-align: justify; }\n";
175 function getBodyOptions()
177 global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $wgRequest;
179 extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
181 if ( 0 != $wgTitle->getNamespace() ) {
182 $a = array( "bgcolor" => "#ffffec" );
184 else $a = array( "bgcolor" => "#FFFFFF" );
185 if($wgOut->isArticle() && $wgUser->getOption("editondblclick") &&
186 (!$wgTitle->isProtected() ||
$wgUser->isSysop()) ) {
187 $t = wfMsg( "editthispage" );
190 $red = "&redirect={$redirect}";
192 if ( !empty($oldid) && ! isset( $diff ) ) {
193 $oid = "&oldid={$oldid}";
195 $s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" );
196 $s = "document.location = \"" .$s ."\";";
197 $a +
= array ("ondblclick" => $s);
200 $a['onload'] = $wgOut->getOnloadHandler();
204 function getExternalLinkAttributes( $link, $text )
206 global $wgUser, $wgOut, $wgLang;
208 $link = urldecode( $link );
209 $link = $wgLang->checkTitleEncoding( $link );
210 $link = str_replace( "_", " ", $link );
211 $link = wfEscapeHTML( $link );
213 $r = " class='external'";
215 if ( 1 == $wgUser->getOption( "hover" ) ) {
216 $r .= " title=\"{$link}\"";
221 function getInternalLinkAttributes( $link, $text, $broken = false )
223 global $wgUser, $wgOut;
225 $link = urldecode( $link );
226 $link = str_replace( "_", " ", $link );
227 $link = wfEscapeHTML( $link );
229 if ( $broken == "stub" ) {
230 $r = " class='stub'";
231 } else if ( $broken == "yes" ) {
237 if ( 1 == $wgUser->getOption( "hover" ) ) {
238 $r .= " title=\"{$link}\"";
243 function getInternalLinkAttributesObj( &$nt, $text, $broken = false )
245 global $wgUser, $wgOut;
247 if ( $broken == "stub" ) {
248 $r = " class='stub'";
249 } else if ( $broken == "yes" ) {
255 if ( 1 == $wgUser->getOption( "hover" ) ) {
256 $r .= ' title ="' . $nt->getEscapedText() . '"';
267 # This will be called immediately after the <body> tag. Split into
268 # two functions to make it easier to subclass.
270 function beforeContent()
272 global $wgUser, $wgOut, $wgSiteNotice;
274 if( $wgSiteNotice ) {
275 $note = "\n<div id='notice' style='font-weight: bold; color: red; text-align: center'>$wgSiteNotice</div>\n";
279 return $this->doBeforeContent() . $note;
282 function doBeforeContent()
284 global $wgUser, $wgOut, $wgTitle, $wgLang;
285 $fname = "Skin::doBeforeContent";
286 wfProfileIn( $fname );
289 $qb = $this->qbSetting();
291 if( $langlinks = $this->otherLanguages() ) {
297 $borderhack = "class='top'";
300 $s .= "\n<div id='content'>\n<div id='topbar'>" .
301 "<table border=0 cellspacing=0 width='98%'><tr>";
304 $left = ($qb == 1 ||
$qb == 3);
305 if($wgLang->isRTL()) $left = !$left;
308 $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>" .
309 $this->logoText() . "</td>";
311 $s .= $this->getQuickbarCompensator( $rows );
313 $l = $wgLang->isRTL() ?
"right" : "left";
314 $s .= "<td {$borderhack} align='$l' valign='top'>";
316 $s .= $this->topLinks() ;
317 $s .= "<p class='subtitle'>" . $this->pageTitleLinks();
319 $r = $wgLang->isRTL() ?
"left" : "right";
320 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap>";
321 $s .= $this->nameAndLogin();
322 $s .= "\n<br>" . $this->searchForm() . "</td>";
325 $s .= "</tr>\n<tr><td class='top' colspan=\"2\">$langlinks</td>";
328 if ( $shove && !$left ) { # Right
329 $s .= $this->getQuickbarCompensator( $rows );
331 $s .= "</tr></table>\n</div>\n";
332 $s .= "\n<div id='article'>";
334 $s .= $this->pageTitle();
335 $s .= $this->pageSubtitle() ;
336 $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
338 wfProfileOut( $fname );
342 function getQuickbarCompensator( $rows = 1 )
344 return "<td width='152' rowspan='{$rows}'> </td>";
347 # This gets called immediately before the </body> tag.
349 function afterContent()
351 global $wgUser, $wgOut, $wgServer;
352 global $wgTitle, $wgLang;
354 $printfooter = "<div class=\"printfooter\">" . $this->printFooter() . "</div>\n";
355 return $printfooter . $this->doAfterContent();
358 function printFooter() {
360 $url = htmlspecialchars( $wgTitle->getFullURL() );
361 return "<p>" . wfMsg( "retrievedfrom", "<a href=\"$url\">$url</a>" ) .
362 "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
365 function doAfterContent()
367 global $wgUser, $wgOut, $wgLang;
368 $fname = "Skin::doAfterContent";
369 wfProfileIn( $fname );
370 wfProfileIn( "$fname-1" );
372 $s = "\n</div><br clear=all>\n";
373 $s .= "\n<div id='footer'>";
374 $s .= "<table border=0 cellspacing=0><tr>";
376 wfProfileOut( "$fname-1" );
377 wfProfileIn( "$fname-2" );
379 $qb = $this->qbSetting();
381 $left = ($qb == 1 ||
$qb == 3);
382 if($wgLang->isRTL()) $left = !$left;
384 if ( $shove && $left ) { # Left
385 $s .= $this->getQuickbarCompensator();
387 wfProfileOut( "$fname-2" );
388 wfProfileIn( "$fname-3" );
389 $l = $wgLang->isRTL() ?
"right" : "left";
390 $s .= "<td class='bottom' align='$l' valign='top'>";
392 $s .= $this->bottomLinks();
393 $s .= "\n<br>" . $this->mainPageLink()
394 . " | " . $this->aboutLink()
395 . " | " . $this->specialLink( "recentchanges" )
396 . " | " . $this->searchForm()
397 . "<br><span id='pagestats'>" . $this->pageStats() . "</span>";
400 if ( $shove && !$left ) { # Right
401 $s .= $this->getQuickbarCompensator();
403 $s .= "</tr></table>\n</div>\n</div>\n";
405 wfProfileOut( "$fname-3" );
406 wfProfileIn( "$fname-4" );
407 if ( 0 != $qb ) { $s .= $this->quickBar(); }
408 wfProfileOut( "$fname-4" );
409 wfProfileOut( $fname );
413 function pageTitleLinks()
415 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgUseApproval, $wgRequest;
417 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
418 $action = $wgRequest->getText( 'action' );
420 $s = $this->printableLink();
421 if ( wfMsg ( "disclaimers" ) != "-" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
423 if ( $wgOut->isArticleRelated() ) {
424 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
425 $name = $wgTitle->getDBkey();
426 $link = wfEscapeHTML( wfImageUrl( $name ) );
427 $style = $this->getInternalLinkAttributes( $link, $name );
428 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
430 # This will show the "Approve" link if $wgUseApproval=true;
431 if ( isset ( $wgUseApproval ) && $wgUseApproval )
433 $t = $wgTitle->getDBkey();
434 $name = "Approve this article" ;
435 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
436 #wfEscapeHTML( wfImageUrl( $name ) );
437 $style = $this->getExternalLinkAttributes( $link, $name );
438 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
441 if ( "history" == $action ||
isset( $diff ) ||
isset( $oldid ) ) {
442 $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
443 wfMsg( "currentrev" ) );
446 if ( $wgUser->getNewtalk() ) {
447 # do not show "You have new messages" text when we are viewing our
450 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
451 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
452 $n =$wgUser->getName();
453 $tl = $this->makeKnownLink( $wgLang->getNsText(
454 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
455 wfMsg("newmessageslink") );
456 $s.=" | <strong>". wfMsg( "newmessages", $tl ) . "</strong>";
459 if( $wgUser->isSysop() &&
460 (($wgTitle->getArticleId() == 0) ||
($action == "history")) &&
461 ($n = $wgTitle->isDeleted() ) ) {
462 $s .= " | " . wfMsg( "thisisdeleted",
463 $this->makeKnownLink(
464 $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
465 wfMsg( "restorelink", $n ) ) );
470 function printableLink()
472 global $wgOut, $wgFeedClasses, $wgRequest;
474 $baseurl = $_SERVER['REQUEST_URI'];
475 if( strpos( "?", $baseurl ) == false ) {
480 $baseurl = htmlspecialchars( $baseurl );
481 $printurl = $wgRequest->escapeAppendQuery( "printable=yes" );
483 $s = "<a href=\"$printurl\">" . wfMsg( "printableversion" ) . "</a>";
484 if( $wgOut->isSyndicated() ) {
485 foreach( $wgFeedClasses as $format => $class ) {
486 $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
487 $s .= " | <a href=\"$feedurl\">{$format}</a>";
495 global $wgOut, $wgTitle, $wgUser;
497 $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
498 if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
502 function pageSubtitle()
504 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
506 $sub = $wgOut->getSubtitle();
508 global $wgExtraSubtitle;
509 $sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
511 if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
512 $ptext=$wgTitle->getPrefixedText();
513 if(preg_match("/\//",$ptext)) {
514 $sub.="</p><p class='subpages'>";
515 $links=explode("/",$ptext);
518 foreach($links as $link) {
520 if ($c<count($links)) {
521 $growinglink .= $link;
522 $getlink = $this->makeLink( $growinglink, $link );
523 if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
536 $s = "<p class='subtitle'>{$sub}\n";
540 function nameAndLogin()
542 global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader, $wgIP;
544 $li = $wgLang->specialPage( "Userlogin" );
545 $lo = $wgLang->specialPage( "Userlogout" );
548 if ( 0 == $wgUser->getID() ) {
549 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
552 $tl = $this->makeKnownLink( $wgLang->getNsText(
553 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
554 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
556 $s .= $n . " (".$tl.")";
558 $s .= wfMsg("notloggedin");
561 $rt = $wgTitle->getPrefixedURL();
562 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
564 } else { $q = "returnto={$rt}"; }
566 $s .= "\n<br>" . $this->makeKnownLink( $li,
567 wfMsg( "login" ), $q );
569 $n = $wgUser->getName();
570 $rt = $wgTitle->getPrefixedURL();
571 $tl = $this->makeKnownLink( $wgLang->getNsText(
572 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
573 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
577 $s .= $this->makeKnownLink( $wgLang->getNsText(
578 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br>" .
579 $this->makeKnownLink( $lo, wfMsg( "logout" ),
580 "returnto={$rt}" ) . " | " .
581 $this->specialLink( "preferences" );
583 $s .= " | " . $this->makeKnownLink( wfMsg( "helppage" ),
589 function searchForm()
593 $search = $wgRequest->getText( 'search' );;
595 $s = "<form name='search' class='inline' method=post action=\""
596 . wfLocalUrl( "" ) . "\">"
597 . "<input type=text name=\"search\" size=19 value=\""
598 . htmlspecialchars(substr($search,0,256)) . "\">\n"
599 . "<input type=submit name=\"go\" value=\"" . wfMsg ("go") . "\"> "
600 . "<input type=submit name=\"fulltext\" value=\"" . wfMsg ("search") . "\"></form>";
610 $s = $this->mainPageLink() . $sep
611 . $this->specialLink( "recentchanges" );
613 if ( $wgOut->isArticleRelated() ) {
614 $s .= $sep . $this->editThisPage()
615 . $sep . $this->historyLink();
617 # Many people don't like this dropdown box
618 #$s .= $sep . $this->specialPagesList();
623 function bottomLinks()
625 global $wgOut, $wgUser, $wgTitle;
629 if ( $wgOut->isArticleRelated() ) {
630 $s .= "<strong>" . $this->editThisPage() . "</strong>";
631 if ( 0 != $wgUser->getID() ) {
632 $s .= $sep . $this->watchThisPage();
634 $s .= $sep . $this->talkLink()
635 . $sep . $this->historyLink()
636 . $sep . $this->whatLinksHere()
637 . $sep . $this->watchPageLinksLink();
639 if ( $wgTitle->getNamespace() == Namespace::getUser()
640 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
643 $id=User
::idFromName($wgTitle->getText());
644 $ip=User
::isIP($wgTitle->getText());
646 if($id ||
$ip) { # both anons and non-anons have contri list
647 $s .= $sep . $this->userContribsLink();
649 if ( 0 != $wgUser->getID() ) { # show only to signed in users
650 if($id) { # can only email non-anons
651 $s .= $sep . $this->emailUserLink();
655 if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
656 $s .= "\n<br>" . $this->deleteThisPage() .
657 $sep . $this->protectThisPage() .
658 $sep . $this->moveThisPage();
660 $s .= "<br>\n" . $this->otherLanguages();
667 global $wgOut, $wgLang, $wgArticle, $wgRequest;
668 global $wgDisableCounters;
670 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
671 if ( ! $wgOut->isArticle() ) { return ""; }
672 if ( isset( $oldid ) ||
isset( $diff ) ) { return ""; }
673 if ( 0 == $wgArticle->getID() ) { return ""; }
675 if ( $wgDisableCounters ) {
678 $count = $wgLang->formatNum( $wgArticle->getCount() );
679 $s = wfMsg( "viewcount", $count );
681 $s .= $this->lastModified();
682 $s .= " " . wfMsg( "gnunote" );
686 function lastModified()
688 global $wgLang, $wgArticle;
690 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
691 $s = " " . wfMsg( "lastmodified", $d );
695 function logoText( $align = "" )
697 if ( "" != $align ) { $a = " align='{$align}'"; }
700 $mp = wfMsg( "mainpage" );
701 $titleObj = Title
::newFromText( $mp );
702 $s = "<a href=\"" . $titleObj->escapeLocalURL()
703 . "\"><img{$a} border=0 src=\""
704 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\" /></a>";
710 global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang;
711 global $wgDisableUploads, $wgRemoteUploads;
713 $fname = "Skin::quickBar";
714 wfProfileIn( $fname );
716 $action = $wgRequest->getText( 'action' );
717 $wpPreview = $wgRequest->getBool( 'wpPreview' );
718 $tns=$wgTitle->getNamespace();
720 $s = "\n<div id='quickbar'>";
721 $s .= "\n" . $this->logoText() . "\n<hr class='sep'>";
724 $s .= $this->mainPageLink()
725 . $sep . $this->specialLink( "recentchanges" )
726 . $sep . $this->specialLink( "randompage" );
727 if ($wgUser->getID()) {
728 $s.= $sep . $this->specialLink( "watchlist" ) ;
729 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
730 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
733 // only show watchlist link if logged in
734 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
735 $s .= "\n<br><hr class='sep'>";
736 $articleExists = $wgTitle->getArticleId();
737 if ( $wgOut->isArticle() ||
$action =="edit" ||
$action =="history" ||
$wpPreview) {
738 if($wgOut->isArticle()) {
739 $s .= "<strong>" . $this->editThisPage() . "</strong>";
740 } else { # backlink to the article in edit or history mode
741 if($articleExists){ # no backlink if no article
744 $text = wfMsg("articlepage");
747 $text = wfMsg("viewtalkpage");
750 $text = wfMsg("userpage");
753 $text = wfMsg("viewtalkpage");
756 $text = wfMsg("wikipediapage");
759 $text = wfMsg("viewtalkpage");
762 $text = wfMsg("imagepage");
765 $text = wfMsg("viewtalkpage");
768 $text= wfMsg("articlepage");
771 $link = $wgTitle->getText();
772 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
773 $link = $nstext . ":" . $link ;
776 $s .= $this->makeLink( $link, $text );
777 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
778 # we just throw in a "New page" text to tell the user that he's in edit mode,
779 # and to avoid messing with the separator that is prepended to the next item
780 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
786 if( $tns%2
&& $action!="edit" && !$wpPreview) {
787 $s.="<br>".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
791 watching could cause problems in edit mode:
792 if user edits article, then loads "watch this article" in background and then saves
793 article with "Watch this article" checkbox disabled, the article is transparently
794 unwatched. Therefore we do not show the "Watch this page" link in edit mode
796 if ( 0 != $wgUser->getID() && $articleExists) {
797 if($action!="edit" && $action != "submit" )
799 $s .= $sep . $this->watchThisPage();
801 if ( $wgTitle->userCanEdit() )
802 $s .= $sep . $this->moveThisPage();
804 if ( $wgUser->isSysop() and $articleExists ) {
805 $s .= $sep . $this->deleteThisPage() .
806 $sep . $this->protectThisPage();
808 $s .= $sep . $this->talkLink();
809 if ($articleExists && $action !="history") {
810 $s .= $sep . $this->historyLink();
812 $s.=$sep . $this->whatLinksHere();
814 if($wgOut->isArticleRelated()) {
815 $s .= $sep . $this->watchPageLinksLink();
818 if ( Namespace::getUser() == $wgTitle->getNamespace()
819 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
822 $id=User
::idFromName($wgTitle->getText());
823 $ip=User
::isIP($wgTitle->getText());
826 $s .= $sep . $this->userContribsLink();
828 if ( 0 != $wgUser->getID() ) {
829 if($id) { # can only email real users
830 $s .= $sep . $this->emailUserLink();
834 $s .= "\n<br><hr class='sep'>";
837 if ( 0 != $wgUser->getID() && ( !$wgDisableUploads ||
$wgRemoteUploads ) ) {
838 $s .= $this->specialLink( "upload" ) . $sep;
840 $s .= $this->specialLink( "specialpages" )
841 . $sep . $this->bugReportsLink();
843 global $wgSiteSupportPage;
844 if( $wgSiteSupportPage ) {
845 $s .= "\n<br><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
846 "\" class=\"internal\">" . wfMsg( "sitesupport" ) . "</a>";
849 $s .= "\n<br></div>\n";
850 wfProfileOut( $fname );
854 function specialPagesList()
856 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
859 $validSP = $wgLang->getValidSpecialPages();
861 foreach ( $validSP as $name => $desc ) {
862 if ( "" == $desc ) { continue; }
865 if ( $wgUser->isSysop() )
867 $sysopSP = $wgLang->getSysopSpecialPages();
869 foreach ( $sysopSP as $name => $desc ) {
870 if ( "" == $desc ) { continue; }
874 if ( $wgUser->isDeveloper() )
876 $devSP = $wgLang->getDeveloperSpecialPages();
878 foreach ( $devSP as $name => $desc ) {
879 if ( "" == $desc ) { continue; }
884 $sp = wfMsg( "specialpages" );
885 $spp = $wgLang->specialPage( "Specialpages" );
887 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
888 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
889 $s .= "<select name=\"wpDropdown\">\n";
890 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
892 foreach ( $a as $name => $desc ) {
893 $p = $wgLang->specialPage( $name );
894 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
897 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
902 function mainPageLink()
904 $mp = wfMsg( "mainpage" );
905 $s = $this->makeKnownLink( $mp, $mp );
909 function copyrightLink()
911 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
912 wfMsg( "copyrightpagename" ) );
918 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
919 wfMsg( "aboutwikipedia" ) );
924 function disclaimerLink()
926 $s = $this->makeKnownLink( wfMsg( "disclaimerpage" ),
927 wfMsg( "disclaimers" ) );
931 function editThisPage()
933 global $wgOut, $wgTitle, $wgRequest;
935 $oldid = $wgRequest->getVal( 'oldid' );
936 $diff = $wgRequest->getVal( 'diff' );
937 $redirect = $wgRequest->getVal( 'redirect' );
939 if ( ! $wgOut->isArticleRelated() ) {
940 $s = wfMsg( "protectedpage" );
942 $n = $wgTitle->getPrefixedText();
943 if ( $wgTitle->userCanEdit() ) {
944 $t = wfMsg( "editthispage" );
946 #$t = wfMsg( "protectedpage" );
947 $t = wfMsg( "viewsource" );
951 if ( !is_null( $redirect ) ) { $red = "&redirect={$redirect}"; }
952 if ( $oldid && ! isset( $diff ) ) {
953 $oid = "&oldid={$oldid}";
955 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
960 function deleteThisPage()
962 global $wgUser, $wgOut, $wgTitle, $wgRequest;
964 $diff = $wgRequest->getVal( '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, $wgRequest;
980 $diff = $wgRequest->getVal( 'diff' );
981 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
982 $n = $wgTitle->getPrefixedText();
984 if ( $wgTitle->isProtected() ) {
985 $t = wfMsg( "unprotectthispage" );
986 $q = "action=unprotect";
988 $t = wfMsg( "protectthispage" );
989 $q = "action=protect";
991 $s = $this->makeKnownLink( $n, $t, $q );
998 function watchThisPage()
1000 global $wgUser, $wgOut, $wgTitle;
1002 if ( $wgOut->isArticleRelated() ) {
1003 $n = $wgTitle->getPrefixedText();
1005 if ( $wgTitle->userIsWatching() ) {
1006 $t = wfMsg( "unwatchthispage" );
1007 $q = "action=unwatch";
1009 $t = wfMsg( "watchthispage" );
1010 $q = "action=watch";
1012 $s = $this->makeKnownLink( $n, $t, $q );
1014 $s = wfMsg( "notanarticle" );
1019 function moveThisPage()
1021 global $wgTitle, $wgLang;
1023 if ( $wgTitle->userCanEdit() ) {
1024 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
1025 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
1026 } // no message if page is protected - would be redundant
1030 function historyLink()
1034 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1035 wfMsg( "history" ), "action=history" );
1039 function whatLinksHere()
1041 global $wgTitle, $wgLang;
1043 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
1044 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
1048 function userContribsLink()
1050 global $wgTitle, $wgLang;
1052 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1053 wfMsg( "contributions" ), "target=" . $wgTitle->getPartialURL() );
1057 function emailUserLink()
1059 global $wgTitle, $wgLang;
1061 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
1062 wfMsg( "emailuser" ), "target=" . $wgTitle->getPartialURL() );
1066 function watchPageLinksLink()
1068 global $wgOut, $wgTitle, $wgLang;
1070 if ( ! $wgOut->isArticleRelated() ) {
1071 $s = "(" . wfMsg( "notanarticle" ) . ")";
1073 $s = $this->makeKnownLink( $wgLang->specialPage(
1074 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
1075 "target=" . $wgTitle->getPrefixedURL() );
1080 function otherLanguages()
1082 global $wgOut, $wgLang, $wgTitle, $wgUseNewInterlanguage;
1084 $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 ( $wgUser->getOption( "highlightbroken" ) ) {
1395 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1397 $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
1400 wfProfileOut( $fname );
1404 # Pass a title object, not a title string
1405 function makeStubLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1407 global $wgOut, $wgUser;
1409 $link = $nt->getPrefixedURL();
1411 $u = $nt->escapeLocalURL( $query );
1413 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1414 $style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
1417 if ( "" != $trail ) {
1418 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1423 if ( $wgUser->getOption( "highlightbroken" ) ) {
1424 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1426 $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1431 function fnamePart( $url )
1433 $basename = strrchr( $url, "/" );
1434 if ( false === $basename ) { $basename = $url; }
1435 else { $basename = substr( $basename, 1 ); }
1436 return wfEscapeHTML( $basename );
1439 function makeImage( $url, $alt = "" )
1443 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1444 $s = "<img src=\"{$url}\" alt=\"{$alt}\" />";
1448 function makeImageLink( $name, $url, $alt = "" ) {
1449 $nt = Title
::makeTitle( Namespace::getImage(), $name );
1450 return $this->makeImageLinkObj( $nt, $alt );
1453 function makeImageLinkObj( $nt, $alt = "" ) {
1454 global $wgLang, $wgUseImageResize;
1455 $name = $nt->getDBKey();
1456 $url = wfImageUrl( $name );
1458 $prefix = $postfix = "";
1460 if ( $wgUseImageResize ) {
1461 # Check if the alt text is of the form "options|alt text"
1463 # * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang
1464 # * left no resizing, just left align. label is used for alt= only
1465 # * right same, but right aligned
1466 # * none same, but not aligned
1467 # * ___px scale to ___ pixels width, no aligning. e.g. use in taxobox
1469 $part = explode( "|", $alt);
1471 $mwThumb =& MagicWord
::get( MAG_IMG_THUMBNAIL
);
1472 $mwLeft =& MagicWord
::get( MAG_IMG_LEFT
);
1473 $mwRight =& MagicWord
::get( MAG_IMG_RIGHT
);
1474 $mwNone =& MagicWord
::get( MAG_IMG_NONE
);
1475 $mwWidth =& MagicWord
::get( MAG_IMG_WIDTH
);
1476 $mwCenter =& MagicWord
::get( MAG_IMG_CENTER
);
1477 $alt = $part[count($part)-1];
1481 foreach( $part as $key => $val ) {
1482 if ( ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
1484 } elseif ( ! is_null( $mwRight->matchVariableStartToEnd($val) ) ) {
1485 # remember to set an alignment, don't render immediately
1487 } elseif ( ! is_null( $mwLeft->matchVariableStartToEnd($val) ) ) {
1488 # remember to set an alignment, don't render immediately
1490 } elseif ( ! is_null( $mwCenter->matchVariableStartToEnd($val) ) ) {
1491 # remember to set an alignment, don't render immediately
1493 } elseif ( ! is_null( $mwNone->matchVariableStartToEnd($val) ) ) {
1494 # remember to set an alignment, don't render immediately
1496 } elseif ( ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {
1497 # $match is the image width in pixels
1498 $width = intval($match);
1501 if ( "center" == $align )
1503 $prefix = "<center>";
1504 $postfix = "</center>";
1510 # Create a thumbnail. Alignment depends on language
1511 # writing direction, # right aligned for left-to-right-
1512 # languages ("Western languages"), left-aligned
1513 # for right-to-left-languages ("Semitic languages")
1515 # If thumbnail width has not been provided, it is set
1516 # here to 180 pixels
1517 if ( $align == "" ) {
1518 $align = $wgLang->isRTL() ?
"left" : "right";
1520 if ( ! isset($width) ) {
1523 return $prefix.$this->makeThumbLinkObj( $nt, $alt, $align, $width ).$postfix;
1525 } elseif ( isset($width) ) {
1527 # Create a resized image, without the additional thumbnail
1529 $url = $this->createThumb( $name, $width );
1531 } # endif $wgUseImageResize
1533 if ( empty( $alt ) ) {
1534 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1536 $alt = htmlspecialchars( $alt );
1538 $u = $nt->escapeLocalURL();
1541 $s = str_replace( "$1", $name, wfMsg("missingimage") );
1543 $s = "\n <a href=\"{$u}\" class='image' title=\"{$alt}\">\n" .
1544 " <img border=\"0\" src=\"{$url}\" alt=\"{$alt}\" />\n </a>";
1546 if ( "" != $align ) {
1547 $s = "<div class=\"float{$align}\">{$s}\n</div>";
1549 return $prefix.$s.$postfix;
1552 function createThumb( $name, $width ) {
1553 global $wgUploadDirectory;
1554 global $wgImageMagickConvertCommand;
1555 global $wgUseImageMagick;
1556 global $wgUseSquid, $wgInternalServer;
1557 $imgPath = wfImagePath( $name );
1558 $thumbName = $width."px-".$icon.$name;
1559 $thumbPath = wfImageThumbDir( $thumbName )."/".$thumbName;
1560 $thumbUrl = wfImageThumbUrl( $thumbName );
1562 if ( ! file_exists( $imgPath ) )
1564 # If there is no image, there will be no thumbnail
1568 if ( (! file_exists( $thumbPath ) )
1569 ||
( filemtime($thumbPath) < filemtime($imgPath) ) ) {
1571 if ( $wgUseSquid ) {
1573 $wgInternalServer.$thumbUrl
1575 wfPurgeSquidServers($urlArr);
1578 if ( $wgUseImageMagick ) {
1580 $cmd = $wgImageMagickConvertCommand .
1581 " -quality 85 -geometry {$width} ".
1582 escapeshellarg($imgPath) . " " .
1583 escapeshellarg($thumbPath);
1584 $conv = shell_exec( $cmd );
1586 # Use PHP's builtin GD library functions.
1588 # First find out what kind of file this is, and select the correct
1589 # input routine for this.
1590 list($src_width, $src_height, $src_type, $src_attr) = getimagesize( $imgPath );
1591 switch( $src_type ) {
1593 $src_image = imagecreatefromgif( $imgPath );
1596 $src_image = imagecreatefromjpeg( $imgPath );
1599 $src_image = imagecreatefrompng( $imgPath );
1601 case 15: # WBMP for WML
1602 $src_image = imagecreatefromwbmp( $imgPath );
1605 $src_image = imagecreatefromxbm( $imgPath );
1608 return "Image type not supported";
1611 $height = floor( $src_height * ( $width/$src_width ) );
1612 $dst_image = imagecreatetruecolor( $width, $height );
1613 imagecopyresampled( $dst_image, $src_image,
1615 $width, $height, $src_width, $src_height );
1616 switch( $src_type ) {
1621 #$thumbUrl .= ".png";
1622 #$thumbPath .= ".png";
1623 imagepng( $dst_image, $thumbPath );
1626 #$thumbUrl .= ".jpg";
1627 #$thumbPath .= ".jpg";
1628 imageinterlace( $dst_image );
1629 imagejpeg( $dst_image, $thumbPath, 95 );
1634 imagedestroy( $dst_image );
1635 imagedestroy( $src_image );
1640 # Check for zero-sized thumbnails. Those can be generated when
1641 # no disk space is available or some other error occurs
1643 $thumbstat = stat( $thumbPath );
1644 $imgstat = stat( $imgPath );
1645 if( $thumbstat["size"] == 0 )
1647 unlink( $thumbPath );
1654 function makeThumbLinkObj( $nt, $label = "", $align = "right", $boxwidth = 180 ) {
1655 global $wgUploadPath, $wgLang;
1656 $name = $nt->getDBKey();
1657 $image = Title
::makeTitle( Namespace::getImage(), $name );
1658 $url = wfImageUrl( $name );
1659 $path = wfImagePath( $name );
1661 #$label = htmlspecialchars( $label );
1662 $alt = preg_replace( "/<[^>]*>/", "", $label);
1663 $alt = htmlspecialchars( $alt );
1665 if ( file_exists( $path ) )
1667 list($width, $height, $type, $attr) = getimagesize( $path );
1669 $width = $height = 200;
1671 $boxheight = intval( $height/($width/$boxwidth) );
1672 if ( $boxwidth > $width ) {
1674 $boxheight = $height;
1677 $thumbUrl = $this->createThumb( $name, $boxwidth );
1679 $u = $nt->escapeLocalURL();
1681 $more = htmlspecialchars( wfMsg( "thumbnail-more" ) );
1682 $magnifyalign = $wgLang->isRTL() ?
"left" : "right";
1683 $textalign = $wgLang->isRTL() ?
" style=\"text-align:right\"" : "";
1685 $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$boxwidth}px;\">";
1686 if ( $thumbUrl == "" ) {
1687 $s .= str_replace( "$1", $name, wfMsg("missingimage") );
1689 $s .= "\n".' <a href="'.$u.'" class="internal" title="'.$alt.'">'."\n".
1690 ' <img border="0" src="'.$thumbUrl.'" alt="'.$alt.'" ' .
1691 ' width="'.$boxwidth.'" height="'.$boxheight.'" /></a>' ."\n".
1692 ' <a href="'.$u.'" class="internal" title="'.$more.'"> ' ."\n".
1693 ' <img border="0" src="'.$wgUploadPath.'/magnify-clip.png" ' .
1694 'width="26" height="24" align="'.$magnifyalign.'" alt="'.$more.'" /> </a>'."\n";
1696 $s .= ' <p'.$textalign.'>'.$label."</p>\n</div>";
1700 function makeMediaLink( $name, $url, $alt = "" ) {
1701 $nt = Title
::makeTitle( Namespace::getMedia(), $name );
1702 return $this->makeMediaLinkObj( $nt, $alt );
1705 function makeMediaLinkObj( $nt, $alt = "" )
1707 $name = $nt->getDBKey();
1708 $url = wfImageUrl( $name );
1709 if ( empty( $alt ) ) {
1710 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1713 $u = htmlspecialchars( $url );
1714 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1718 function specialLink( $name, $key = "" )
1722 if ( "" == $key ) { $key = strtolower( $name ); }
1723 $pn = $wgLang->ucfirst( $name );
1724 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1728 # Called by history lists and recent changes
1731 # Returns text for the start of the tabular part of RC
1732 function beginRecentChangesList()
1734 $this->rc_cache
= array() ;
1735 $this->rcMoveIndex
= 0;
1736 $this->rcCacheIndex
= 0 ;
1737 $this->lastdate
= "";
1741 function beginImageHistoryList()
1743 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1744 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul class='special'>";
1748 # Returns text for the end of RC
1749 # If enhanced RC is in use, returns pretty much all the text
1750 function endRecentChangesList()
1752 $s = $this->recentChangesBlock() ;
1757 # Enhanced RC ungrouped line
1758 function recentChangesBlockLine ( $rcObj )
1760 global $wgUploadPath, $wgLang ;
1762 # Get rc_xxxx variables
1763 extract( $rcObj->mAttribs
) ;
1764 $curIdEq = "curid=$rc_cur_id";
1769 $r .= "<img src='{$wgUploadPath}/Arr_.png' width='12' height='12' border='0' />" ; $r .= "<tt>" ;
1771 if ( $rc_type == RC_MOVE
) {
1772 $r .= " ";
1774 # M & N (minor & new)
1775 $M = wfMsg( "minoreditletter" );
1776 $N = wfMsg( "newpageletter" );
1778 if ( $rc_type == RC_NEW
) {
1791 $r .= " ".$rcObj->timestamp
." " ;
1795 $link = $rcObj->link
;
1796 if ( $rcObj->watched
) $link = "<strong>{$link}</strong>" ;
1801 $r .= $rcObj->curlink
;
1805 $r .= $this->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
1808 $r .= ") . . ".$rcObj->userlink
;
1809 $r .= $rcObj->usertalklink
;
1812 if ( $rc_comment != "" && $rc_type != RC_MOVE
) {
1813 $rc_comment=$this->formatComment($rc_comment);
1814 $r .= $wgLang->emphasize( " (".$rc_comment.")" );
1822 function recentChangesBlockGroup ( $block )
1824 global $wgUploadPath, $wgLang ;
1827 $M = wfMsg( "minoreditletter" );
1828 $N = wfMsg( "newpageletter" );
1830 # Collate list of users
1832 $userlinks = array () ;
1833 foreach ( $block AS $rcObj ) {
1834 $oldid = $rcObj->mAttribs
['rc_last_oldid'];
1835 if ( $rcObj->mAttribs
['rc_new'] ) $isnew = true ;
1836 $u = $rcObj->userlink
;
1837 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1841 # Sort the list and convert to text
1842 krsort ( $userlinks ) ;
1843 asort ( $userlinks ) ;
1845 foreach ( $userlinks as $userlink => $count) {
1847 if ( $count > 1 ) $text .= " ({$count}×)" ;
1848 array_push ( $users , $text ) ;
1850 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1853 $rci = "RCI{$this->rcCacheIndex}" ;
1854 $rcl = "RCL{$this->rcCacheIndex}" ;
1855 $rcm = "RCM{$this->rcCacheIndex}" ;
1856 $toggleLink = "javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")" ;
1857 $arrowdir = $wgLang->isRTL() ?
"l" : "r";
1858 $tl = "<span id='{$rcm}'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_{$arrowdir}.png' width='12' height='12' border='0' /></a></span>" ;
1859 $tl .= "<span id='{$rcl}' style='display:none'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_d.png' width='12' height='12' border='0' /></a></span>" ;
1865 if ( $isnew ) $r .= $N ;
1866 else $r .= " " ;
1867 $r .= " " ; # Minor
1870 $r .= " ".$block[0]->timestamp
." " ;
1874 $link = $block[0]->link
;
1875 if ( $block[0]->watched
) $link = "<strong>{$link}</strong>" ;
1878 $curIdEq = "curid=" . $block[0]->mAttribs
['rc_cur_id'];
1879 if ( $block[0]->mAttribs
['rc_type'] != RC_LOG
) {
1881 $r .= " (".count($block)." " ;
1882 if ( $isnew ) $r .= wfMsg("changes");
1883 else $r .= $this->makeKnownLinkObj( $block[0]->getTitle() , wfMsg("changes") ,
1884 "{$curIdEq}&diff=0&oldid=".$oldid ) ;
1888 $r .= $this->makeKnownLinkObj( $block[0]->getTitle(), wfMsg( "history" ), "{$curIdEq}&action=history" );
1896 $r .= "<div id='{$rci}' style='display:none'>" ;
1897 foreach ( $block AS $rcObj ) {
1898 # Get rc_xxxx variables
1899 extract( $rcObj->mAttribs
);
1901 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 border=0 />";
1902 $r .= "<tt> " ;
1903 if ( $rc_new ) $r .= $N ;
1904 else $r .= " " ;
1905 if ( $rc_minor ) $r .= $M ;
1906 else $r .= " " ;
1910 if ( $rc_last_oldid != 0 ) {
1911 $o = "oldid=".$rc_last_oldid ;
1913 if ( $rc_type == RC_LOG
) {
1914 $link = $rcObj->timestamp
;
1916 $link = $this->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp
, "{$curIdEq}&$o" ) ;
1918 $link = "<tt>{$link}</tt>" ;
1922 $r .= $rcObj->curlink
;
1924 $r .= $rcObj->lastlink
;
1925 $r .= ") . . ".$rcObj->userlink
;
1926 $r .= $rcObj->usertalklink
;
1927 if ( $rc_comment != "" ) {
1928 $rc_comment=$this->formatComment($rc_comment);
1929 $r .= $wgLang->emphasize( " (".$rc_comment.")" ) ;
1935 $this->rcCacheIndex++
;
1939 # If enhanced RC is in use, this function takes the previously cached
1940 # RC lines, arranges them, and outputs the HTML
1941 function recentChangesBlock ()
1943 global $wgUploadPath ;
1944 if ( count ( $this->rc_cache
) == 0 ) return "" ;
1946 foreach ( $this->rc_cache
AS $secureName => $block ) {
1947 if ( count ( $block ) < 2 ) {
1948 $blockOut .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ;
1950 $blockOut .= $this->recentChangesBlockGroup ( $block ) ;
1954 return "<div>{$blockOut}</div>" ;
1957 # Called in a loop over all displayed RC entries
1958 # Either returns the line, or caches it for later use
1959 function recentChangesLine( &$rc, $watched = false )
1962 $usenew = $wgUser->getOption( "usenewrc" );
1964 $line = $this->recentChangesLineNew ( $rc, $watched ) ;
1966 $line = $this->recentChangesLineOld ( $rc, $watched ) ;
1970 function recentChangesLineOld( &$rc, $watched = false )
1972 global $wgTitle, $wgLang, $wgUser;
1974 # Extract DB fields into local scope
1975 extract( $rc->mAttribs
);
1976 $curIdEq = "curid=" . $rc_cur_id;
1978 # Make date header if necessary
1979 $date = $wgLang->date( $rc_timestamp, true);
1981 if ( $date != $this->lastdate
) {
1982 if ( "" != $this->lastdate
) { $s .= "</ul>\n"; }
1983 $s .= "<h4>{$date}</h4>\n<ul class='special'>";
1984 $this->lastdate
= $date;
1988 if ( $rc_type == RC_MOVE
) {
1990 $s .= "(" . wfMsg( "diff" ) . ") (";
1992 $s .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), wfMsg( "hist" ), "action=history" ) .
1995 # "[[x]] moved to [[y]]"
1997 $s .= wfMsg( "1movedto2", $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" ),
1998 $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" ) );
2002 if ( $rc_type == RC_NEW ||
$rc_type == RC_LOG
) {
2003 $diffLink = wfMsg( "diff" );
2005 $diffLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "diff" ),
2006 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
2008 $s .= "($diffLink) (";
2011 $s .= $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
2014 # M and N (minor and new)
2015 $M = wfMsg( "minoreditletter" );
2016 $N = wfMsg( "newpageletter" );
2017 if ( $rc_minor ) { $s .= " <strong>{$M}</strong>"; }
2018 if ( $rc_type == RC_NEW
) { $s .= "<strong>{$N}</strong>"; }
2021 $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), "" );
2024 $articleLink = "<strong>{$articleLink}</strong>";
2026 $s .= " $articleLink";
2031 $s .= "; " . $wgLang->time( $rc_timestamp, true ) . " . . ";
2033 # User link (or contributions for unregistered users)
2034 if ( 0 == $rc_user ) {
2035 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2036 $rc_user_text, "target=" . $rc_user_text );
2038 $userLink = $this->makeLink( $wgLang->getNsText( NS_USER
) . ":{$rc_user_text}", $rc_user_text );
2043 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2044 global $wgDisableAnonTalk;
2045 if( 0 == $rc_user && $wgDisableAnonTalk ) {
2048 $utns=$wgLang->getNsText(NS_USER_TALK
);
2049 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2053 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2054 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2055 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2059 if($userTalkLink) $userTalkLink .= " | ";
2060 $userTalkLink .= $blockLink;
2062 if($userTalkLink) $s.=" ({$userTalkLink})";
2065 if ( "" != $rc_comment && "*" != $rc_comment && $rc_type != RC_MOVE
) {
2066 $rc_comment=$this->formatComment($rc_comment);
2067 $s .= $wgLang->emphasize(" (" . $rc_comment . ")");
2074 # function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
2075 function recentChangesLineNew( &$baseRC, $watched = false )
2077 global $wgTitle, $wgLang, $wgUser;
2079 # Create a specialised object
2080 $rc = RCCacheEntry
::newFromParent( $baseRC ) ;
2082 # Extract fields from DB into the function scope (rc_xxxx variables)
2083 extract( $rc->mAttribs
);
2084 $curIdEq = "curid=" . $rc_cur_id;
2086 # If it's a new day, add the headline and flush the cache
2087 $date = $wgLang->date( $rc_timestamp, true);
2089 if ( $date != $this->lastdate
) {
2090 # Process current cache
2091 $ret = $this->recentChangesBlock () ;
2092 $this->rc_cache
= array() ;
2093 $ret .= "<h4>{$date}</h4>\n";
2094 $this->lastdate
= $date;
2098 if ( $rc_type == RC_MOVE
) {
2099 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" );
2100 $clink .= " " . wfMsg("movedto") . " ";
2101 $clink .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" );
2103 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "" ) ;
2106 $time = $wgLang->time( $rc_timestamp, true );
2107 $rc->watched
= $watched ;
2108 $rc->link
= $clink ;
2109 $rc->timestamp
= $time;
2112 if ( ( $rc_type == RC_NEW
&& $rc_this_oldid == 0 ) ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2113 $curLink = wfMsg( "cur" );
2115 $curLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "cur" ),
2116 "{$curIdEq}&diff=0&oldid={$rc_this_oldid}" );
2120 $titleObj = $rc->getTitle();
2121 if ( $rc_last_oldid == 0 ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2122 $lastLink = wfMsg( "last" );
2124 $lastLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "last" ),
2125 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
2128 # Make user link (or user contributions for unregistered users)
2129 if ( 0 == $rc_user ) {
2130 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2131 $rc_user_text, "target=" . $rc_user_text );
2133 $userLink = $this->makeLink( $wgLang->getNsText(
2134 Namespace::getUser() ) . ":{$rc_user_text}", $rc_user_text );
2137 $rc->userlink
= $userLink ;
2138 $rc->lastlink
= $lastLink ;
2139 $rc->curlink
= $curLink ;
2141 # Make user talk link
2142 $utns=$wgLang->getNsText(NS_USER_TALK
);
2143 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2144 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2146 global $wgDisableAnonTalk;
2147 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2148 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2149 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2150 if( $wgDisableAnonTalk )
2151 $rc->usertalklink
= " ({$blockLink})";
2153 $rc->usertalklink
= " ({$userTalkLink} | {$blockLink})";
2155 if( $wgDisableAnonTalk && ($rc_user == 0) )
2156 $rc->usertalklink
= "";
2158 $rc->usertalklink
= " ({$userTalkLink})";
2161 # Put accumulated information into the cache, for later display
2162 # Page moves go on their own line
2163 $title = $rc->getTitle();
2164 $secureName = $title->getPrefixedDBkey();
2165 if ( $rc_type == RC_MOVE
) {
2166 # Use an @ character to prevent collision with page names
2167 $this->rc_cache
["@@" . ($this->rcMoveIndex++
)] = array($rc);
2169 if ( !isset ( $this->rc_cache
[$secureName] ) ) $this->rc_cache
[$secureName] = array() ;
2170 array_push ( $this->rc_cache
[$secureName] , $rc ) ;
2175 function endImageHistoryList()
2181 /* This function is called by all recent changes variants, by the page history,
2182 and by the user contributions list. It is responsible for formatting edit
2183 comments. It escapes any HTML in the comment, but adds some CSS to format
2184 auto-generated comments (from section editing).
2186 function formatComment($comment)
2188 $comment=wfEscapeHTML($comment);
2190 # format text between /* .. */ with autocomment CSS class
2191 $comment=preg_replace("/\/\*\s*(.*?)\s*\*\//i",
2192 "<span id=\"autocomment\">$1</span>",$comment);
2196 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
2198 global $wgUser, $wgLang, $wgTitle;
2200 $dt = $wgLang->timeanddate( $ts, true );
2201 $del = wfMsg( "deleteimg" );
2202 $cur = wfMsg( "cur" );
2205 $url = wfImageUrl( $img );
2207 if ( $wgUser->isSysop() ) {
2208 $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
2210 $style = $this->getInternalLinkAttributes( $link, $del );
2212 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
2217 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
2218 if( $wgUser->getID() != 0 ) {
2219 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2220 wfMsg( "revertimg" ), "action=revert&oldimage=" .
2221 urlencode( $img ) );
2222 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2223 $del, "action=delete&oldimage=" . urlencode( $img ) );
2225 # Having live active links for non-logged in users
2226 # means that bots and spiders crawling our site can
2227 # inadvertently change content. Baaaad idea.
2228 $rlink = wfMsg( "revertimg" );
2232 if ( 0 == $u ) { $ul = $ut; }
2233 else { $ul = $this->makeLink( $wgLang->getNsText(
2234 Namespace::getUser() ) . ":{$ut}", $ut ); }
2236 $nb = wfMsg( "nbytes", $size );
2237 $style = $this->getInternalLinkAttributes( $url, $dt );
2239 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
2240 . " . . {$ul} ({$nb})";
2242 if ( "" != $c && "*" != $c ) {
2243 $s .= $wgLang->emphasize(" (" . wfEscapeHTML( $c ) . ")");
2249 function tocIndent($level) {
2250 return str_repeat( "<div class='tocindent'>\n", $level>0 ?
$level : 0 );
2253 function tocUnindent($level) {
2254 return str_repeat( "</div>\n", $level>0 ?
$level : 0 );
2257 # parameter level defines if we are on an indentation level
2258 function tocLine( $anchor, $tocline, $level ) {
2259 $link = "<a href=\"#$anchor\">$tocline</a><br />";
2263 return "<div class='tocline'>$link</div>\n";
2268 function tocTable($toc) {
2269 # note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
2270 # try min-width & co when somebody gets a chance
2271 $hideline = " <script type='text/javascript'>showTocToggle(\"" . addslashes( wfMsg("showtoc") ) . "\",\"" . addslashes( wfMsg("hidetoc") ) . "\")</script>";
2273 "<p><table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
2274 "<b>".wfMsg("toc")."</b>" .
2276 "</td></tr><tr id='tocinside'><td>\n".
2277 $toc."</td></tr></table><P>\n";
2280 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
2281 function editSectionScript( $section, $head ) {
2282 global $wgTitle, $wgRequest;
2283 if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
2286 $url = $wgTitle->escapeLocalURL( "action=edit§ion=$section" );
2287 return "<span oncontextmenu='document.location=\"$url\";return false;'>{$head}</span>";
2290 function editSectionLink( $section ) {
2292 global $wgTitle, $wgUser, $wgLang;
2294 if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
2295 # Section edit links would be out of sync on an old page.
2296 # But, if we're diffing to the current page, they'll be
2301 $editurl = "§ion={$section}";
2302 $url = $this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
2304 if( $wgLang->isRTL() ) {
2306 $nearside = "right";
2311 return "<div class=\"editsection\" style=\"float:$farside;margin-$nearside:5px;\">[".$url."]</div>";
2315 // This function is called by EditPage.php and shows a bulletin board style
2316 // toolbar for common editing functions. It can be disabled in the user preferences.
2317 // The necsesary JavaScript code can be found in style/wikibits.js.
2318 function getEditToolbar() {
2320 global $wgUploadPath,$wgLang;
2322 // toolarray an array of arrays which each include the filename of
2323 // the button image (without path), the opening tag, the closing tag,
2324 // and optionally a sample text that is inserted between the two when no
2325 // selection is highlighted.
2326 // The tip text is shown when the user moves the mouse over the button.
2328 array( "image"=>"button_bold.png",
2331 "sample"=>wfMsg("bold_sample"),
2332 "tip"=>wfMsg("bold_tip")),
2333 array( "image"=>"button_italic.png",
2336 "sample"=>wfMsg("italic_sample"),
2337 "tip"=>wfMsg("italic_tip")),
2338 array( "image"=>"button_link.png",
2341 "sample"=>wfMsg("link_sample"),
2342 "tip"=>wfMsg("link_tip")),
2343 array( "image"=>"button_extlink.png",
2346 "sample"=>wfMsg("extlink_sample"),
2347 "tip"=>wfMsg("extlink_tip")),
2348 array( "image"=>"button_headline.png",
2351 "sample"=>wfMsg("headline_sample"),
2352 "tip"=>wfMsg("headline_tip")),
2353 array( "image"=>"button_image.png",
2354 "open"=>"[[".$wgLang->getNsText(NS_IMAGE
).":",
2356 "sample"=>wfMsg("image_sample"),
2357 "tip"=>wfMsg("image_tip")),
2358 array( "image"=>"button_media.png",
2359 "open"=>"[[".$wgLang->getNsText(NS_MEDIA
).":",
2361 "sample"=>wfMsg("media_sample"),
2362 "tip"=>wfMsg("media_tip")),
2363 array( "image"=>"button_math.png",
2364 "open"=>"\\<math\\>",
2365 "close"=>"\\</math\\>",
2366 "sample"=>wfMsg("math_sample"),
2367 "tip"=>wfMsg("math_tip")),
2368 array( "image"=>"button_nowiki.png",
2369 "open"=>"\\<nowiki\\>",
2370 "close"=>"\\</nowiki\\>",
2371 "sample"=>wfMsg("nowiki_sample"),
2372 "tip"=>wfMsg("nowiki_tip")),
2373 array( "image"=>"button_sig.png",
2377 "tip"=>wfMsg("sig_tip")),
2378 array( "image"=>"button_hr.png",
2379 "open"=>"\\n----\\n",
2382 "tip"=>wfMsg("hr_tip"))
2384 $toolbar ="<script type='text/javascript'>\n";
2385 $toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
2386 foreach($toolarray as $tool) {
2388 $image=$wgUploadPath."/".$tool["image"];
2389 $open=$tool["open"];
2390 $close=$tool["close"];
2391 $sample = addslashes( $tool["sample"] );
2393 // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
2394 // Older browsers show a "speedtip" type message only for ALT.
2395 // Ideally these should be different, realistically they
2396 // probably don't need to be.
2397 $tip = addslashes( $tool["tip"] );
2398 $toolbar.="addButton('$image','$tip','$open','$close','$sample');\n";
2401 $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "','" . addslashes(wfMsg("infobox_alert")) . "','" . addslashes(wfMsg("infobox_mozvote"))."');\n";
2402 $toolbar.="document.writeln(\"</div>\");\n</script>";
2407 include_once( "SkinStandard.php" );
2408 include_once( "SkinNostalgia.php" );
2409 include_once( "SkinCologneBlue.php" );
2411 if( $wgUseSmarty ) {
2412 include_once( "SkinSmarty.php" );
2414 if( $wgUsePHPTal ) {
2415 include_once( "SkinPHPTal.php" );