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";
25 #$wgValidSkinNames['monobookminimal'] = "MonoBookMinimal";
28 include_once( "RecentChange.php" );
30 # For some odd PHP bug, this function can't be part of a class
31 function getCategories ()
33 global $wgOut , $wgTitle , $wgUseCategoryMagic , $wgUser , $wgParser ;
34 if ( !isset ( $wgUseCategoryMagic ) ||
!$wgUseCategoryMagic ) return "" ;
35 if ( count ( $wgOut->mCategoryLinks
) == 0 ) return "" ;
36 if ( !$wgOut->isArticle() ) return "" ;
37 $sk = $wgUser->getSkin() ;
40 $s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ;
41 $t = implode ( " | " , $wgOut->mCategoryLinks
) ;
42 if ( $t != "" ) $s .= " : " ;
47 class RCCacheEntry
extends RecentChange
49 var $secureName, $link;
50 var $curlink , $lastlink , $usertalklink , $versionlink ;
51 var $userlink, $timestamp, $watched;
53 function newFromParent( $rc )
55 $rc2 = new RCCacheEntry
;
56 $rc2->mAttribs
= $rc->mAttribs
;
57 $rc2->mExtra
= $rc->mExtra
;
64 /* private */ var $lastdate, $lastline;
65 var $linktrail ; # linktrail regexp
66 var $rc_cache ; # Cache for Enhanced Recent Changes
67 var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
72 $this->linktrail
= wfMsg("linktrail");
75 function getSkinNames()
77 global $wgValidSkinNames;
78 return $wgValidSkinNames;
81 function getStylesheet()
83 return "wikistandard.css";
88 global $wgOut, $wgUser;
90 if ( $wgOut->isQuickbarSuppressed() ) { return 0; }
91 $q = $wgUser->getOption( "quickbar" );
92 if ( "" == $q ) { $q = 0; }
96 function initPage( &$out )
98 $fname = "Skin::initPage";
99 wfProfileIn( $fname );
101 $out->addLink( "shortcut icon", "", "/favicon.ico" );
103 $this->addMetadataLinks($out);
105 wfProfileOut( $fname );
108 function addMetadataLinks( &$out ) {
109 global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf, $wgRdfMimeType, $action;
111 if ($action == 'view') {
112 # note: buggy CC software only reads first "meta" link
113 if ($wgEnableCreativeCommonsRdf) {
114 $out->addMetadataLink('application/rdf+xml', wfLocalUrl($wgTitle->getPrefixedURL(), "action=creativecommons"));
116 if ($wgEnableDublinCoreRdf) {
117 $out->addMetadataLink('application/rdf+xml', wfLocalUrl($wgTitle->getPrefixedURL(), "action=dublincore"));
122 function outputPage( &$out ) {
123 global $wgDebugComments;
125 wfProfileIn( "Skin::outputPage" );
126 $this->initPage( $out );
127 $out->out( $out->headElement() );
129 $out->out( "\n<body" );
130 $ops = $this->getBodyOptions();
131 foreach ( $ops as $name => $val ) {
132 $out->out( " $name='$val'" );
135 if ( $wgDebugComments ) {
136 $out->out( "<!-- Wiki debugging output:\n" .
137 $out->mDebugtext
. "-->\n" );
139 $out->out( $this->beforeContent() );
141 $out->out( $out->mBodytext
. "\n" );
143 $out->out( $this->afterContent() );
146 $out->out( $out->reportTime() );
148 $out->out( "\n</body></html>" );
151 function getHeadScripts() {
152 global $wgStyleSheetPath;
153 $r = "<script type=\"text/javascript\" src=\"{$wgStyleSheetPath}/wikibits.js\"></script>\n";
157 function getUserStyles()
159 global $wgOut, $wgStyleSheetPath;
160 $sheet = $this->getStylesheet();
161 $s = "<style type='text/css'>\n";
162 $s .= "/*/*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
163 $s .= "@import url(\"$wgStyleSheetPath/$sheet\");\n";
164 $s .= $this->doGetUserStyles();
170 function doGetUserStyles()
175 if ( 1 == $wgUser->getOption( "underline" ) ) {
176 # Don't override browser settings
180 $s .= "a.stub, a.new, a.internal, a.external { " .
181 "text-decoration: none; }\n";
183 if ( 1 == $wgUser->getOption( "highlightbroken" ) ) {
184 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
186 if ( 1 == $wgUser->getOption( "justify" ) ) {
187 $s .= "#article { text-align: justify; }\n";
192 function getBodyOptions()
194 global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $wgRequest;
196 extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
198 if ( 0 != $wgTitle->getNamespace() ) {
199 $a = array( "bgcolor" => "#ffffec" );
201 else $a = array( "bgcolor" => "#FFFFFF" );
202 if($wgOut->isArticle() && $wgUser->getOption("editondblclick") &&
203 (!$wgTitle->isProtected() ||
$wgUser->isSysop()) ) {
204 $t = wfMsg( "editthispage" );
207 $red = "&redirect={$redirect}";
209 if ( !empty($oldid) && ! isset( $diff ) ) {
210 $oid = "&oldid={$oldid}";
212 $s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" );
213 $s = "document.location = \"" .$s ."\";";
214 $a +
= array ("ondblclick" => $s);
217 $a['onload'] = $wgOut->getOnloadHandler();
221 function getExternalLinkAttributes( $link, $text )
223 global $wgUser, $wgOut, $wgLang;
225 $link = urldecode( $link );
226 $link = $wgLang->checkTitleEncoding( $link );
227 $link = str_replace( "_", " ", $link );
228 $link = wfEscapeHTML( $link );
230 $r = " class='external'";
232 if ( 1 == $wgUser->getOption( "hover" ) ) {
233 $r .= " title=\"{$link}\"";
238 function getInternalLinkAttributes( $link, $text, $broken = false )
240 global $wgUser, $wgOut;
242 $link = urldecode( $link );
243 $link = str_replace( "_", " ", $link );
244 $link = wfEscapeHTML( $link );
246 if ( $broken == "stub" ) {
247 $r = " class='stub'";
248 } else if ( $broken == "yes" ) {
254 if ( 1 == $wgUser->getOption( "hover" ) ) {
255 $r .= " title=\"{$link}\"";
260 function getInternalLinkAttributesObj( &$nt, $text, $broken = false )
262 global $wgUser, $wgOut;
264 if ( $broken == "stub" ) {
265 $r = " class='stub'";
266 } else if ( $broken == "yes" ) {
272 if ( 1 == $wgUser->getOption( "hover" ) ) {
273 $r .= ' title ="' . $nt->getEscapedText() . '"';
284 # This will be called immediately after the <body> tag. Split into
285 # two functions to make it easier to subclass.
287 function beforeContent()
289 global $wgUser, $wgOut, $wgSiteNotice;
291 if( $wgSiteNotice ) {
292 $note = "\n<div id='notice' style='font-weight: bold; color: red; text-align: center'>$wgSiteNotice</div>\n";
296 return $this->doBeforeContent() . $note;
299 function doBeforeContent()
301 global $wgUser, $wgOut, $wgTitle, $wgLang;
302 $fname = "Skin::doBeforeContent";
303 wfProfileIn( $fname );
306 $qb = $this->qbSetting();
308 if( $langlinks = $this->otherLanguages() ) {
314 $borderhack = "class='top'";
317 $s .= "\n<div id='content'>\n<div id='topbar'>\n" .
318 "<table border='0' cellspacing='0' width='98%'>\n<tr>\n";
321 $left = ($qb == 1 ||
$qb == 3);
322 if($wgLang->isRTL()) $left = !$left;
325 $s .= "<td class='top' align=left valign=top rowspan='{$rows}'>\n" .
326 $this->logoText() . "</td>";
328 $s .= $this->getQuickbarCompensator( $rows );
330 $l = $wgLang->isRTL() ?
"right" : "left";
331 $s .= "<td {$borderhack} align='$l' valign='top'>\n";
333 $s .= $this->topLinks() ;
334 $s .= "<p class='subtitle'>" . $this->pageTitleLinks() . "</p>\n";
336 $r = $wgLang->isRTL() ?
"left" : "right";
337 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
338 $s .= $this->nameAndLogin();
339 $s .= "\n<br />" . $this->searchForm() . "</td>";
342 $s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">$langlinks</td>\n";
345 if ( $shove && !$left ) { # Right
346 $s .= $this->getQuickbarCompensator( $rows );
348 $s .= "</tr>\n</table>\n</div>\n";
349 $s .= "\n<div id='article'>\n";
351 $s .= $this->pageTitle();
352 $s .= $this->pageSubtitle() ;
353 $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
354 wfProfileOut( $fname );
358 function getQuickbarCompensator( $rows = 1 )
360 return "<td width='152' rowspan='{$rows}'> </td>";
363 # This gets called immediately before the </body> tag.
365 function afterContent()
367 global $wgUser, $wgOut, $wgServer;
368 global $wgTitle, $wgLang;
370 $printfooter = "<div class=\"printfooter\">\n" . $this->printFooter() . "</div>\n";
371 return $printfooter . $this->doAfterContent();
374 function printFooter() {
376 $url = htmlspecialchars( $wgTitle->getFullURL() );
377 return "<p>" . wfMsg( "retrievedfrom", "<a href=\"$url\">$url</a>" ) .
378 "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
381 function doAfterContent()
383 global $wgUser, $wgOut, $wgLang;
384 $fname = "Skin::doAfterContent";
385 wfProfileIn( $fname );
386 wfProfileIn( "$fname-1" );
388 $s = "\n</div><br clear='all' />\n";
389 $s .= "\n<div id='footer'>";
390 $s .= "<table border='0' cellspacing='0'><tr>";
392 wfProfileOut( "$fname-1" );
393 wfProfileIn( "$fname-2" );
395 $qb = $this->qbSetting();
397 $left = ($qb == 1 ||
$qb == 3);
398 if($wgLang->isRTL()) $left = !$left;
400 if ( $shove && $left ) { # Left
401 $s .= $this->getQuickbarCompensator();
403 wfProfileOut( "$fname-2" );
404 wfProfileIn( "$fname-3" );
405 $l = $wgLang->isRTL() ?
"right" : "left";
406 $s .= "<td class='bottom' align='$l' valign='top'>";
408 $s .= $this->bottomLinks();
409 $s .= "\n<br />" . $this->mainPageLink()
410 . " | " . $this->aboutLink()
411 . " | " . $this->specialLink( "recentchanges" )
412 . " | " . $this->searchForm()
413 . "<br /><span id='pagestats'>" . $this->pageStats() . "</span>";
416 if ( $shove && !$left ) { # Right
417 $s .= $this->getQuickbarCompensator();
419 $s .= "</tr></table>\n</div>\n</div>\n";
421 wfProfileOut( "$fname-3" );
422 wfProfileIn( "$fname-4" );
423 if ( 0 != $qb ) { $s .= $this->quickBar(); }
424 wfProfileOut( "$fname-4" );
425 wfProfileOut( $fname );
429 function pageTitleLinks()
431 global $wgOut, $wgTitle, $wgUser, $wgLang, $wgUseApproval, $wgRequest;
433 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
434 $action = $wgRequest->getText( 'action' );
436 $s = $this->printableLink();
437 if ( wfMsg ( "disclaimers" ) != "-" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
439 if ( $wgOut->isArticleRelated() ) {
440 if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
441 $name = $wgTitle->getDBkey();
442 $link = wfEscapeHTML( wfImageUrl( $name ) );
443 $style = $this->getInternalLinkAttributes( $link, $name );
444 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
446 # This will show the "Approve" link if $wgUseApproval=true;
447 if ( isset ( $wgUseApproval ) && $wgUseApproval )
449 $t = $wgTitle->getDBkey();
450 $name = "Approve this article" ;
451 $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
452 #wfEscapeHTML( wfImageUrl( $name ) );
453 $style = $this->getExternalLinkAttributes( $link, $name );
454 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
457 if ( "history" == $action ||
isset( $diff ) ||
isset( $oldid ) ) {
458 $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
459 wfMsg( "currentrev" ) );
462 if ( $wgUser->getNewtalk() ) {
463 # do not show "You have new messages" text when we are viewing our
466 if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
467 $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
468 $n =$wgUser->getName();
469 $tl = $this->makeKnownLink( $wgLang->getNsText(
470 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
471 wfMsg("newmessageslink") );
472 $s.=" | <strong>". wfMsg( "newmessages", $tl ) . "</strong>";
475 if( $wgUser->isSysop() &&
476 (($wgTitle->getArticleId() == 0) ||
($action == "history")) &&
477 ($n = $wgTitle->isDeleted() ) ) {
478 $s .= " | " . wfMsg( "thisisdeleted",
479 $this->makeKnownLink(
480 $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
481 wfMsg( "restorelink", $n ) ) );
486 function printableLink()
488 global $wgOut, $wgFeedClasses, $wgRequest;
490 $baseurl = $_SERVER['REQUEST_URI'];
491 if( strpos( "?", $baseurl ) == false ) {
496 $baseurl = htmlspecialchars( $baseurl );
497 $printurl = $wgRequest->escapeAppendQuery( "printable=yes" );
499 $s = "<a href=\"$printurl\">" . wfMsg( "printableversion" ) . "</a>";
500 if( $wgOut->isSyndicated() ) {
501 foreach( $wgFeedClasses as $format => $class ) {
502 $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
503 $s .= " | <a href=\"$feedurl\">{$format}</a>";
511 global $wgOut, $wgTitle, $wgUser;
513 $s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
514 if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
518 function pageSubtitle()
520 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
522 $sub = $wgOut->getSubtitle();
524 global $wgExtraSubtitle;
525 $sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
527 if($wgOut->isArticle() && $wgNamespacesWithSubpages[$wgTitle->getNamespace()]) {
528 $ptext=$wgTitle->getPrefixedText();
529 if(preg_match("/\//",$ptext)) {
530 $sub.="</p><p class='subpages'>";
531 $links=explode("/",$ptext);
534 foreach($links as $link) {
536 if ($c<count($links)) {
537 $growinglink .= $link;
538 $getlink = $this->makeLink( $growinglink, $link );
539 if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
552 $s = "<p class='subtitle'>{$sub}</p>\n";
556 function nameAndLogin()
558 global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader, $wgIP;
560 $li = $wgLang->specialPage( "Userlogin" );
561 $lo = $wgLang->specialPage( "Userlogout" );
564 if ( 0 == $wgUser->getID() ) {
565 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
568 $tl = $this->makeKnownLink( $wgLang->getNsText(
569 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
570 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
572 $s .= $n . " (".$tl.")";
574 $s .= wfMsg("notloggedin");
577 $rt = $wgTitle->getPrefixedURL();
578 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
580 } else { $q = "returnto={$rt}"; }
582 $s .= "\n<br />" . $this->makeKnownLink( $li,
583 wfMsg( "login" ), $q );
585 $n = $wgUser->getName();
586 $rt = $wgTitle->getPrefixedURL();
587 $tl = $this->makeKnownLink( $wgLang->getNsText(
588 Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
589 $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
593 $s .= $this->makeKnownLink( $wgLang->getNsText(
594 Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br />" .
595 $this->makeKnownLink( $lo, wfMsg( "logout" ),
596 "returnto={$rt}" ) . " | " .
597 $this->specialLink( "preferences" );
599 $s .= " | " . $this->makeKnownLink( wfMsg( "helppage" ),
605 function searchForm()
609 $search = $wgRequest->getText( 'search' );;
611 $s = "<form name='search' class='inline' method='post' action=\""
612 . wfLocalUrl( "" ) . "\">\n"
613 . "<input type='text' name=\"search\" size='19' value=\""
614 . htmlspecialchars(substr($search,0,256)) . "\" />\n"
615 . "<input type='submit' name=\"go\" value=\"" . wfMsg ("go") . "\" /> "
616 . "<input type='submit' name=\"fulltext\" value=\"" . wfMsg ("search") . "\" />\n</form>";
626 $s = $this->mainPageLink() . $sep
627 . $this->specialLink( "recentchanges" );
629 if ( $wgOut->isArticleRelated() ) {
630 $s .= $sep . $this->editThisPage()
631 . $sep . $this->historyLink();
633 # Many people don't like this dropdown box
634 #$s .= $sep . $this->specialPagesList();
639 function bottomLinks()
641 global $wgOut, $wgUser, $wgTitle;
645 if ( $wgOut->isArticleRelated() ) {
646 $s .= "<strong>" . $this->editThisPage() . "</strong>";
647 if ( 0 != $wgUser->getID() ) {
648 $s .= $sep . $this->watchThisPage();
650 $s .= $sep . $this->talkLink()
651 . $sep . $this->historyLink()
652 . $sep . $this->whatLinksHere()
653 . $sep . $this->watchPageLinksLink();
655 if ( $wgTitle->getNamespace() == Namespace::getUser()
656 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) )
659 $id=User
::idFromName($wgTitle->getText());
660 $ip=User
::isIP($wgTitle->getText());
662 if($id ||
$ip) { # both anons and non-anons have contri list
663 $s .= $sep . $this->userContribsLink();
665 if ( 0 != $wgUser->getID() ) { # show only to signed in users
666 if($id) { # can only email non-anons
667 $s .= $sep . $this->emailUserLink();
671 if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
672 $s .= "\n<br />" . $this->deleteThisPage() .
673 $sep . $this->protectThisPage() .
674 $sep . $this->moveThisPage();
676 $s .= "<br />\n" . $this->otherLanguages();
683 global $wgOut, $wgLang, $wgArticle, $wgRequest;
684 global $wgDisableCounters;
686 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
687 if ( ! $wgOut->isArticle() ) { return ""; }
688 if ( isset( $oldid ) ||
isset( $diff ) ) { return ""; }
689 if ( 0 == $wgArticle->getID() ) { return ""; }
692 if ( !$wgDisableCounters ) {
693 $count = $wgLang->formatNum( $wgArticle->getCount() );
695 $s = wfMsg( "viewcount", $count );
698 $s .= $this->lastModified();
699 $s .= " " . wfMsg( "gnunote" );
703 function lastModified()
705 global $wgLang, $wgArticle;
707 $timestamp = $wgArticle->getTimestamp();
709 $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
710 $s = " " . wfMsg( "lastmodified", $d );
717 function logoText( $align = "" )
719 if ( "" != $align ) { $a = " align='{$align}'"; }
722 $mp = wfMsg( "mainpage" );
723 $titleObj = Title
::newFromText( $mp );
724 $s = "<a href=\"" . $titleObj->escapeLocalURL()
725 . "\"><img{$a} src=\""
726 . $this->getLogo() . "\" alt=\"" . "[{$mp}]\" /></a>";
732 global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang;
733 global $wgDisableUploads, $wgRemoteUploads;
735 $fname = "Skin::quickBar";
736 wfProfileIn( $fname );
738 $action = $wgRequest->getText( 'action' );
739 $wpPreview = $wgRequest->getBool( 'wpPreview' );
740 $tns=$wgTitle->getNamespace();
742 $s = "\n<div id='quickbar'>";
743 $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
746 $s .= $this->mainPageLink()
747 . $sep . $this->specialLink( "recentchanges" )
748 . $sep . $this->specialLink( "randompage" );
749 if ($wgUser->getID()) {
750 $s.= $sep . $this->specialLink( "watchlist" ) ;
751 $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
752 wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) );
755 // only show watchlist link if logged in
756 if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
757 $s .= "\n<br /><hr class='sep' />";
758 $articleExists = $wgTitle->getArticleId();
759 if ( $wgOut->isArticle() ||
$action =="edit" ||
$action =="history" ||
$wpPreview) {
760 if($wgOut->isArticle()) {
761 $s .= "<strong>" . $this->editThisPage() . "</strong>";
762 } else { # backlink to the article in edit or history mode
763 if($articleExists){ # no backlink if no article
766 $text = wfMsg("articlepage");
769 $text = wfMsg("viewtalkpage");
772 $text = wfMsg("userpage");
775 $text = wfMsg("viewtalkpage");
778 $text = wfMsg("wikipediapage");
781 $text = wfMsg("viewtalkpage");
784 $text = wfMsg("imagepage");
787 $text = wfMsg("viewtalkpage");
790 $text= wfMsg("articlepage");
793 $link = $wgTitle->getText();
794 if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
795 $link = $nstext . ":" . $link ;
798 $s .= $this->makeLink( $link, $text );
799 } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) {
800 # we just throw in a "New page" text to tell the user that he's in edit mode,
801 # and to avoid messing with the separator that is prepended to the next item
802 $s .= "<strong>" . wfMsg("newpage") . "</strong>";
808 if( $tns%2
&& $action!="edit" && !$wpPreview) {
809 $s.="<br />".$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("postcomment"),"action=edit§ion=new");
813 watching could cause problems in edit mode:
814 if user edits article, then loads "watch this article" in background and then saves
815 article with "Watch this article" checkbox disabled, the article is transparently
816 unwatched. Therefore we do not show the "Watch this page" link in edit mode
818 if ( 0 != $wgUser->getID() && $articleExists) {
819 if($action!="edit" && $action != "submit" )
821 $s .= $sep . $this->watchThisPage();
823 if ( $wgTitle->userCanEdit() )
824 $s .= $sep . $this->moveThisPage();
826 if ( $wgUser->isSysop() and $articleExists ) {
827 $s .= $sep . $this->deleteThisPage() .
828 $sep . $this->protectThisPage();
830 $s .= $sep . $this->talkLink();
831 if ($articleExists && $action !="history") {
832 $s .= $sep . $this->historyLink();
834 $s.=$sep . $this->whatLinksHere();
836 if($wgOut->isArticleRelated()) {
837 $s .= $sep . $this->watchPageLinksLink();
840 if ( Namespace::getUser() == $wgTitle->getNamespace()
841 ||
$wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser())
844 $id=User
::idFromName($wgTitle->getText());
845 $ip=User
::isIP($wgTitle->getText());
848 $s .= $sep . $this->userContribsLink();
850 if ( 0 != $wgUser->getID() ) {
851 if($id) { # can only email real users
852 $s .= $sep . $this->emailUserLink();
856 $s .= "\n<br /><hr class='sep' />";
859 if ( 0 != $wgUser->getID() && ( !$wgDisableUploads ||
$wgRemoteUploads ) ) {
860 $s .= $this->specialLink( "upload" ) . $sep;
862 $s .= $this->specialLink( "specialpages" )
863 . $sep . $this->bugReportsLink();
865 global $wgSiteSupportPage;
866 if( $wgSiteSupportPage ) {
867 $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) .
868 "\" class=\"internal\">" . wfMsg( "sitesupport" ) . "</a>";
871 $s .= "\n<br /></div>\n";
872 wfProfileOut( $fname );
876 function specialPagesList()
878 global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
881 $validSP = $wgLang->getValidSpecialPages();
883 foreach ( $validSP as $name => $desc ) {
884 if ( "" == $desc ) { continue; }
887 if ( $wgUser->isSysop() )
889 $sysopSP = $wgLang->getSysopSpecialPages();
891 foreach ( $sysopSP as $name => $desc ) {
892 if ( "" == $desc ) { continue; }
896 if ( $wgUser->isDeveloper() )
898 $devSP = $wgLang->getDeveloperSpecialPages();
900 foreach ( $devSP as $name => $desc ) {
901 if ( "" == $desc ) { continue; }
906 $sp = wfMsg( "specialpages" );
907 $spp = $wgLang->specialPage( "Specialpages" );
909 $s = "<form id=\"specialpages\" method=\"get\" class=\"inline\" " .
910 "action=\"{$wgServer}{$wgRedirectScript}\">\n";
911 $s .= "<select name=\"wpDropdown\">\n";
912 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
914 foreach ( $a as $name => $desc ) {
915 $p = $wgLang->specialPage( $name );
916 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
919 $s .= "<input type=submit value=\"{$go}\" name=redirect>\n";
924 function mainPageLink()
926 $mp = wfMsg( "mainpage" );
927 $s = $this->makeKnownLink( $mp, $mp );
931 function copyrightLink()
933 $s = $this->makeKnownLink( wfMsg( "copyrightpage" ),
934 wfMsg( "copyrightpagename" ) );
940 $s = $this->makeKnownLink( wfMsg( "aboutpage" ),
941 wfMsg( "aboutwikipedia" ) );
946 function disclaimerLink()
948 $s = $this->makeKnownLink( wfMsg( "disclaimerpage" ),
949 wfMsg( "disclaimers" ) );
953 function editThisPage()
955 global $wgOut, $wgTitle, $wgRequest;
957 $oldid = $wgRequest->getVal( 'oldid' );
958 $diff = $wgRequest->getVal( 'diff' );
959 $redirect = $wgRequest->getVal( 'redirect' );
961 if ( ! $wgOut->isArticleRelated() ) {
962 $s = wfMsg( "protectedpage" );
964 $n = $wgTitle->getPrefixedText();
965 if ( $wgTitle->userCanEdit() ) {
966 $t = wfMsg( "editthispage" );
968 #$t = wfMsg( "protectedpage" );
969 $t = wfMsg( "viewsource" );
973 if ( !is_null( $redirect ) ) { $red = "&redirect={$redirect}"; }
974 if ( $oldid && ! isset( $diff ) ) {
975 $oid = "&oldid={$oldid}";
977 $s = $this->makeKnownLink( $n, $t, "action=edit{$oid}{$red}" );
982 function deleteThisPage()
984 global $wgUser, $wgOut, $wgTitle, $wgRequest;
986 $diff = $wgRequest->getVal( 'diff' );
987 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
988 $n = $wgTitle->getPrefixedText();
989 $t = wfMsg( "deletethispage" );
991 $s = $this->makeKnownLink( $n, $t, "action=delete" );
998 function protectThisPage()
1000 global $wgUser, $wgOut, $wgTitle, $wgRequest;
1002 $diff = $wgRequest->getVal( 'diff' );
1003 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
1004 $n = $wgTitle->getPrefixedText();
1006 if ( $wgTitle->isProtected() ) {
1007 $t = wfMsg( "unprotectthispage" );
1008 $q = "action=unprotect";
1010 $t = wfMsg( "protectthispage" );
1011 $q = "action=protect";
1013 $s = $this->makeKnownLink( $n, $t, $q );
1020 function watchThisPage()
1022 global $wgUser, $wgOut, $wgTitle;
1024 if ( $wgOut->isArticleRelated() ) {
1025 $n = $wgTitle->getPrefixedText();
1027 if ( $wgTitle->userIsWatching() ) {
1028 $t = wfMsg( "unwatchthispage" );
1029 $q = "action=unwatch";
1031 $t = wfMsg( "watchthispage" );
1032 $q = "action=watch";
1034 $s = $this->makeKnownLink( $n, $t, $q );
1036 $s = wfMsg( "notanarticle" );
1041 function moveThisPage()
1043 global $wgTitle, $wgLang;
1045 if ( $wgTitle->userCanEdit() ) {
1046 $s = $this->makeKnownLink( $wgLang->specialPage( "Movepage" ),
1047 wfMsg( "movethispage" ), "target=" . $wgTitle->getPrefixedURL() );
1048 } // no message if page is protected - would be redundant
1052 function historyLink()
1056 $s = $this->makeKnownLink( $wgTitle->getPrefixedText(),
1057 wfMsg( "history" ), "action=history" );
1061 function whatLinksHere()
1063 global $wgTitle, $wgLang;
1065 $s = $this->makeKnownLink( $wgLang->specialPage( "Whatlinkshere" ),
1066 wfMsg( "whatlinkshere" ), "target=" . $wgTitle->getPrefixedURL() );
1070 function userContribsLink()
1072 global $wgTitle, $wgLang;
1074 $s = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
1075 wfMsg( "contributions" ), "target=" . $wgTitle->getPartialURL() );
1079 function emailUserLink()
1081 global $wgTitle, $wgLang;
1083 $s = $this->makeKnownLink( $wgLang->specialPage( "Emailuser" ),
1084 wfMsg( "emailuser" ), "target=" . $wgTitle->getPartialURL() );
1088 function watchPageLinksLink()
1090 global $wgOut, $wgTitle, $wgLang;
1092 if ( ! $wgOut->isArticleRelated() ) {
1093 $s = "(" . wfMsg( "notanarticle" ) . ")";
1095 $s = $this->makeKnownLink( $wgLang->specialPage(
1096 "Recentchangeslinked" ), wfMsg( "recentchangeslinked" ),
1097 "target=" . $wgTitle->getPrefixedURL() );
1102 function otherLanguages()
1104 global $wgOut, $wgLang, $wgTitle, $wgUseNewInterlanguage;
1106 $a = $wgOut->getLanguageLinks();
1107 if ( 0 == count( $a ) ) {
1108 if ( !$wgUseNewInterlanguage ) return "";
1109 $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
1110 if ( $ns != 0 AND $ns != 1 ) return "" ;
1112 $x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
1113 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1114 wfMsg( "intl" ) , $x );
1117 if ( !$wgUseNewInterlanguage ) {
1118 $s = wfMsg( "otherlanguages" ) . ": ";
1120 global $wgLanguageCode ;
1121 $x = "mode=zoom&xt=".$wgTitle->getDBkey() ;
1122 $x .= "&xl=".$wgLanguageCode ;
1123 $s = $this->makeKnownLink( $wgLang->specialPage( "Intl" ),
1124 wfMsg( "otherlanguages" ) , $x ) . ": " ;
1127 $s = wfMsg( "otherlanguages" ) . ": ";
1129 if($wgLang->isRTL()) $s .= "<span dir='LTR'>";
1130 foreach( $a as $l ) {
1131 if ( ! $first ) { $s .= " | "; }
1134 $nt = Title
::newFromText( $l );
1135 $url = $nt->getFullURL();
1136 $text = $wgLang->getLanguageName( $nt->getInterwiki() );
1138 if ( "" == $text ) { $text = $l; }
1139 $style = $this->getExternalLinkAttributes( $l, $text );
1140 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
1142 if($wgLang->isRTL()) $s .= "</span>";
1146 function bugReportsLink()
1148 $s = $this->makeKnownLink( wfMsg( "bugreportspage" ),
1149 wfMsg( "bugreports" ) );
1155 global $wgLinkCache;
1156 $t1 = Title
::newFromText( gmdate( "F j" ) );
1157 $t2 = Title
::newFromText( gmdate( "Y" ) );
1159 $wgLinkCache->suspend();
1160 $id = $t1->getArticleID();
1161 $wgLinkCache->resume();
1164 $s = $this->makeBrokenLink( $t1->getText() );
1166 $s = $this->makeKnownLink( $t1->getText() );
1170 $wgLinkCache->suspend();
1171 $id = $t2->getArticleID();
1172 $wgLinkCache->resume();
1175 $s .= $this->makeBrokenLink( $t2->getText() );
1177 $s .= $this->makeKnownLink( $t2->getText() );
1184 global $wgLang, $wgTitle, $wgLinkCache;
1186 $tns = $wgTitle->getNamespace();
1187 if ( -1 == $tns ) { return ""; }
1189 $pn = $wgTitle->getText();
1190 $tp = wfMsg( "talkpage" );
1191 if ( Namespace::isTalk( $tns ) ) {
1192 $lns = Namespace::getSubject( $tns );
1195 $text = wfMsg("articlepage");
1198 $text = wfMsg("userpage");
1201 $text = wfMsg("wikipediapage");
1204 $text = wfMsg("imagepage");
1207 $text= wfMsg("articlepage");
1211 $lns = Namespace::getTalk( $tns );
1214 $n = $wgLang->getNsText( $lns );
1215 if ( "" == $n ) { $link = $pn; }
1216 else { $link = "{$n}:{$pn}"; }
1218 $wgLinkCache->suspend();
1219 $s = $this->makeLink( $link, $text );
1220 $wgLinkCache->resume();
1225 function commentLink()
1227 global $wgLang, $wgTitle, $wgLinkCache;
1229 $tns = $wgTitle->getNamespace();
1230 if ( -1 == $tns ) { return ""; }
1232 $lns = ( Namespace::isTalk( $tns ) ) ?
$tns : Namespace::getTalk( $tns );
1234 # assert Namespace::isTalk( $lns )
1236 $n = $wgLang->getNsText( $lns );
1237 $pn = $wgTitle->getText();
1239 $link = "{$n}:{$pn}";
1241 $wgLinkCache->suspend();
1242 $s = $this->makeKnownLink($link, wfMsg("postcomment"), "action=edit§ion=new");
1243 $wgLinkCache->resume();
1248 # After all the page content is transformed into HTML, it makes
1249 # a final pass through here for things like table backgrounds.
1251 function transformContent( $text )
1256 # Note: This function MUST call getArticleID() on the link,
1257 # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
1259 function makeLink( $title, $text = "", $query = "", $trail = "" ) {
1260 wfProfileIn( "Skin::makeLink" );
1261 $nt = Title
::newFromText( $title );
1263 $result = $this->makeLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1265 wfDebug( "Invalid title passed to Skin::makeLink(): \"$title\"\n" );
1266 $result = $text == "" ?
$title : $text;
1269 wfProfileOut( "Skin::makeLink" );
1273 function makeKnownLink( $title, $text = "", $query = "", $trail = "" ) {
1274 $nt = Title
::newFromText( $title );
1276 return $this->makeKnownLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1278 wfDebug( "Invalid title passed to Skin::makeKnownLink(): \"$title\"\n" );
1279 return $text == "" ?
$title : $text;
1283 function makeBrokenLink( $title, $text = "", $query = "", $trail = "" ) {
1284 $nt = Title
::newFromText( $title );
1286 return $this->makeBrokenLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1288 wfDebug( "Invalid title passed to Skin::makeBrokenLink(): \"$title\"\n" );
1289 return $text == "" ?
$title : $text;
1293 function makeStubLink( $title, $text = "", $query = "", $trail = "" ) {
1294 $nt = Title
::newFromText( $title );
1296 return $this->makeStubLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
1298 wfDebug( "Invalid title passed to Skin::makeStubLink(): \"$title\"\n" );
1299 return $text == "" ?
$title : $text;
1303 # Pass a title object, not a title string
1304 function makeLinkObj( &$nt, $text= "", $query = "", $trail = "", $prefix = "" )
1306 global $wgOut, $wgUser;
1307 if ( $nt->isExternal() ) {
1308 $u = $nt->getFullURL();
1309 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1310 $style = $this->getExternalLinkAttributes( $link, $text );
1313 if ( "" != $trail ) {
1314 if ( preg_match( "/^([a-z]+)(.*)$$/sD", $trail, $m ) ) {
1319 $retVal = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
1320 } elseif ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
1321 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1322 } elseif ( ( -1 == $nt->getNamespace() ) ||
1323 ( Namespace::getImage() == $nt->getNamespace() ) ) {
1324 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1326 $aid = $nt->getArticleID() ;
1328 $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail, $prefix );
1330 $threshold = $wgUser->getOption("stubthreshold") ;
1331 if ( $threshold > 0 ) {
1332 $res = wfQuery ( "SELECT LENGTH(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ
) ;
1334 if ( wfNumRows( $res ) > 0 ) {
1335 $s = wfFetchObject( $res );
1337 if ( $s->cur_is_redirect
OR $s->cur_namespace
!= 0 ) {
1338 $size = $threshold*2 ; # Really big
1340 wfFreeResult( $res );
1342 $size = $threshold*2 ; # Really big
1347 if ( $size < $threshold ) {
1348 $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
1350 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
1357 # Pass a title object, not a title string
1358 function makeKnownLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1360 global $wgOut, $wgTitle;
1362 $fname = "Skin::makeKnownLinkObj";
1363 wfProfileIn( $fname );
1365 $link = $nt->getPrefixedURL();
1367 if ( "" == $link ) {
1369 if ( "" == $text ) { $text = $nt->getFragment(); }
1371 $u = $nt->escapeLocalURL( $query );
1373 if ( "" != $nt->getFragment() ) {
1374 $u .= "#" . wfEscapeHTML( $nt->getFragment() );
1376 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1377 $style = $this->getInternalLinkAttributesObj( $nt, $text );
1380 if ( "" != $trail ) {
1381 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1386 $r = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1387 wfProfileOut( $fname );
1391 # Pass a title object, not a title string
1392 function makeBrokenLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1394 global $wgOut, $wgUser;
1396 $fname = "Skin::makeBrokenLinkObj";
1397 wfProfileIn( $fname );
1399 if ( "" == $query ) {
1402 $q = "action=edit&{$query}";
1404 $u = $nt->escapeLocalURL( $q );
1406 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1407 $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
1410 if ( "" != $trail ) {
1411 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1416 if ( $wgUser->getOption( "highlightbroken" ) ) {
1417 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1419 $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
1422 wfProfileOut( $fname );
1426 # Pass a title object, not a title string
1427 function makeStubLinkObj( &$nt, $text = "", $query = "", $trail = "", $prefix = "" )
1429 global $wgOut, $wgUser;
1431 $link = $nt->getPrefixedURL();
1433 $u = $nt->escapeLocalURL( $query );
1435 if ( "" == $text ) { $text = $nt->getPrefixedText(); }
1436 $style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
1439 if ( "" != $trail ) {
1440 if ( preg_match( $this->linktrail
, $trail, $m ) ) {
1445 if ( $wgUser->getOption( "highlightbroken" ) ) {
1446 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
1448 $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
1453 function fnamePart( $url )
1455 $basename = strrchr( $url, "/" );
1456 if ( false === $basename ) { $basename = $url; }
1457 else { $basename = substr( $basename, 1 ); }
1458 return wfEscapeHTML( $basename );
1461 function makeImage( $url, $alt = "" )
1465 if ( "" == $alt ) { $alt = $this->fnamePart( $url ); }
1466 $s = "<img src=\"{$url}\" alt=\"{$alt}\" />";
1470 function makeImageLink( $name, $url, $alt = "" ) {
1471 $nt = Title
::makeTitle( Namespace::getImage(), $name );
1472 return $this->makeImageLinkObj( $nt, $alt );
1475 function makeImageLinkObj( $nt, $alt = "" ) {
1476 global $wgLang, $wgUseImageResize;
1477 $name = $nt->getDBKey();
1478 $url = wfImageUrl( $name );
1480 $prefix = $postfix = "";
1482 if ( $wgUseImageResize ) {
1483 # Check if the alt text is of the form "options|alt text"
1485 # * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang
1486 # * left no resizing, just left align. label is used for alt= only
1487 # * right same, but right aligned
1488 # * none same, but not aligned
1489 # * ___px scale to ___ pixels width, no aligning. e.g. use in taxobox
1491 $part = explode( "|", $alt);
1493 $mwThumb =& MagicWord
::get( MAG_IMG_THUMBNAIL
);
1494 $mwLeft =& MagicWord
::get( MAG_IMG_LEFT
);
1495 $mwRight =& MagicWord
::get( MAG_IMG_RIGHT
);
1496 $mwNone =& MagicWord
::get( MAG_IMG_NONE
);
1497 $mwWidth =& MagicWord
::get( MAG_IMG_WIDTH
);
1498 $mwCenter =& MagicWord
::get( MAG_IMG_CENTER
);
1499 $alt = $part[count($part)-1];
1503 foreach( $part as $key => $val ) {
1504 if ( ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
1506 } elseif ( ! is_null( $mwRight->matchVariableStartToEnd($val) ) ) {
1507 # remember to set an alignment, don't render immediately
1509 } elseif ( ! is_null( $mwLeft->matchVariableStartToEnd($val) ) ) {
1510 # remember to set an alignment, don't render immediately
1512 } elseif ( ! is_null( $mwCenter->matchVariableStartToEnd($val) ) ) {
1513 # remember to set an alignment, don't render immediately
1515 } elseif ( ! is_null( $mwNone->matchVariableStartToEnd($val) ) ) {
1516 # remember to set an alignment, don't render immediately
1518 } elseif ( ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {
1519 # $match is the image width in pixels
1520 $width = intval($match);
1523 if ( "center" == $align )
1525 $prefix = '<span style="text-align: center">';
1526 $postfix = '</span>';
1532 # Create a thumbnail. Alignment depends on language
1533 # writing direction, # right aligned for left-to-right-
1534 # languages ("Western languages"), left-aligned
1535 # for right-to-left-languages ("Semitic languages")
1537 # If thumbnail width has not been provided, it is set
1538 # here to 180 pixels
1539 if ( $align == "" ) {
1540 $align = $wgLang->isRTL() ?
"left" : "right";
1542 if ( ! isset($width) ) {
1545 return $prefix.$this->makeThumbLinkObj( $nt, $alt, $align, $width ).$postfix;
1547 } elseif ( isset($width) ) {
1549 # Create a resized image, without the additional thumbnail
1551 $url = $this->createThumb( $name, $width );
1553 } # endif $wgUseImageResize
1555 if ( empty( $alt ) ) {
1556 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1558 $alt = htmlspecialchars( $alt );
1560 $u = $nt->escapeLocalURL();
1563 $s = str_replace( "$1", $name, wfMsg("missingimage") );
1565 $s = "\n <a href=\"{$u}\" class='image' title=\"{$alt}\">\n" .
1566 " <img src=\"{$url}\" alt=\"{$alt}\" />\n </a>";
1568 if ( "" != $align ) {
1569 $s = "<div class=\"float{$align}\"><span>{$s}\n</span></div>";
1571 return $prefix.$s.$postfix;
1574 function createThumb( $name, $width ) {
1575 global $wgUploadDirectory;
1576 global $wgImageMagickConvertCommand;
1577 global $wgUseImageMagick;
1578 global $wgUseSquid, $wgInternalServer;
1579 $imgPath = wfImagePath( $name );
1580 $thumbName = $width."px-".$icon.$name;
1581 $thumbPath = wfImageThumbDir( $thumbName )."/".$thumbName;
1582 $thumbUrl = wfImageThumbUrl( $thumbName );
1584 if ( ! file_exists( $imgPath ) )
1586 # If there is no image, there will be no thumbnail
1590 if ( (! file_exists( $thumbPath ) )
1591 ||
( filemtime($thumbPath) < filemtime($imgPath) ) ) {
1593 if ( $wgUseSquid ) {
1595 $wgInternalServer.$thumbUrl
1597 wfPurgeSquidServers($urlArr);
1600 if ( $wgUseImageMagick ) {
1602 $cmd = $wgImageMagickConvertCommand .
1603 " -quality 85 -geometry {$width} ".
1604 escapeshellarg($imgPath) . " " .
1605 escapeshellarg($thumbPath);
1606 $conv = shell_exec( $cmd );
1608 # Use PHP's builtin GD library functions.
1610 # First find out what kind of file this is, and select the correct
1611 # input routine for this.
1612 list($src_width, $src_height, $src_type, $src_attr) = getimagesize( $imgPath );
1613 switch( $src_type ) {
1615 $src_image = imagecreatefromgif( $imgPath );
1618 $src_image = imagecreatefromjpeg( $imgPath );
1621 $src_image = imagecreatefrompng( $imgPath );
1623 case 15: # WBMP for WML
1624 $src_image = imagecreatefromwbmp( $imgPath );
1627 $src_image = imagecreatefromxbm( $imgPath );
1630 return "Image type not supported";
1633 $height = floor( $src_height * ( $width/$src_width ) );
1634 $dst_image = imagecreatetruecolor( $width, $height );
1635 imagecopyresampled( $dst_image, $src_image,
1637 $width, $height, $src_width, $src_height );
1638 switch( $src_type ) {
1643 #$thumbUrl .= ".png";
1644 #$thumbPath .= ".png";
1645 imagepng( $dst_image, $thumbPath );
1648 #$thumbUrl .= ".jpg";
1649 #$thumbPath .= ".jpg";
1650 imageinterlace( $dst_image );
1651 imagejpeg( $dst_image, $thumbPath, 95 );
1656 imagedestroy( $dst_image );
1657 imagedestroy( $src_image );
1662 # Check for zero-sized thumbnails. Those can be generated when
1663 # no disk space is available or some other error occurs
1665 $thumbstat = stat( $thumbPath );
1666 $imgstat = stat( $imgPath );
1667 if( $thumbstat["size"] == 0 )
1669 unlink( $thumbPath );
1676 function makeThumbLinkObj( $nt, $label = "", $align = "right", $boxwidth = 180 ) {
1677 global $wgUploadPath, $wgLang;
1678 $name = $nt->getDBKey();
1679 $image = Title
::makeTitle( Namespace::getImage(), $name );
1680 $url = wfImageUrl( $name );
1681 $path = wfImagePath( $name );
1683 #$label = htmlspecialchars( $label );
1684 $alt = preg_replace( "/<[^>]*>/", "", $label);
1685 $alt = htmlspecialchars( $alt );
1687 if ( file_exists( $path ) )
1689 list($width, $height, $type, $attr) = getimagesize( $path );
1691 $width = $height = 200;
1693 $boxheight = intval( $height/($width/$boxwidth) );
1694 if ( $boxwidth > $width ) {
1696 $boxheight = $height;
1699 $thumbUrl = $this->createThumb( $name, $boxwidth );
1701 $u = $nt->escapeLocalURL();
1703 $more = htmlspecialchars( wfMsg( "thumbnail-more" ) );
1704 $magnifyalign = $wgLang->isRTL() ?
"left" : "right";
1705 $textalign = $wgLang->isRTL() ?
" style=\"text-align:right\"" : "";
1707 $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$boxwidth}px;\"><div>";
1708 if ( $thumbUrl == "" ) {
1709 $s .= str_replace( "$1", $name, wfMsg("missingimage") );
1711 $s .= "\n".' <a href="'.$u.'" class="internal" title="'.$alt.'">'."\n".
1712 ' <img src="'.$thumbUrl.'" alt="'.$alt.'" ' .
1713 ' width="'.$boxwidth.'" height="'.$boxheight.'" /></a>' ."\n".
1714 ' <a href="'.$u.'" class="internal" title="'.$more.'"> ' ."\n".
1715 ' <img src="'.$wgUploadPath.'/magnify-clip.png" ' .
1716 'width="26" height="24" align="'.$magnifyalign.'" alt="'.$more.'" /> </a>'."\n";
1718 $s .= ' <p'.$textalign.'>'.$label."</p>\n</div></div>";
1722 function makeMediaLink( $name, $url, $alt = "" ) {
1723 $nt = Title
::makeTitle( Namespace::getMedia(), $name );
1724 return $this->makeMediaLinkObj( $nt, $alt );
1727 function makeMediaLinkObj( $nt, $alt = "" )
1729 $name = $nt->getDBKey();
1730 $url = wfImageUrl( $name );
1731 if ( empty( $alt ) ) {
1732 $alt = preg_replace( '/\.(.+?)^/', '', $name );
1735 $u = htmlspecialchars( $url );
1736 $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
1740 function specialLink( $name, $key = "" )
1744 if ( "" == $key ) { $key = strtolower( $name ); }
1745 $pn = $wgLang->ucfirst( $name );
1746 return $this->makeKnownLink( $wgLang->specialPage( $pn ),
1750 # Called by history lists and recent changes
1753 # Returns text for the start of the tabular part of RC
1754 function beginRecentChangesList()
1756 $this->rc_cache
= array() ;
1757 $this->rcMoveIndex
= 0;
1758 $this->rcCacheIndex
= 0 ;
1759 $this->lastdate
= "";
1763 function beginImageHistoryList()
1765 $s = "\n<h2>" . wfMsg( "imghistory" ) . "</h2>\n" .
1766 "<p>" . wfMsg( "imghistlegend" ) . "\n<ul class='special'>";
1770 # Returns text for the end of RC
1771 # If enhanced RC is in use, returns pretty much all the text
1772 function endRecentChangesList()
1774 $s = $this->recentChangesBlock() ;
1779 # Enhanced RC ungrouped line
1780 function recentChangesBlockLine ( $rcObj )
1782 global $wgUploadPath, $wgLang ;
1784 # Get rc_xxxx variables
1785 extract( $rcObj->mAttribs
) ;
1786 $curIdEq = "curid=$rc_cur_id";
1791 $r .= "<img src='{$wgUploadPath}/Arr_.png' width='12' height='12' border='0' />" ; $r .= "<tt>" ;
1793 if ( $rc_type == RC_MOVE
) {
1794 $r .= " ";
1796 # M & N (minor & new)
1797 $M = wfMsg( "minoreditletter" );
1798 $N = wfMsg( "newpageletter" );
1800 if ( $rc_type == RC_NEW
) {
1813 $r .= " ".$rcObj->timestamp
." " ;
1817 $link = $rcObj->link
;
1818 if ( $rcObj->watched
) $link = "<strong>{$link}</strong>" ;
1823 $r .= $rcObj->curlink
;
1827 $r .= $this->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
1830 $r .= ") . . ".$rcObj->userlink
;
1831 $r .= $rcObj->usertalklink
;
1834 if ( $rc_comment != "" && $rc_type != RC_MOVE
) {
1835 $rc_comment=$this->formatComment($rc_comment);
1836 $r .= $wgLang->emphasize( " (".$rc_comment.")" );
1844 function recentChangesBlockGroup ( $block )
1846 global $wgUploadPath, $wgLang ;
1849 $M = wfMsg( "minoreditletter" );
1850 $N = wfMsg( "newpageletter" );
1852 # Collate list of users
1854 $userlinks = array () ;
1855 foreach ( $block AS $rcObj ) {
1856 $oldid = $rcObj->mAttribs
['rc_last_oldid'];
1857 if ( $rcObj->mAttribs
['rc_new'] ) $isnew = true ;
1858 $u = $rcObj->userlink
;
1859 if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
1863 # Sort the list and convert to text
1864 krsort ( $userlinks ) ;
1865 asort ( $userlinks ) ;
1867 foreach ( $userlinks as $userlink => $count) {
1869 if ( $count > 1 ) $text .= " ({$count}×)" ;
1870 array_push ( $users , $text ) ;
1872 $users = " <font size='-1'>[".implode("; ",$users)."]</font>" ;
1875 $rci = "RCI{$this->rcCacheIndex}" ;
1876 $rcl = "RCL{$this->rcCacheIndex}" ;
1877 $rcm = "RCM{$this->rcCacheIndex}" ;
1878 $toggleLink = "javascript:toggleVisibility(\"{$rci}\",\"{$rcm}\",\"{$rcl}\")" ;
1879 $arrowdir = $wgLang->isRTL() ?
"l" : "r";
1880 $tl = "<span id='{$rcm}'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_{$arrowdir}.png' width='12' height='12' /></a></span>" ;
1881 $tl .= "<span id='{$rcl}' style='display:none'><a href='$toggleLink'><img src='{$wgUploadPath}/Arr_d.png' width='12' height='12' /></a></span>" ;
1887 if ( $isnew ) $r .= $N ;
1888 else $r .= " " ;
1889 $r .= " " ; # Minor
1892 $r .= " ".$block[0]->timestamp
." " ;
1896 $link = $block[0]->link
;
1897 if ( $block[0]->watched
) $link = "<strong>{$link}</strong>" ;
1900 $curIdEq = "curid=" . $block[0]->mAttribs
['rc_cur_id'];
1901 if ( $block[0]->mAttribs
['rc_type'] != RC_LOG
) {
1903 $r .= " (".count($block)." " ;
1904 if ( $isnew ) $r .= wfMsg("changes");
1905 else $r .= $this->makeKnownLinkObj( $block[0]->getTitle() , wfMsg("changes") ,
1906 "{$curIdEq}&diff=0&oldid=".$oldid ) ;
1910 $r .= $this->makeKnownLinkObj( $block[0]->getTitle(), wfMsg( "history" ), "{$curIdEq}&action=history" );
1918 $r .= "<div id='{$rci}' style='display:none'>" ;
1919 foreach ( $block AS $rcObj ) {
1920 # Get rc_xxxx variables
1921 extract( $rcObj->mAttribs
);
1923 $r .= "<img src='{$wgUploadPath}/Arr_.png' width=12 height=12 />";
1924 $r .= "<tt> " ;
1925 if ( $rc_new ) $r .= $N ;
1926 else $r .= " " ;
1927 if ( $rc_minor ) $r .= $M ;
1928 else $r .= " " ;
1932 if ( $rc_last_oldid != 0 ) {
1933 $o = "oldid=".$rc_last_oldid ;
1935 if ( $rc_type == RC_LOG
) {
1936 $link = $rcObj->timestamp
;
1938 $link = $this->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp
, "{$curIdEq}&$o" ) ;
1940 $link = "<tt>{$link}</tt>" ;
1944 $r .= $rcObj->curlink
;
1946 $r .= $rcObj->lastlink
;
1947 $r .= ") . . ".$rcObj->userlink
;
1948 $r .= $rcObj->usertalklink
;
1949 if ( $rc_comment != "" ) {
1950 $rc_comment=$this->formatComment($rc_comment);
1951 $r .= $wgLang->emphasize( " (".$rc_comment.")" ) ;
1957 $this->rcCacheIndex++
;
1961 # If enhanced RC is in use, this function takes the previously cached
1962 # RC lines, arranges them, and outputs the HTML
1963 function recentChangesBlock ()
1965 global $wgUploadPath ;
1966 if ( count ( $this->rc_cache
) == 0 ) return "" ;
1968 foreach ( $this->rc_cache
AS $secureName => $block ) {
1969 if ( count ( $block ) < 2 ) {
1970 $blockOut .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ;
1972 $blockOut .= $this->recentChangesBlockGroup ( $block ) ;
1976 return "<div>{$blockOut}</div>" ;
1979 # Called in a loop over all displayed RC entries
1980 # Either returns the line, or caches it for later use
1981 function recentChangesLine( &$rc, $watched = false )
1984 $usenew = $wgUser->getOption( "usenewrc" );
1986 $line = $this->recentChangesLineNew ( $rc, $watched ) ;
1988 $line = $this->recentChangesLineOld ( $rc, $watched ) ;
1992 function recentChangesLineOld( &$rc, $watched = false )
1994 global $wgTitle, $wgLang, $wgUser, $wgRCSeconds;
1996 # Extract DB fields into local scope
1997 extract( $rc->mAttribs
);
1998 $curIdEq = "curid=" . $rc_cur_id;
2000 # Make date header if necessary
2001 $date = $wgLang->date( $rc_timestamp, true);
2003 if ( $date != $this->lastdate
) {
2004 if ( "" != $this->lastdate
) { $s .= "</ul>\n"; }
2005 $s .= "<h4>{$date}</h4>\n<ul class='special'>";
2006 $this->lastdate
= $date;
2010 if ( $rc_type == RC_MOVE
) {
2012 $s .= "(" . wfMsg( "diff" ) . ") (";
2014 $s .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), wfMsg( "hist" ), "action=history" ) .
2017 # "[[x]] moved to [[y]]"
2019 $s .= wfMsg( "1movedto2", $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" ),
2020 $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" ) );
2024 if ( $rc_type == RC_NEW ||
$rc_type == RC_LOG
) {
2025 $diffLink = wfMsg( "diff" );
2027 $diffLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "diff" ),
2028 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
2030 $s .= "($diffLink) (";
2033 $s .= $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "hist" ), "{$curIdEq}&action=history" );
2036 # M and N (minor and new)
2037 $M = wfMsg( "minoreditletter" );
2038 $N = wfMsg( "newpageletter" );
2039 if ( $rc_minor ) { $s .= " <strong>{$M}</strong>"; }
2040 if ( $rc_type == RC_NEW
) { $s .= "<strong>{$N}</strong>"; }
2043 $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), "" );
2046 $articleLink = "<strong>{$articleLink}</strong>";
2048 $s .= " $articleLink";
2053 $s .= "; " . $wgLang->time( $rc_timestamp, true, $wgRCSeconds ) . " . . ";
2055 # User link (or contributions for unregistered users)
2056 if ( 0 == $rc_user ) {
2057 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2058 $rc_user_text, "target=" . $rc_user_text );
2060 $userLink = $this->makeLink( $wgLang->getNsText( NS_USER
) . ":{$rc_user_text}", $rc_user_text );
2065 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2066 global $wgDisableAnonTalk;
2067 if( 0 == $rc_user && $wgDisableAnonTalk ) {
2070 $utns=$wgLang->getNsText(NS_USER_TALK
);
2071 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2075 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2076 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2077 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2081 if($userTalkLink) $userTalkLink .= " | ";
2082 $userTalkLink .= $blockLink;
2084 if($userTalkLink) $s.=" ({$userTalkLink})";
2087 if ( "" != $rc_comment && "*" != $rc_comment && $rc_type != RC_MOVE
) {
2088 $rc_comment=$this->formatComment($rc_comment);
2089 $s .= $wgLang->emphasize(" (" . $rc_comment . ")");
2096 # function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
2097 function recentChangesLineNew( &$baseRC, $watched = false )
2099 global $wgTitle, $wgLang, $wgUser, $wgRCSeconds;
2101 # Create a specialised object
2102 $rc = RCCacheEntry
::newFromParent( $baseRC ) ;
2104 # Extract fields from DB into the function scope (rc_xxxx variables)
2105 extract( $rc->mAttribs
);
2106 $curIdEq = "curid=" . $rc_cur_id;
2108 # If it's a new day, add the headline and flush the cache
2109 $date = $wgLang->date( $rc_timestamp, true);
2111 if ( $date != $this->lastdate
) {
2112 # Process current cache
2113 $ret = $this->recentChangesBlock () ;
2114 $this->rc_cache
= array() ;
2115 $ret .= "<h4>{$date}</h4>\n";
2116 $this->lastdate
= $date;
2120 if ( $rc_type == RC_MOVE
) {
2121 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "", "redirect=no" );
2122 $clink .= " " . wfMsg("movedto") . " ";
2123 $clink .= $this->makeKnownLinkObj( $rc->getMovedToTitle(), "" );
2125 $clink = $this->makeKnownLinkObj( $rc->getTitle(), "" ) ;
2128 $time = $wgLang->time( $rc_timestamp, true, $wgRCSeconds );
2129 $rc->watched
= $watched ;
2130 $rc->link
= $clink ;
2131 $rc->timestamp
= $time;
2134 if ( ( $rc_type == RC_NEW
&& $rc_this_oldid == 0 ) ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2135 $curLink = wfMsg( "cur" );
2137 $curLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "cur" ),
2138 "{$curIdEq}&diff=0&oldid={$rc_this_oldid}" );
2142 $titleObj = $rc->getTitle();
2143 if ( $rc_last_oldid == 0 ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE
) {
2144 $lastLink = wfMsg( "last" );
2146 $lastLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( "last" ),
2147 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}" );
2150 # Make user link (or user contributions for unregistered users)
2151 if ( 0 == $rc_user ) {
2152 $userLink = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
2153 $rc_user_text, "target=" . $rc_user_text );
2155 $userLink = $this->makeLink( $wgLang->getNsText(
2156 Namespace::getUser() ) . ":{$rc_user_text}", $rc_user_text );
2159 $rc->userlink
= $userLink ;
2160 $rc->lastlink
= $lastLink ;
2161 $rc->curlink
= $curLink ;
2163 # Make user talk link
2164 $utns=$wgLang->getNsText(NS_USER_TALK
);
2165 $talkname=$wgLang->getNsText(NS_TALK
); # use the shorter name
2166 $userTalkLink= $this->makeLink($utns . ":{$rc_user_text}", $talkname );
2168 global $wgDisableAnonTalk;
2169 if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
2170 $blockLink = $this->makeKnownLink( $wgLang->specialPage(
2171 "Blockip" ), wfMsg( "blocklink" ), "ip={$rc_user_text}" );
2172 if( $wgDisableAnonTalk )
2173 $rc->usertalklink
= " ({$blockLink})";
2175 $rc->usertalklink
= " ({$userTalkLink} | {$blockLink})";
2177 if( $wgDisableAnonTalk && ($rc_user == 0) )
2178 $rc->usertalklink
= "";
2180 $rc->usertalklink
= " ({$userTalkLink})";
2183 # Put accumulated information into the cache, for later display
2184 # Page moves go on their own line
2185 $title = $rc->getTitle();
2186 $secureName = $title->getPrefixedDBkey();
2187 if ( $rc_type == RC_MOVE
) {
2188 # Use an @ character to prevent collision with page names
2189 $this->rc_cache
["@@" . ($this->rcMoveIndex++
)] = array($rc);
2191 if ( !isset ( $this->rc_cache
[$secureName] ) ) $this->rc_cache
[$secureName] = array() ;
2192 array_push ( $this->rc_cache
[$secureName] , $rc ) ;
2197 function endImageHistoryList()
2203 /* This function is called by all recent changes variants, by the page history,
2204 and by the user contributions list. It is responsible for formatting edit
2205 comments. It escapes any HTML in the comment, but adds some CSS to format
2206 auto-generated comments (from section editing).
2208 function formatComment($comment)
2210 $comment=wfEscapeHTML($comment);
2212 # format text between /* .. */ with autocomment CSS class
2213 $comment=preg_replace("/\/\*\s*(.*?)\s*\*\//i",
2214 "<span class=\"autocomment\">$1</span>",$comment);
2218 function imageHistoryLine( $iscur, $ts, $img, $u, $ut, $size, $c )
2220 global $wgUser, $wgLang, $wgTitle;
2222 $dt = $wgLang->timeanddate( $ts, true );
2223 $del = wfMsg( "deleteimg" );
2224 $cur = wfMsg( "cur" );
2227 $url = wfImageUrl( $img );
2229 if ( $wgUser->isSysop() ) {
2230 $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
2232 $style = $this->getInternalLinkAttributes( $link, $del );
2234 $dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
2239 $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
2240 if( $wgUser->getID() != 0 ) {
2241 $rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2242 wfMsg( "revertimg" ), "action=revert&oldimage=" .
2243 urlencode( $img ) );
2244 $dlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
2245 $del, "action=delete&oldimage=" . urlencode( $img ) );
2247 # Having live active links for non-logged in users
2248 # means that bots and spiders crawling our site can
2249 # inadvertently change content. Baaaad idea.
2250 $rlink = wfMsg( "revertimg" );
2254 if ( 0 == $u ) { $ul = $ut; }
2255 else { $ul = $this->makeLink( $wgLang->getNsText(
2256 Namespace::getUser() ) . ":{$ut}", $ut ); }
2258 $nb = wfMsg( "nbytes", $size );
2259 $style = $this->getInternalLinkAttributes( $url, $dt );
2261 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$dt}</a>"
2262 . " . . {$ul} ({$nb})";
2264 if ( "" != $c && "*" != $c ) {
2265 $s .= $wgLang->emphasize(" (" . wfEscapeHTML( $c ) . ")");
2271 function tocIndent($level) {
2272 return str_repeat( "<div class='tocindent'>\n", $level>0 ?
$level : 0 );
2275 function tocUnindent($level) {
2276 return str_repeat( "</div>\n", $level>0 ?
$level : 0 );
2279 # parameter level defines if we are on an indentation level
2280 function tocLine( $anchor, $tocline, $level ) {
2281 $link = "<a href=\"#$anchor\">$tocline</a><br />";
2285 return "<div class='tocline'>$link</div>\n";
2290 function tocTable($toc) {
2291 # note to CSS fanatics: putting this in a div does not work -- div won't auto-expand
2292 # try min-width & co when somebody gets a chance
2293 $hideline = " <script type='text/javascript'>showTocToggle(\"" . addslashes( wfMsg("showtoc") ) . "\",\"" . addslashes( wfMsg("hidetoc") ) . "\")</script>";
2295 "<table border=\"0\" id=\"toc\"><tr><td align=\"center\">\n".
2296 "<b>".wfMsg("toc")."</b>" .
2298 "</td></tr><tr id='tocinside'><td>\n".
2299 $toc."</td></tr></table>\n";
2302 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
2303 function editSectionScript( $section, $head ) {
2304 global $wgTitle, $wgRequest;
2305 if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
2308 $url = $wgTitle->escapeLocalURL( "action=edit§ion=$section" );
2309 return "<span oncontextmenu='document.location=\"$url\";return false;'>{$head}</span>";
2312 function editSectionLink( $section ) {
2314 global $wgTitle, $wgUser, $wgLang;
2316 if( $wgRequest->getInt( "oldid" ) && ( $wgRequest->getVal( "diff" ) != "0" ) ) {
2317 # Section edit links would be out of sync on an old page.
2318 # But, if we're diffing to the current page, they'll be
2323 $editurl = "§ion={$section}";
2324 $url = $this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);
2326 if( $wgLang->isRTL() ) {
2328 $nearside = "right";
2333 return "<div class=\"editsection\" style=\"float:$farside;margin-$nearside:5px;\">[".$url."]</div>";
2337 // This function is called by EditPage.php and shows a bulletin board style
2338 // toolbar for common editing functions. It can be disabled in the user preferences.
2339 // The necsesary JavaScript code can be found in style/wikibits.js.
2340 function getEditToolbar() {
2341 global $wgUploadPath, $wgLang, $wgMimeType;
2343 // toolarray an array of arrays which each include the filename of
2344 // the button image (without path), the opening tag, the closing tag,
2345 // and optionally a sample text that is inserted between the two when no
2346 // selection is highlighted.
2347 // The tip text is shown when the user moves the mouse over the button.
2349 array( "image"=>"button_bold.png",
2352 "sample"=>wfMsg("bold_sample"),
2353 "tip"=>wfMsg("bold_tip")),
2354 array( "image"=>"button_italic.png",
2357 "sample"=>wfMsg("italic_sample"),
2358 "tip"=>wfMsg("italic_tip")),
2359 array( "image"=>"button_link.png",
2362 "sample"=>wfMsg("link_sample"),
2363 "tip"=>wfMsg("link_tip")),
2364 array( "image"=>"button_extlink.png",
2367 "sample"=>wfMsg("extlink_sample"),
2368 "tip"=>wfMsg("extlink_tip")),
2369 array( "image"=>"button_headline.png",
2372 "sample"=>wfMsg("headline_sample"),
2373 "tip"=>wfMsg("headline_tip")),
2374 array( "image"=>"button_image.png",
2375 "open"=>"[[".$wgLang->getNsText(NS_IMAGE
).":",
2377 "sample"=>wfMsg("image_sample"),
2378 "tip"=>wfMsg("image_tip")),
2379 array( "image"=>"button_media.png",
2380 "open"=>"[[".$wgLang->getNsText(NS_MEDIA
).":",
2382 "sample"=>wfMsg("media_sample"),
2383 "tip"=>wfMsg("media_tip")),
2384 array( "image"=>"button_math.png",
2385 "open"=>"\\<math\\>",
2386 "close"=>"\\</math\\>",
2387 "sample"=>wfMsg("math_sample"),
2388 "tip"=>wfMsg("math_tip")),
2389 array( "image"=>"button_nowiki.png",
2390 "open"=>"\\<nowiki\\>",
2391 "close"=>"\\</nowiki\\>",
2392 "sample"=>wfMsg("nowiki_sample"),
2393 "tip"=>wfMsg("nowiki_tip")),
2394 array( "image"=>"button_sig.png",
2398 "tip"=>wfMsg("sig_tip")),
2399 array( "image"=>"button_hr.png",
2400 "open"=>"\\n----\\n",
2403 "tip"=>wfMsg("hr_tip"))
2405 $toolbar ="<script type='text/javascript'>\n";
2407 $xml = ($wgMimeType == "text/xml");
2409 $toolbar .= "<![CDATA[";
2412 $toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
2413 foreach($toolarray as $tool) {
2415 $image=$wgUploadPath."/".$tool["image"];
2416 $open=$tool["open"];
2417 $close=$tool["close"];
2418 $sample = addslashes( $tool["sample"] );
2420 // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
2421 // Older browsers show a "speedtip" type message only for ALT.
2422 // Ideally these should be different, realistically they
2423 // probably don't need to be.
2424 $tip = addslashes( $tool["tip"] );
2425 $toolbar.="addButton('$image','$tip','$open','$close','$sample');\n";
2428 $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "','" . addslashes(wfMsg("infobox_alert")) . "');\n";
2429 $toolbar.="document.writeln(\"</div>\");\n";
2434 $toolbar.="</script>";
2439 include_once( "SkinStandard.php" );
2440 include_once( "SkinNostalgia.php" );
2441 include_once( "SkinCologneBlue.php" );
2443 if( $wgUseSmarty ) {
2444 include_once( "SkinSmarty.php" );
2446 if( $wgUsePHPTal ) {
2447 include_once( "SkinPHPTal.php" );