Hide category changes if feature is disabled
[lhc/web/wiklou.git] / includes / specials / SpecialWatchlist.php
index c894a79..cc5c150 100644 (file)
@@ -118,10 +118,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                $opts->add( 'hideliu', $user->getBoolOption( 'watchlisthideliu' ) );
                $opts->add( 'hidepatrolled', $user->getBoolOption( 'watchlisthidepatrolled' ) );
                $opts->add( 'hidemyself', $user->getBoolOption( 'watchlisthideown' ) );
-
-               if ( $this->getConfig()->get( 'RCWatchCategoryMembership' ) ) {
-                       $opts->add( 'hidecategorization', $user->getBoolOption( 'watchlisthidecategorization' ) );
-               }
+               $opts->add( 'hidecategorization', $user->getBoolOption( 'watchlisthidecategorization' ) );
 
                return $opts;
        }
@@ -422,13 +419,15 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                $this->setTopText( $opts );
 
                $lang = $this->getLanguage();
-               $wlInfo = '';
                if ( $opts['days'] > 0 ) {
-                       $timestamp = wfTimestampNow();
-                       $wlInfo = $this->msg( 'wlnote' )->numParams( $numRows, round( $opts['days'] * 24 ) )->params(
-                               $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user )
-                       )->parse() . "<br />\n";
+                       $days = $opts['days'];
+               } else {
+                       $days = $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 );
                }
+               $timestamp = wfTimestampNow();
+               $wlInfo = $this->msg( 'wlnote' )->numParams( $numRows, round( $days * 24 ) )->params(
+                       $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user )
+               )->parse() . "<br />\n";
 
                $nondefaults = $opts->getChangedValues();
                $cutofflinks = $this->msg( 'wlshowtime' ) . ' ' . $this->cutoffselector( $opts );
@@ -530,9 +529,19 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                        $days[] = $userWatchlistOption;
                }
 
+               $maxDays = (string)( $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
+               // add the maximum possible value, if it isn't available already
+               if ( !in_array( $maxDays, $days ) ) {
+                       $days[] = $maxDays;
+               }
+
                $selected = (string)$options['days'];
+               if ( $selected <= 0 ) {
+                       $selected = $maxDays;
+               }
+
                // add the currently selected value, if it isn't available already
-               if ( !in_array( $selected, $days ) && $selected !== '0' ) {
+               if ( !in_array( $selected, $days ) ) {
                        $days[] = $selected;
                }
 
@@ -548,11 +557,6 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                        $select->addOption( $name, $value );
                }
 
-               // 'all' option
-               $name = $this->msg( 'watchlistall2' )->text();
-               $value = '0';
-               $select->addOption( $name, $value );
-
                return $select->getHTML() . "\n<br />\n";
        }
 
@@ -605,7 +609,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                        array( 'id' => 'mw-watchlist-options' )
                );
 
-               $form .= SpecialRecentChanges::makeLegend( $this->getContext() );
+               $form .= $this->makeLegend();
 
                $this->getOutput()->addHTML( $form );
        }