replace TYPE= with ENGINE=, (supported since 4.0, TYPE deprecated since 4.1)
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index 8f1711c..625b19c 100644 (file)
@@ -27,10 +27,6 @@ if ( ! defined( 'MEDIAWIKI' ) )
  * to the computations individual esi snippets need. Most importantly no body
  * parsing for most of those of course.
  *
- * PHPTAL support has been moved to a subclass in SkinPHPTal.php,
- * and is optional. You'll need to install PHPTAL manually to use
- * skins that depend on it.
- *
  * @package MediaWiki
  * @subpackage Skins
  */
@@ -96,9 +92,6 @@ class SkinTemplate extends Skin {
        /**
         * For QuickTemplate, the name of the subclass which
         * will actually fill the template.
-        *
-        * In PHPTal mode, name of PHPTal template to be used.
-        * '.pt' will be automaticly added to it on PHPTAL object creation
         */
        var $template;
 
@@ -147,6 +140,7 @@ class SkinTemplate extends Skin {
                global $wgMaxCredits, $wgShowCreditsIfMax;
                global $wgPageShowWatchingUsers;
                global $wgUseTrackbacks;
+               global $wgDBname;
 
                $fname = 'SkinTemplate::outputPage';
                wfProfileIn( $fname );
@@ -269,14 +263,17 @@ class SkinTemplate extends Skin {
                } else {
                        $tpl->set('jsvarurl', false);
                }
-               if( $wgUser->getNewtalk() ) {
+               $newtalks = $wgUser->getNewMessageLinks();
+
+               if (count($newtalks) == 1 && $newtalks[0]["wiki"] === $wgDBname) {
                        $usertitle = $this->mUser->getUserPage();
                        $usertalktitle = $usertitle->getTalkPage();
                        if( !$usertalktitle->equals( $this->mTitle ) ) {
                                $ntl = wfMsg( 'youhavenewmessages',
                                        $this->makeKnownLinkObj(
                                                $usertalktitle,
-                                               wfMsgHtml( 'newmessageslink' )
+                                               wfMsgHtml( 'newmessageslink' ),
+                                               'redirect=no'
                                        ),
                                        $this->makeKnownLinkObj(
                                                $usertalktitle,
@@ -287,6 +284,16 @@ class SkinTemplate extends Skin {
                                # Disable Cache
                                $wgOut->setSquidMaxage(0);
                        }
+               } else if (count($newtalks)) {
+                       $sep = str_replace("_", " ", wfMsgHtml("newtalkseperator"));
+                       $msgs = array();
+                       foreach ($newtalks as $newtalk) {
+                               $msgs[] = wfElement("a",
+                                       array('href' => $newtalk["link"]), $newtalk["wiki"]);
+                       }
+                       $parts = implode($sep, $msgs);
+                       $ntl = wfMsgHtml('youhavenewmessagesmulti', $parts);
+                       $wgOut->setSquidMaxage(0);
                } else {
                        $ntl = '';
                }
@@ -314,7 +321,7 @@ class SkinTemplate extends Skin {
                                $sql = "SELECT COUNT(*) AS n FROM $watchlist
                                        WHERE wl_title='" . $dbr->strencode($this->mTitle->getDBKey()) .
                                        "' AND  wl_namespace=" . $this->mTitle->getNamespace() ;
-                               $res = $dbr->query( $sql, 'SkinPHPTal::outputPage');
+                               $res = $dbr->query( $sql, 'SkinTemplate::outputPage');
                                $x = $dbr->fetchObject( $res );
                                $numberofwatchingusers = $x->n;
                                if ($numberofwatchingusers > 0) {
@@ -440,7 +447,7 @@ class SkinTemplate extends Skin {
         * @access private
         */
        function buildPersonalUrls() {
-               global $wgTitle, $wgShowIPinHeader, $wgContLang;
+               global $wgTitle, $wgShowIPinHeader;
 
                $fname = 'SkinTemplate::buildPersonalUrls';
                $pageurl = $wgTitle->getLocalURL();
@@ -576,7 +583,7 @@ class SkinTemplate extends Skin {
         * @access private
         */
        function buildContentActionUrls () {
-               global $wgContLang, $wgDBprefix;
+               global $wgContLang;
                $fname = 'SkinTemplate::buildContentActionUrls';
                wfProfileIn( $fname );
 
@@ -757,13 +764,14 @@ class SkinTemplate extends Skin {
                wfProfileIn( $fname );
 
                global $wgUser, $wgRequest;
-               global $wgSiteSupportPage, $wgEnableUploads, $wgUploadNavigationUrl;
+               global $wgEnableUploads, $wgUploadNavigationUrl;
 
                $action = $wgRequest->getText( 'action' );
                $oldid = $wgRequest->getVal( 'oldid' );
                $diff = $wgRequest->getVal( 'diff' );
 
                $nav_urls = array();
+               $nav_urls['mainpage'] = array('href' => $this->makeI18nUrl('mainpage'));
                if( $wgEnableUploads ) {
                        if ($wgUploadNavigationUrl) {
                                $nav_urls['upload'] = array('href' => $wgUploadNavigationUrl );
@@ -833,7 +841,7 @@ class SkinTemplate extends Skin {
                        $nav_urls['contributions'] = array(
                                'href' => $this->makeSpecialUrl('Contributions/' . $this->mTitle->getText() )
                        );
-                       if ( $wgUser->isAllowed( 'protect' ) )
+                       if ( $wgUser->isAllowed( 'block' ) )
                                $nav_urls['blockip'] = array(
                                        'href' => $this->makeSpecialUrl( 'Blockip/' . $this->mTitle->getText() )
                                );
@@ -970,7 +978,8 @@ class SkinTemplate extends Skin {
                $fname = 'SkinTemplate::setupPageCss';
                wfProfileIn( $fname );
                $out = false;
-               wfRunHooks( 'SkinTemplateSetupPageCss', array( &$out, $this->mTitle->isProtected() ) );
+               wfRunHooks( 'SkinTemplateSetupPageCss', array( &$out ) );
+               
                wfProfileOut( $fname );
                return $out;
        }
@@ -984,7 +993,6 @@ class SkinTemplate extends Skin {
                $fname = 'SkinTemplate::getUserStylesheet';
                wfProfileIn( $fname );
 
-               global $wgUser;
                $s = "/* generated user stylesheet */\n";
                $s .= $this->reallyDoGetUserStyles();
                wfProfileOut( $fname );