Fix broken contribution listings with postgres by adding a new variable
[lhc/web/wiklou.git] / includes / Skin.php
index 374ca20..43c7695 100644 (file)
@@ -324,6 +324,14 @@ class Skin extends Linker {
                $r = self::makeGlobalVariablesScript( $vars );
 
                $r .= "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js?$wgStyleVersion\"></script>\n";
+               global $wgUseSiteJs;
+               if ($wgUseSiteJs) {
+                       if ($wgUser->isLoggedIn()) {
+                               $r .= "<script type=\"$wgJsMimeType\" src=\"".htmlspecialchars(self::makeUrl('-','action=raw&smaxage=0&gen=js'))."\"><!-- site js --></script>\n";
+                       } else {
+                               $r .= "<script type=\"$wgJsMimeType\" src=\"".htmlspecialchars(self::makeUrl('-','action=raw&gen=js'))."\"><!-- site js --></script>\n";
+                       }
+               }
                if( $wgAllowUserJs && $wgUser->isLoggedIn() ) {
                        $userpage = $wgUser->getUserPage();
                        $userjs = htmlspecialchars( self::makeUrl(
@@ -376,9 +384,27 @@ class Skin extends Linker {
        }
 
        /**
-        * placeholder, returns generated js in monobook
+        * This returns MediaWiki:Common.js.  For some bizarre reason, it does
+        * *not* return any custom user JS from user subpages.  Huh?
+        *
+        * @return string
         */
-       function getUserJs() { return; }
+       function getUserJs() {
+               $fname = 'Skin::getUserJs';
+               wfProfileIn( $fname );
+
+               global $wgStylePath;
+               $s = "/* generated javascript */\n";
+               $s .= "var skin = '{$this->skinname}';\nvar stylepath = '{$wgStylePath}';";
+               $s .= "\n\n/* MediaWiki:Common.js */\n";
+               $commonJs = wfMsgForContent('Common.js');
+               if ( !wfEmptyMsg ( 'Common.js', $commonJs ) ) {
+                       $s .= $commonJs;
+               }
+
+               wfProfileOut( $fname );
+               return $s;
+    }
 
        /**
         * Return html code that include User stylesheets
@@ -579,8 +605,7 @@ END;
                $t = $embed . implode ( "{$pop} {$sep} {$embed}" , $wgOut->mCategoryLinks ) . $pop;
 
                $msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escape' ), count( $wgOut->mCategoryLinks ) );
-               $s = $this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Categories' ),
-                       $msg, 'article=' . urlencode( $wgTitle->getPrefixedDBkey() ) )
+               $s = $this->makeLinkObj( Title::newFromText( wfMsgForContent('pagecategorieslink') ), $msg )
                        . ': ' . $t;
 
                # optional 'dmoz-like' category browser. Will be shown under the list
@@ -1009,7 +1034,7 @@ END;
 
                if ($wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
                        $dbr =& wfGetDB( DB_SLAVE );
-                       extract( $dbr->tableNames( 'watchlist' ) );
+                       $watchlist = $dbr->tableName( 'watchlist' );
                        $sql = "SELECT COUNT(*) AS n FROM $watchlist
                                WHERE wl_title='" . $dbr->strencode($wgTitle->getDBKey()) .
                                "' AND  wl_namespace=" . $wgTitle->getNamespace() ;
@@ -1587,8 +1612,12 @@ END;
                                                $href = $link;
                                        } else {
                                                $title = Title::newFromText( $link );
-                                               $title = $title->fixSpecialName();
-                                               $href = $title->getLocalURL();
+                                               if ( $title ) {
+                                                       $title = $title->fixSpecialName();
+                                                       $href = $title->getLocalURL();
+                                               } else {
+                                                       $href = 'INVALID-TITLE';
+                                               }
                                        }
 
                                        $bar[$heading][] = array(