(bug 26360) $wgSessionHandler was overriding system settings unconditionally. Regress...
[lhc/web/wiklou.git] / includes / SkinLegacy.php
index e1e7b02..3b5d843 100644 (file)
@@ -9,6 +9,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 
 class SkinLegacy extends SkinTemplate {
        var $useHeadElement = true;
+       protected $mWatchLinkNum = 0; // Appended to end of watch link id's
 
        /**
         * Add skin specific stylesheets
@@ -53,6 +54,12 @@ class SkinLegacy extends SkinTemplate {
                        return 0;
                }
                $q = $wgUser->getOption( 'quickbar', 0 );
+               if( $q == 5 ) {
+                       # 5 is the default, which chooses the setting
+                       # depending on the directionality of your interface language
+                       global $wgLang;
+                       return $wgLang->isRTL() ? 2 : 1;
+               }
                return $q;
        }
 
@@ -67,6 +74,10 @@ class LegacyTemplate extends BaseTemplate {
                $this->html( 'headelement' );
                echo $this->beforeContent();
                $this->html( 'bodytext' );
+               echo '<div class="printfooter">';
+               $this->html( 'printfooter' );
+               echo '</div>';
+               $this->html( 'debughtml' );
                echo "\n";
                echo $this->afterContent();
                $this->html( 'dataAfterContent' );
@@ -107,7 +118,7 @@ class LegacyTemplate extends BaseTemplate {
 
                if ( !$shove ) {
                        $s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
-                               $this->logoText() . '</td>';
+                               $this->getSkin()->logoText() . '</td>';
                } elseif ( $left ) {
                        $s .= $this->getQuickbarCompensator( $rows );
                }
@@ -134,7 +145,7 @@ class LegacyTemplate extends BaseTemplate {
                $s .= "</tr>\n</table>\n</div>\n";
                $s .= "\n<div id='article'>\n";
 
-               $notice = wfGetSiteNotice();
+               $notice = $this->getSkin()->getSiteNotice();
 
                if ( $notice ) {
                        $s .= "\n<div id='siteNotice'>$notice</div>\n";
@@ -210,7 +221,7 @@ class LegacyTemplate extends BaseTemplate {
                }
 
                if ( $wgMaxCredits != 0 ) {
-                       $s .= ' ' . Credits::getCredits( $article, $wgMaxCredits, $wgShowCreditsIfMax );
+                       $s .= ' ' . Action::factory( 'credits', $article )->getCredits( $wgMaxCredits, $wgShowCreditsIfMax );
                } else {
                        $s .= $this->data['lastmod'];
                }
@@ -432,7 +443,7 @@ class LegacyTemplate extends BaseTemplate {
        function specialPagesList() {
                global $wgContLang, $wgServer, $wgRedirectScript;
 
-               $pages = array_merge( SpecialPage::getRegularPages(), SpecialPage::getRestrictedPages() );
+               $pages = SpecialPageFactory::getUsablePages();
 
                foreach ( $pages as $name => $page ) {
                        $pages[$name] = $page->getDescription();
@@ -566,18 +577,19 @@ class LegacyTemplate extends BaseTemplate {
        }
 
        function printableLink() {
-               global $wgOut, $wgFeedClasses, $wgRequest, $wgLang;
+               global $wgOut, $wgRequest, $wgLang;
 
                $s = array();
 
                if ( !$wgOut->isPrintable() ) {
-                       $printurl = $wgRequest->escapeAppendQuery( 'printable=yes' );
+                       $printurl = htmlspecialchars( $this->getSkin()->getTitle()->getLocalUrl(
+                               $wgRequest->appendQueryValue( 'printable', 'yes', true ) ) );
                        $s[] = "<a href=\"$printurl\" rel=\"alternate\">" . wfMsg( 'printableversion' ) . '</a>';
                }
 
                if ( $wgOut->isSyndicated() ) {
-                       foreach ( $wgFeedClasses as $format => $class ) {
-                               $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
+                       foreach ( $wgOut->getSyndicationLinks() as $format => $link ) {
+                               $feedurl = htmlspecialchars( $link );
                                $s[] = "<a href=\"$feedurl\" rel=\"alternate\" type=\"application/{$format}+xml\""
                                                . " class=\"feedlink\">" . wfMsgHtml( "feed-$format" ) . "</a>";
                        }
@@ -666,22 +678,31 @@ class LegacyTemplate extends BaseTemplate {
        }
 
        function watchThisPage() {
-               global $wgOut;
+               global $wgOut, $wgUser;
                ++$this->mWatchLinkNum;
 
+               // Cache
+               $title = $this->getSkin()->getTitle();
+
                if ( $wgOut->isArticleRelated() ) {
-                       if ( $this->getSkin()->getTitle()->userIsWatching() ) {
+                       if ( $title->userIsWatching() ) {
                                $text = wfMsg( 'unwatchthispage' );
-                               $query = array( 'action' => 'unwatch' );
+                               $query = array(
+                                       'action' => 'unwatch',
+                                       'token' => UnwatchAction::getUnwatchToken( $title, $wgUser ),
+                               );
                                $id = 'mw-unwatch-link' . $this->mWatchLinkNum;
                        } else {
                                $text = wfMsg( 'watchthispage' );
-                               $query = array( 'action' => 'watch' );
+                               $query = array(
+                                       'action' => 'watch',
+                                       'token' => WatchAction::getWatchToken( $title, $wgUser ),
+                               );
                                $id = 'mw-watch-link' . $this->mWatchLinkNum;
                        }
 
                        $s = $this->getSkin()->link(
-                               $this->getSkin()->getTitle(),
+                               $title,
                                $text,
                                array( 'id' => $id ),
                                $query,