-
- $loginlink = $wgUser->isAllowed( 'createaccount' )
- ? 'nav-login-createaccount'
- : 'login';
- $ret .= "\n<br />" . $this->link(
- SpecialPage::getTitleFor( 'Userlogin' ),
- wfMsg( $loginlink ), array(), $query
- );
- } else {
- $returnTo = $this->mTitle->getPrefixedDBkey();
- $talkLink = $this->link( $wgUser->getTalkPage(),
- $wgLang->getNsText( NS_TALK ) );
-
- $ret .= $this->link( $wgUser->getUserPage(),
- htmlspecialchars( $wgUser->getName() ) );
- $ret .= " ($talkLink)<br />";
- $ret .= $wgLang->pipeList( array(
- $this->link(
- SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
- array(), array( 'returnto' => $returnTo )
- ),
- $this->specialLink( 'Preferences' ),
- ) );
- }
-
- $ret = $wgLang->pipeList( array(
- $ret,
- $this->link(
- Title::newFromText( wfMsgForContent( 'helppage' ) ),
- wfMsg( 'help' )
- ),
- ) );
-
- return $ret;
- }
-
- function getSearchLink() {
- $searchPage = SpecialPage::getTitleFor( 'Search' );
- return $searchPage->getLocalURL();
- }
-
- function escapeSearchLink() {
- return htmlspecialchars( $this->getSearchLink() );
- }
-
- function searchForm() {
- global $wgRequest, $wgUseTwoButtonsSearchForm;
-
- $search = $wgRequest->getText( 'search' );
-
- $s = '<form id="searchform' . $this->searchboxes . '" name="search" class="inline" method="post" action="'
- . $this->escapeSearchLink() . "\">\n"
- . '<input type="text" id="searchInput' . $this->searchboxes . '" name="search" size="19" value="'
- . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />\n"
- . '<input type="submit" name="go" value="' . wfMsg( 'searcharticle' ) . '" />';
-
- if ( $wgUseTwoButtonsSearchForm ) {
- $s .= ' <input type="submit" name="fulltext" value="' . wfMsg( 'searchbutton' ) . "\" />\n";
- } else {
- $s .= ' <a href="' . $this->escapeSearchLink() . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a>\n";
- }
-
- $s .= '</form>';
-
- // Ensure unique id's for search boxes made after the first
- $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
-
- return $s;
- }
-
- function topLinks() {
- global $wgOut;
-
- $s = array(
- $this->mainPageLink(),
- $this->specialLink( 'Recentchanges' )
- );
-
- if ( $wgOut->isArticleRelated() ) {
- $s[] = $this->editThisPage();
- $s[] = $this->historyLink();
- }
-
- # Many people don't like this dropdown box
- # $s[] = $this->specialPagesList();
-
- if ( $this->variantLinks() ) {
- $s[] = $this->variantLinks();
- }
-
- if ( $this->extensionTabLinks() ) {
- $s[] = $this->extensionTabLinks();
- }
-
- // @todo FIXME: Is using Language::pipeList impossible here? Do not quite understand the use of the newline
- return implode( $s, wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n" );
- }
-
- /**
- * Compatibility for extensions adding functionality through tabs.
- * Eventually these old skins should be replaced with SkinTemplate-based
- * versions, sigh...
- * @return string
- */
- function extensionTabLinks() {
- $tabs = array();
- $out = '';
- $s = array();
- wfRunHooks( 'SkinTemplateTabs', array( $this, &$tabs ) );
- foreach ( $tabs as $tab ) {
- $s[] = Xml::element( 'a',
- array( 'href' => $tab['href'] ),
- $tab['text'] );
- }
-
- if ( count( $s ) ) {
- global $wgLang;
-
- $out = wfMsgExt( 'pipe-separator' , 'escapenoentities' );
- $out .= $wgLang->pipeList( $s );
- }
-
- return $out;
- }
-
- /**
- * Language/charset variant links for classic-style skins
- * @return string
- */
- function variantLinks() {
- $s = '';
-
- /* show links to different language variants */
- global $wgDisableLangConversion, $wgLang, $wgContLang;
-
- $variants = $wgContLang->getVariants();
-
- if ( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
- foreach ( $variants as $code ) {
- $varname = $wgContLang->getVariantname( $code );
-
- if ( $varname == 'disable' ) {
- continue;
- }
- $s = $wgLang->pipeList( array(
- $s,
- '<a href="' . $this->mTitle->escapeLocalURL( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>'
- ) );
- }
- }
-
- return $s;
- }
-
- function bottomLinks() {
- global $wgOut, $wgUser, $wgUseTrackbacks;
- $sep = wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n";
-
- $s = '';
- if ( $wgOut->isArticleRelated() ) {
- $element[] = '<strong>' . $this->editThisPage() . '</strong>';
-
- if ( $wgUser->isLoggedIn() ) {
- $element[] = $this->watchThisPage();
- }
-
- $element[] = $this->talkLink();
- $element[] = $this->historyLink();
- $element[] = $this->whatLinksHere();
- $element[] = $this->watchPageLinksLink();
-
- if ( $wgUseTrackbacks ) {
- $element[] = $this->trackbackLink();
- }
-
- if (
- $this->mTitle->getNamespace() == NS_USER ||
- $this->mTitle->getNamespace() == NS_USER_TALK
- ) {
- $id = User::idFromName( $this->mTitle->getText() );
- $ip = User::isIP( $this->mTitle->getText() );
-
- # Both anons and non-anons have contributions list
- if ( $id || $ip ) {
- $element[] = $this->userContribsLink();
- }
-
- if ( $this->showEmailUser( $id ) ) {
- $element[] = $this->emailUserLink();
- }
- }
-
- $s = implode( $element, $sep );
-
- if ( $this->mTitle->getArticleId() ) {
- $s .= "\n<br />";
-
- // Delete/protect/move links for privileged users
- if ( $wgUser->isAllowed( 'delete' ) ) {
- $s .= $this->deleteThisPage();
- }
-
- if ( $wgUser->isAllowed( 'protect' ) ) {
- $s .= $sep . $this->protectThisPage();
- }
-
- if ( $wgUser->isAllowed( 'move' ) ) {
- $s .= $sep . $this->moveThisPage();
- }
- }
-
- $s .= "<br />\n" . $this->otherLanguages();
- }
-
- return $s;
- }
-
- function pageStats() {
- global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser;
- global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgPageShowWatchingUsers;
-
- $oldid = $wgRequest->getVal( 'oldid' );
- $diff = $wgRequest->getVal( 'diff' );
-
- if ( !$wgOut->isArticle() ) {
- return '';
- }
-
- if ( !$wgArticle instanceof Article ) {
- return '';
- }
-
- if ( isset( $oldid ) || isset( $diff ) ) {
- return '';
- }
-
- if ( 0 == $wgArticle->getID() ) {
- return '';
- }
-
- $s = '';
-
- if ( !$wgDisableCounters ) {
- $count = $wgLang->formatNum( $wgArticle->getCount() );
-
- if ( $count ) {
- $s = wfMsgExt( 'viewcount', array( 'parseinline' ), $count );
- }
- }
-
- if ( $wgMaxCredits != 0 ) {
- $s .= ' ' . Credits::getCredits( $wgArticle, $wgMaxCredits, $wgShowCreditsIfMax );
- } else {
- $s .= $this->lastModified();
- }
-
- if ( $wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' ) ) {
- $dbr = wfGetDB( DB_SLAVE );
- $res = $dbr->select(
- 'watchlist',
- array( 'COUNT(*) AS n' ),
- array(
- 'wl_title' => $dbr->strencode( $this->mTitle->getDBkey() ),
- 'wl_namespace' => $this->mTitle->getNamespace()
- ),
- __METHOD__
- );
- $x = $dbr->fetchObject( $res );
-
- $s .= ' ' . wfMsgExt( 'number_of_watching_users_pageview',
- array( 'parseinline' ), $wgLang->formatNum( $x->n )
- );
- }
-
- return $s . ' ' . $this->getCopyright();
- }
-
- function getCopyright( $type = 'detect' ) {
- global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest, $wgArticle;
-
- if ( $type == 'detect' ) {
- $diff = $wgRequest->getVal( 'diff' );
- $isCur = $wgArticle && $wgArticle->isCurrent();
-
- if ( is_null( $diff ) && !$isCur && wfMsgForContent( 'history_copyright' ) !== '-' ) {
- $type = 'history';
- } else {
- $type = 'normal';
- }
- }