fix r105935, wgContLang still used in the function
[lhc/web/wiklou.git] / includes / SkinLegacy.php
1 <?php
2 /**
3 * @defgroup Skins Skins
4 */
5
6 if ( !defined( 'MEDIAWIKI' ) ) {
7 die( 1 );
8 }
9
10 class SkinLegacy extends SkinTemplate {
11 var $useHeadElement = true;
12 protected $mWatchLinkNum = 0; // Appended to end of watch link id's
13
14 /**
15 * Add skin specific stylesheets
16 * @param $out OutputPage
17 */
18 function setupSkinUserCss( OutputPage $out ) {
19 $out->addModuleStyles( 'mediawiki.legacy.shared' );
20 $out->addModuleStyles( 'mediawiki.legacy.oldshared' );
21 }
22
23 public function commonPrintStylesheet() {
24 return true;
25 }
26
27 /**
28 * This was for the old skins and for users with 640x480 screen.
29 * Please note old skins are still used and might prove useful for
30 * users having old computers or visually impaired.
31 */
32 var $mSuppressQuickbar = false;
33
34 /**
35 * Suppress the quickbar from the output, only for skin supporting
36 * the quickbar
37 */
38 public function suppressQuickbar() {
39 $this->mSuppressQuickbar = true;
40 }
41
42 /**
43 * Return whether the quickbar should be suppressed from the output
44 *
45 * @return Boolean
46 */
47 public function isQuickbarSuppressed() {
48 return $this->mSuppressQuickbar;
49 }
50
51 function qbSetting() {
52 global $wgUser;
53 if ( $this->isQuickbarSuppressed() ) {
54 return 0;
55 }
56 $q = $wgUser->getOption( 'quickbar', 0 );
57 if( $q == 5 ) {
58 # 5 is the default, which chooses the setting
59 # depending on the directionality of your interface language
60 global $wgLang;
61 return $wgLang->isRTL() ? 2 : 1;
62 }
63 return $q;
64 }
65
66 }
67
68 class LegacyTemplate extends BaseTemplate {
69
70 // How many search boxes have we made? Avoid duplicate id's.
71 protected $searchboxes = '';
72
73 function execute() {
74 $this->html( 'headelement' );
75 echo $this->beforeContent();
76 $this->html( 'bodytext' );
77 echo "\n";
78 echo $this->afterContent();
79 $this->html( 'dataAfterContent' );
80 $this->printTrail();
81 echo "\n</body></html>";
82 }
83
84 /**
85 * This will be called immediately after the <body> tag. Split into
86 * two functions to make it easier to subclass.
87 */
88 function beforeContent() {
89 return $this->doBeforeContent();
90 }
91
92 function doBeforeContent() {
93 global $wgLang;
94 wfProfileIn( __METHOD__ );
95
96 $s = '';
97
98 $langlinks = $this->otherLanguages();
99 if ( $langlinks ) {
100 $rows = 2;
101 $borderhack = '';
102 } else {
103 $rows = 1;
104 $langlinks = false;
105 $borderhack = 'class="top"';
106 }
107
108 $s .= "\n<div id='content'>\n<div id='topbar'>\n" .
109 "<table border='0' cellspacing='0' width='100%'>\n<tr>\n";
110
111 if ( $this->getSkin()->qbSetting() == 0 ) {
112 $s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
113 $this->getSkin()->logoText( $wgLang->alignStart() ) . '</td>';
114 }
115
116 $l = $wgLang->alignStart();
117 $s .= "<td {$borderhack} align='$l' valign='top'>\n";
118
119 $s .= $this->topLinks();
120 $s .= '<p class="subtitle">' . $this->pageTitleLinks() . "</p>\n";
121
122 $r = $wgLang->alignEnd();
123 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
124 $s .= $this->nameAndLogin();
125 $s .= "\n<br />" . $this->searchForm() . '</td>';
126
127 if ( $langlinks ) {
128 $s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">$langlinks</td>\n";
129 }
130
131 $s .= "</tr>\n</table>\n</div>\n";
132 $s .= "\n<div id='article'>\n";
133
134 $notice = $this->getSkin()->getSiteNotice();
135
136 if ( $notice ) {
137 $s .= "\n<div id='siteNotice'>$notice</div>\n";
138 }
139 $s .= $this->pageTitle();
140 $s .= $this->pageSubtitle();
141 $s .= $this->getSkin()->getCategories();
142
143 wfProfileOut( __METHOD__ );
144 return $s;
145 }
146
147 /**
148 * This gets called shortly before the </body> tag.
149 * @return String HTML to be put before </body>
150 */
151 function afterContent() {
152 return $this->doAfterContent();
153 }
154
155 /** overloaded by derived classes */
156 function doAfterContent() {
157 return '</div></div>';
158 }
159
160 function searchForm() {
161 global $wgRequest, $wgUseTwoButtonsSearchForm;
162
163 $search = $wgRequest->getText( 'search' );
164
165 $s = '<form id="searchform' . $this->searchboxes . '" name="search" class="inline" method="post" action="'
166 . $this->getSkin()->escapeSearchLink() . "\">\n"
167 . '<input type="text" id="searchInput' . $this->searchboxes . '" name="search" size="19" value="'
168 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />\n"
169 . '<input type="submit" name="go" value="' . wfMsg( 'searcharticle' ) . '" />';
170
171 if ( $wgUseTwoButtonsSearchForm ) {
172 $s .= '&#160;<input type="submit" name="fulltext" value="' . wfMsg( 'searchbutton' ) . "\" />\n";
173 } else {
174 $s .= ' <a href="' . $this->getSkin()->escapeSearchLink() . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a>\n";
175 }
176
177 $s .= '</form>';
178
179 // Ensure unique id's for search boxes made after the first
180 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
181
182 return $s;
183 }
184
185 function pageStats() {
186 $ret = array();
187 $items = array( 'viewcount', 'credits', 'lastmod', 'numberofwatchingusers', 'copyright' );
188
189 foreach( $items as $item ) {
190 if ( $this->data[$item] !== false ) {
191 $ret[] = $this->data[$item];
192 }
193 }
194
195 return implode( ' ', $ret );
196 }
197
198 function topLinks() {
199 global $wgOut;
200
201 $s = array(
202 $this->getSkin()->mainPageLink(),
203 Linker::specialLink( 'Recentchanges' )
204 );
205
206 if ( $wgOut->isArticleRelated() ) {
207 $s[] = $this->editThisPage();
208 $s[] = $this->historyLink();
209 }
210
211 # Many people don't like this dropdown box
212 # $s[] = $this->specialPagesList();
213
214 if ( $this->variantLinks() ) {
215 $s[] = $this->variantLinks();
216 }
217
218 if ( $this->extensionTabLinks() ) {
219 $s[] = $this->extensionTabLinks();
220 }
221
222 // @todo FIXME: Is using Language::pipeList impossible here? Do not quite understand the use of the newline
223 return implode( $s, wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n" );
224 }
225
226 /**
227 * Language/charset variant links for classic-style skins
228 * @return string
229 */
230 function variantLinks() {
231 $s = '';
232
233 /* show links to different language variants */
234 global $wgDisableLangConversion, $wgLang;
235
236 $title = $this->getSkin()->getTitle();
237 $lang = $title->getPageLanguage();
238 $variants = $lang->getVariants();
239
240 if ( !$wgDisableLangConversion && sizeof( $variants ) > 1
241 && !$title->isSpecialPage() ) {
242 foreach ( $variants as $code ) {
243 $varname = $lang->getVariantname( $code );
244
245 if ( $varname == 'disable' ) {
246 continue;
247 }
248 $s = $wgLang->pipeList( array(
249 $s,
250 '<a href="' . $title->escapeLocalURL( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>'
251 ) );
252 }
253 }
254
255 return $s;
256 }
257
258 /**
259 * Compatibility for extensions adding functionality through tabs.
260 * Eventually these old skins should be replaced with SkinTemplate-based
261 * versions, sigh...
262 * @return string
263 * @todo Exterminate! ...that, and replace it with normal SkinTemplate stuff
264 */
265 function extensionTabLinks() {
266 $tabs = array();
267 $out = '';
268 $s = array();
269 wfRunHooks( 'SkinTemplateTabs', array( $this->getSkin(), &$tabs ) );
270 foreach ( $tabs as $tab ) {
271 $s[] = Xml::element( 'a',
272 array( 'href' => $tab['href'] ),
273 $tab['text'] );
274 }
275
276 if ( count( $s ) ) {
277 global $wgLang;
278
279 $out = wfMsgExt( 'pipe-separator' , 'escapenoentities' );
280 $out .= $wgLang->pipeList( $s );
281 }
282
283 return $out;
284 }
285
286 function bottomLinks() {
287 global $wgOut, $wgUser;
288 $sep = wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n";
289
290 $s = '';
291 if ( $wgOut->isArticleRelated() ) {
292 $element[] = '<strong>' . $this->editThisPage() . '</strong>';
293
294 if ( $wgUser->isLoggedIn() ) {
295 $element[] = $this->watchThisPage();
296 }
297
298 $element[] = $this->talkLink();
299 $element[] = $this->historyLink();
300 $element[] = $this->whatLinksHere();
301 $element[] = $this->watchPageLinksLink();
302
303 $title = $this->getSkin()->getTitle();
304
305 if (
306 $title->getNamespace() == NS_USER ||
307 $title->getNamespace() == NS_USER_TALK
308 ) {
309 $id = User::idFromName( $title->getText() );
310 $ip = User::isIP( $title->getText() );
311
312 # Both anons and non-anons have contributions list
313 if ( $id || $ip ) {
314 $element[] = $this->userContribsLink();
315 }
316
317 if ( $this->getSkin()->showEmailUser( $id ) ) {
318 $element[] = $this->emailUserLink();
319 }
320 }
321
322 $s = implode( $element, $sep );
323
324 if ( $title->getArticleId() ) {
325 $s .= "\n<br />";
326
327 // Delete/protect/move links for privileged users
328 if ( $wgUser->isAllowed( 'delete' ) ) {
329 $s .= $this->deleteThisPage();
330 }
331
332 if ( $wgUser->isAllowed( 'protect' ) ) {
333 $s .= $sep . $this->protectThisPage();
334 }
335
336 if ( $wgUser->isAllowed( 'move' ) ) {
337 $s .= $sep . $this->moveThisPage();
338 }
339 }
340
341 $s .= "<br />\n" . $this->otherLanguages();
342 }
343
344 return $s;
345 }
346
347 function otherLanguages() {
348 global $wgOut, $wgLang, $wgContLang, $wgHideInterlanguageLinks;
349
350 if ( $wgHideInterlanguageLinks ) {
351 return '';
352 }
353
354 $a = $wgOut->getLanguageLinks();
355
356 if ( 0 == count( $a ) ) {
357 return '';
358 }
359
360 $s = wfMsg( 'otherlanguages' ) . wfMsg( 'colon-separator' );
361 $first = true;
362
363 if ( $wgLang->isRTL() ) {
364 $s .= '<span dir="ltr">';
365 }
366
367 foreach ( $a as $l ) {
368 if ( !$first ) {
369 $s .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
370 }
371
372 $first = false;
373
374 $nt = Title::newFromText( $l );
375 $text = $wgContLang->getLanguageName( $nt->getInterwiki() );
376
377 $s .= Html::element( 'a',
378 array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => "external" ),
379 $text == '' ? $l : $text );
380 }
381
382 if ( $wgLang->isRTL() ) {
383 $s .= '</span>';
384 }
385
386 return $s;
387 }
388
389 /**
390 * Show a drop-down box of special pages
391 */
392 function specialPagesList() {
393 global $wgScript;
394
395 $select = new XmlSelect( 'title' );
396 $pages = SpecialPageFactory::getUsablePages();
397 array_unshift( $pages, SpecialPageFactory::getPage( 'SpecialPages' ) );
398 foreach ( $pages as $obj ) {
399 $select->addOption( $obj->getDescription(),
400 $obj->getTitle()->getPrefixedDBkey() );
401 }
402
403 return Html::rawElement( 'form', array( 'id' => 'specialpages', 'method' => 'get',
404 'action' => $wgScript ), $select->getHTML() . Xml::submitButton( wfMsg( 'go' ) ) );
405 }
406
407 function pageTitleLinks() {
408 global $wgOut, $wgUser, $wgRequest, $wgLang;
409
410 $oldid = $wgRequest->getVal( 'oldid' );
411 $diff = $wgRequest->getVal( 'diff' );
412 $action = $wgRequest->getText( 'action' );
413
414 $skin = $this->getSkin();
415 $title = $skin->getTitle();
416
417 $s[] = $this->printableLink();
418 $disclaimer = $skin->disclaimerLink(); # may be empty
419
420 if ( $disclaimer ) {
421 $s[] = $disclaimer;
422 }
423
424 $privacy = $skin->privacyLink(); # may be empty too
425
426 if ( $privacy ) {
427 $s[] = $privacy;
428 }
429
430 if ( $wgOut->isArticleRelated() ) {
431 if ( $title->getNamespace() == NS_FILE ) {
432 $name = $title->getDBkey();
433 $image = wfFindFile( $title );
434
435 if ( $image ) {
436 $link = htmlspecialchars( $image->getURL() );
437 $style = Linker::getInternalLinkAttributes( $link, $name );
438 $s[] = "<a href=\"{$link}\"{$style}>{$name}</a>";
439 }
440 }
441 }
442
443 if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
444 $s[] .= Linker::linkKnown(
445 $title,
446 wfMsg( 'currentrev' )
447 );
448 }
449
450 if ( $wgUser->getNewtalk() ) {
451 # do not show "You have new messages" text when we are viewing our
452 # own talk page
453 if ( !$title->equals( $wgUser->getTalkPage() ) ) {
454 $tl = Linker::linkKnown(
455 $wgUser->getTalkPage(),
456 wfMsgHtml( 'newmessageslink' ),
457 array(),
458 array( 'redirect' => 'no' )
459 );
460
461 $dl = Linker::linkKnown(
462 $wgUser->getTalkPage(),
463 wfMsgHtml( 'newmessagesdifflink' ),
464 array(),
465 array( 'diff' => 'cur' )
466 );
467 $s[] = '<strong>' . wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
468 # disable caching
469 $wgOut->setSquidMaxage( 0 );
470 $wgOut->enableClientCache( false );
471 }
472 }
473
474 $undelete = $skin->getUndeleteLink();
475
476 if ( !empty( $undelete ) ) {
477 $s[] = $undelete;
478 }
479
480 return $wgLang->pipeList( $s );
481 }
482
483 /**
484 * Gets the h1 element with the page title.
485 * @return string
486 */
487 function pageTitle() {
488 global $wgOut;
489 $s = '<h1 class="pagetitle"><span dir="auto">' . $wgOut->getPageTitle() . '</span></h1>';
490 return $s;
491 }
492
493 function pageSubtitle() {
494 global $wgOut;
495
496 $sub = $wgOut->getSubtitle();
497
498 if ( $sub == '' ) {
499 global $wgExtraSubtitle;
500 $sub = wfMsgExt( 'tagline', 'parsemag' ) . $wgExtraSubtitle;
501 }
502
503 $subpages = $this->getSkin()->subPageSubtitle();
504 $sub .= !empty( $subpages ) ? "</p><p class='subpages'>$subpages" : '';
505 $s = "<p class='subtitle'>{$sub}</p>\n";
506
507 return $s;
508 }
509
510 function printableLink() {
511 global $wgOut, $wgRequest, $wgLang;
512
513 $s = array();
514
515 if ( !$wgOut->isPrintable() ) {
516 $printurl = htmlspecialchars( $this->getSkin()->getTitle()->getLocalUrl(
517 $wgRequest->appendQueryValue( 'printable', 'yes', true ) ) );
518 $s[] = "<a href=\"$printurl\" rel=\"alternate\">" . wfMsg( 'printableversion' ) . '</a>';
519 }
520
521 if ( $wgOut->isSyndicated() ) {
522 foreach ( $wgOut->getSyndicationLinks() as $format => $link ) {
523 $feedurl = htmlspecialchars( $link );
524 $s[] = "<a href=\"$feedurl\" rel=\"alternate\" type=\"application/{$format}+xml\""
525 . " class=\"feedlink\">" . wfMsgHtml( "feed-$format" ) . "</a>";
526 }
527 }
528 return $wgLang->pipeList( $s );
529 }
530
531 /**
532 * @deprecated in 1.19
533 */
534 function getQuickbarCompensator( $rows = 1 ) {
535 return "<td width='152' rowspan='{$rows}'>&#160;</td>";
536 }
537
538 function editThisPage() {
539 global $wgOut;
540
541 if ( !$wgOut->isArticleRelated() ) {
542 $s = wfMsg( 'protectedpage' );
543 } else {
544 $title = $this->getSkin()->getTitle();
545 if ( $title->quickUserCan( 'edit' ) && $title->exists() ) {
546 $t = wfMsg( 'editthispage' );
547 } elseif ( $title->quickUserCan( 'create' ) && !$title->exists() ) {
548 $t = wfMsg( 'create-this-page' );
549 } else {
550 $t = wfMsg( 'viewsource' );
551 }
552
553 $s = Linker::linkKnown(
554 $title,
555 $t,
556 array(),
557 $this->getSkin()->editUrlOptions()
558 );
559 }
560
561 return $s;
562 }
563
564 function deleteThisPage() {
565 global $wgUser, $wgRequest;
566
567 $diff = $wgRequest->getVal( 'diff' );
568 $title = $this->getSkin()->getTitle();
569
570 if ( $title->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
571 $t = wfMsg( 'deletethispage' );
572
573 $s = Linker::linkKnown(
574 $title,
575 $t,
576 array(),
577 array( 'action' => 'delete' )
578 );
579 } else {
580 $s = '';
581 }
582
583 return $s;
584 }
585
586 function protectThisPage() {
587 global $wgUser, $wgRequest;
588
589 $diff = $wgRequest->getVal( 'diff' );
590 $title = $this->getSkin()->getTitle();
591
592 if ( $title->getArticleId() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) ) {
593 if ( $title->isProtected() ) {
594 $text = wfMsg( 'unprotectthispage' );
595 $query = array( 'action' => 'unprotect' );
596 } else {
597 $text = wfMsg( 'protectthispage' );
598 $query = array( 'action' => 'protect' );
599 }
600
601 $s = Linker::linkKnown(
602 $title,
603 $text,
604 array(),
605 $query
606 );
607 } else {
608 $s = '';
609 }
610
611 return $s;
612 }
613
614 function watchThisPage() {
615 global $wgOut, $wgUser;
616 ++$this->mWatchLinkNum;
617
618 // Cache
619 $title = $this->getSkin()->getTitle();
620
621 if ( $wgOut->isArticleRelated() ) {
622 if ( $title->userIsWatching() ) {
623 $text = wfMsg( 'unwatchthispage' );
624 $query = array(
625 'action' => 'unwatch',
626 'token' => UnwatchAction::getUnwatchToken( $title, $wgUser ),
627 );
628 $id = 'mw-unwatch-link' . $this->mWatchLinkNum;
629 } else {
630 $text = wfMsg( 'watchthispage' );
631 $query = array(
632 'action' => 'watch',
633 'token' => WatchAction::getWatchToken( $title, $wgUser ),
634 );
635 $id = 'mw-watch-link' . $this->mWatchLinkNum;
636 }
637
638 $s = Linker::linkKnown(
639 $title,
640 $text,
641 array( 'id' => $id ),
642 $query
643 );
644 } else {
645 $s = wfMsg( 'notanarticle' );
646 }
647
648 return $s;
649 }
650
651 function moveThisPage() {
652 if ( $this->getSkin()->getTitle()->quickUserCan( 'move' ) ) {
653 return Linker::linkKnown(
654 SpecialPage::getTitleFor( 'Movepage' ),
655 wfMsg( 'movethispage' ),
656 array(),
657 array( 'target' => $this->getSkin()->getTitle()->getPrefixedDBkey() )
658 );
659 } else {
660 // no message if page is protected - would be redundant
661 return '';
662 }
663 }
664
665 function historyLink() {
666 return Linker::link(
667 $this->getSkin()->getTitle(),
668 wfMsgHtml( 'history' ),
669 array( 'rel' => 'archives' ),
670 array( 'action' => 'history' )
671 );
672 }
673
674 function whatLinksHere() {
675 return Linker::linkKnown(
676 SpecialPage::getTitleFor( 'Whatlinkshere', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
677 wfMsgHtml( 'whatlinkshere' )
678 );
679 }
680
681 function userContribsLink() {
682 return Linker::linkKnown(
683 SpecialPage::getTitleFor( 'Contributions', $this->getSkin()->getTitle()->getDBkey() ),
684 wfMsgHtml( 'contributions' )
685 );
686 }
687
688 function emailUserLink() {
689 return Linker::linkKnown(
690 SpecialPage::getTitleFor( 'Emailuser', $this->getSkin()->getTitle()->getDBkey() ),
691 wfMsgHtml( 'emailuser' )
692 );
693 }
694
695 function watchPageLinksLink() {
696 global $wgOut;
697
698 if ( !$wgOut->isArticleRelated() ) {
699 return '(' . wfMsg( 'notanarticle' ) . ')';
700 } else {
701 return Linker::linkKnown(
702 SpecialPage::getTitleFor( 'Recentchangeslinked', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
703 wfMsgHtml( 'recentchangeslinked-toolbox' )
704 );
705 }
706 }
707
708 function talkLink() {
709 $title = $this->getSkin()->getTitle();
710 if ( NS_SPECIAL == $title->getNamespace() ) {
711 # No discussion links for special pages
712 return '';
713 }
714
715 $linkOptions = array();
716
717 if ( $title->isTalkPage() ) {
718 $link = $title->getSubjectPage();
719 switch( $link->getNamespace() ) {
720 case NS_MAIN:
721 $text = wfMsg( 'articlepage' );
722 break;
723 case NS_USER:
724 $text = wfMsg( 'userpage' );
725 break;
726 case NS_PROJECT:
727 $text = wfMsg( 'projectpage' );
728 break;
729 case NS_FILE:
730 $text = wfMsg( 'imagepage' );
731 # Make link known if image exists, even if the desc. page doesn't.
732 if ( wfFindFile( $link ) )
733 $linkOptions[] = 'known';
734 break;
735 case NS_MEDIAWIKI:
736 $text = wfMsg( 'mediawikipage' );
737 break;
738 case NS_TEMPLATE:
739 $text = wfMsg( 'templatepage' );
740 break;
741 case NS_HELP:
742 $text = wfMsg( 'viewhelppage' );
743 break;
744 case NS_CATEGORY:
745 $text = wfMsg( 'categorypage' );
746 break;
747 default:
748 $text = wfMsg( 'articlepage' );
749 }
750 } else {
751 $link = $title->getTalkPage();
752 $text = wfMsg( 'talkpage' );
753 }
754
755 $s = Linker::link( $link, $text, array(), array(), $linkOptions );
756
757 return $s;
758 }
759
760 function commentLink() {
761 global $wgOut;
762
763 $title = $this->getSkin()->getTitle();
764 if ( $title->isSpecialPage() ) {
765 return '';
766 }
767
768 # __NEWSECTIONLINK___ changes behaviour here
769 # If it is present, the link points to this page, otherwise
770 # it points to the talk page
771 if ( !$title->isTalkPage() && !$wgOut->showNewSectionLink() ) {
772 $title = $title->getTalkPage();
773 }
774
775 return Linker::linkKnown(
776 $title,
777 wfMsg( 'postcomment' ),
778 array(),
779 array(
780 'action' => 'edit',
781 'section' => 'new'
782 )
783 );
784 }
785
786 function getUploadLink() {
787 global $wgUploadNavigationUrl;
788
789 if ( $wgUploadNavigationUrl ) {
790 # Using an empty class attribute to avoid automatic setting of "external" class
791 return Linker::makeExternalLink( $wgUploadNavigationUrl, wfMsgHtml( 'upload' ), false, null, array( 'class' => '' ) );
792 } else {
793 return Linker::linkKnown(
794 SpecialPage::getTitleFor( 'Upload' ),
795 wfMsgHtml( 'upload' )
796 );
797 }
798 }
799
800 function nameAndLogin() {
801 global $wgUser, $wgLang, $wgRequest;
802
803 $returnTo = $this->getSkin()->getTitle();
804 $ret = '';
805
806 if ( $wgUser->isAnon() ) {
807 if ( $this->getSkin()->showIPinHeader() ) {
808 $name = $wgRequest->getIP();
809
810 $talkLink = Linker::link( $wgUser->getTalkPage(),
811 $wgLang->getNsText( NS_TALK ) );
812
813 $ret .= "$name ($talkLink)";
814 } else {
815 $ret .= wfMsg( 'notloggedin' );
816 }
817
818 $query = array();
819
820 if ( !$returnTo->isSpecial( 'Userlogout' ) ) {
821 $query['returnto'] = $returnTo->getPrefixedDBkey();
822 }
823
824 $loginlink = $wgUser->isAllowed( 'createaccount' )
825 ? 'nav-login-createaccount'
826 : 'login';
827 $ret .= "\n<br />" . Linker::link(
828 SpecialPage::getTitleFor( 'Userlogin' ),
829 wfMsg( $loginlink ), array(), $query
830 );
831 } else {
832 $talkLink = Linker::link( $wgUser->getTalkPage(),
833 $wgLang->getNsText( NS_TALK ) );
834
835 $ret .= Linker::link( $wgUser->getUserPage(),
836 htmlspecialchars( $wgUser->getName() ) );
837 $ret .= " ($talkLink)<br />";
838 $ret .= $wgLang->pipeList( array(
839 Linker::link(
840 SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
841 array(), array( 'returnto' => $returnTo->getPrefixedDBkey() )
842 ),
843 Linker::specialLink( 'Preferences' ),
844 ) );
845 }
846
847 $ret = $wgLang->pipeList( array(
848 $ret,
849 Linker::link(
850 Title::newFromText( wfMsgForContent( 'helppage' ) ),
851 wfMsg( 'help' )
852 ),
853 ) );
854
855 return $ret;
856 }
857
858 }
859