(bug 4974) Don't follow redirected talk page on "new messages" link
[lhc/web/wiklou.git] / includes / SpecialMaintenance.php
index d9d0fc3..75b66e7 100644 (file)
@@ -9,9 +9,8 @@
  * shortcut to get the current language "special" namespace name
  */
 function sns() {
-       global $wgContLang ;
-       $ns = $wgContLang->getNamespaces() ;
-       return $ns[NS_SPECIAL] ;
+       global $wgContLang;
+       return $wgContLang->getNsText(NS_SPECIAL);
 }
 
 
@@ -19,7 +18,7 @@ function sns() {
  * Entry point
  */
 function wfSpecialMaintenance( $par=NULL ) {
-       global $wgUser, $wgOut, $wgContLang, $wgTitle, $wgRequest, $wgContLanguageCode;
+       global $wgUser, $wgOut, $wgContLang, $wgRequest, $wgContLanguageCode;
        global $wgMiserMode;
 
        # This pages is expensive ressource wise
@@ -27,7 +26,7 @@ function wfSpecialMaintenance( $par=NULL ) {
                $wgOut->addWikiText( wfMsg( 'perfdisabled' ) );
                return;
        }
-       
+
        # Get parameters from the URL
        $submitmll = $wgRequest->getVal( 'submitmll' );
 
@@ -39,26 +38,25 @@ function wfSpecialMaintenance( $par=NULL ) {
 
        # Call the subfunction requested by the user
        switch( $subfunction ) {
-       case 'disambiguations': return wfSpecialDisambiguations() ; break;
-       
+       case 'disambiguations': return wfSpecialDisambiguations();
+
        # doubleredirects & brokenredirects are old maintenance subpages.
-       case 'doubleredirects': return wfSpecialDoubleRedirects() ; break;
-       case 'brokenredirects': return wfSpecialBrokenRedirects() ; break;
-       
-       case 'selflinks':       return wfSpecialSelfLinks()       ; break;
-       case 'mispeelings':     return wfSpecialMispeelings()     ; break;
-       case 'missinglanguagelinks': return wfSpecialMissingLanguageLinks() ; break;
+       case 'doubleredirects': return wfSpecialDoubleRedirects();
+       case 'brokenredirects': return wfSpecialBrokenRedirects();
+
+       case 'selflinks':       return wfSpecialSelfLinks()      ;
+       case 'mispeelings':     return wfSpecialMispeelings()    ;
+       case 'missinglanguagelinks': return wfSpecialMissingLanguageLinks();
        }
-       
+
        if ( !is_null( $submitmll ) ) return wfSpecialMissingLanguageLinks() ;
 
        $sk = $wgUser->getSkin();
-       $ns = $wgContLang->getNamespaces() ;
 
        # Generate page output
-       
+
        $r = wfMsg('maintnancepagetext') ;
-       
+
        # Links to subfunctions
        $r .= "<ul>\n" ;
        $r .= "<li>".$sk->makeKnownLink( sns().':Disambiguations', wfMsg('disambiguations')) . "</li>\n";
@@ -80,7 +78,7 @@ function wfSpecialMaintenance( $par=NULL ) {
        $r .= htmlspecialchars(wfMsg('missinglanguagelinksbutton'), ENT_QUOTES);
        $r .= "\" />\n" ;
        $r .= "<select name=\"thelang\">\n" ;
-       
+
        $a = $wgContLang->getLanguageNames();
        $ak = array_keys ( $a ) ;
        foreach ( $ak AS $k ) {
@@ -98,7 +96,7 @@ function wfSpecialMaintenance( $par=NULL ) {
  * Generate a maintenance page link
  */
 function getMPL ( $x ) {
-       global $wgUser , $wgLang;
+       global $wgUser;
        $sk = $wgUser->getSkin() ;
        return $sk->makeKnownLink( sns().":Maintenance" , wfMsg($x), 'subfunction='.$x ) ;
 }
@@ -111,7 +109,7 @@ function getMaintenancePageBacklink( $subfunction ) {
                $wgContLang->getNsText( NS_SPECIAL ) . ':Maintenance',
                wfMsg( 'maintenancebacklink' ) ) ;
        $t = wfMsg ( $subfunction ) ;
-       
+
        $s = '<table width="100%" border="0"><tr><td>';
        $s .= '<h2>'.$t.'</h2></td><td align="right">';
        $s .= "{$r}</td></tr></table>\n" ;
@@ -152,13 +150,13 @@ function wfSpecialDisambiguations() {
  * @deprecated
  */
 function wfSpecialSelfLinks() {
-       global $wgUser, $wgOut, $wgLang, $wgTitle;
+       global $wgUser, $wgOut;
        $fname = 'wfSpecialSelfLinks';
 
        list( $limit, $offset ) = wfCheckLimits();
 
-       $sql = "SELECT page_namespace,page_title FROM page,links " . 
-         "WHERE l_from=l_to AND l_to=page_id " . 
+       $sql = "SELECT page_namespace,page_title FROM page,links " .
+         "WHERE l_from=l_to AND l_to=page_id " .
          "LIMIT {$offset}, {$limit}";
 
        $res = wfQuery( $sql, DB_SLAVE, $fname );
@@ -185,10 +183,10 @@ function wfSpecialSelfLinks() {
 }
 
 /**
- * 
+ *
  */
 function wfSpecialMispeelings () {
-       global $wgUser, $wgOut, $wgContLang, $wgTitle;
+       global $wgUser, $wgOut, $wgContLang;
        $sk = $wgUser->getSkin();
        $fname = 'wfSpecialMispeelings';
 
@@ -257,8 +255,8 @@ function wfSpecialMispeelings () {
  *
  */
 function wfSpecialMissingLanguageLinks() {
-       global $wgUser, $wgOut, $wgContLang, $wgTitle, $wgRequest;
-       
+       global $wgUser, $wgOut, $wgContLang, $wgRequest;
+
        $fname = 'wfSpecialMissingLanguageLinks';
        $thelang = $wgRequest->getText( 'thelang' );
        if ( $thelang == 'w' ) $thelang = 'en' ; # Fix for international wikis