Merge "Revert "Adding sanity check to Title::isRedirect().""
[lhc/web/wiklou.git] / includes / specials / SpecialWatchlist.php
index 4314424..a81eb5b 100644 (file)
@@ -91,14 +91,6 @@ class SpecialWatchlist extends SpecialPage {
                        return;
                }
 
-               if( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) &&
-                       $request->wasPosted() )
-               {
-                       $user->clearAllNotifications();
-                       $output->redirect( $this->getTitle()->getFullUrl() );
-                       return;
-               }
-
                $nitems = $this->countItems();
                if ( $nitems == 0 ) {
                        $output->addWikiMsg( 'nowatchlist' );
@@ -152,16 +144,16 @@ class SpecialWatchlist extends SpecialPage {
                $invert = $request->getBool( 'invert' );
                $associated = $request->getBool( 'associated' );
                if ( !is_null( $nameSpace ) ) {
-                       $eq_op = $invert ? '!=' : '=';\r
+                       $eq_op = $invert ? '!=' : '=';
                        $bool_op = $invert ? 'AND' : 'OR';
                        $nameSpace = intval( $nameSpace ); // paranioa
                        if ( !$associated ) {
                                $nameSpaceClause = "rc_namespace $eq_op $nameSpace";
                        } else {
-                               $associatedNS = MWNamespace::getAssociated( $nameSpace );\r
+                               $associatedNS = MWNamespace::getAssociated( $nameSpace );
                                $nameSpaceClause =
-                                       "rc_namespace $eq_op $nameSpace " .\r
-                                       $bool_op .\r
+                                       "rc_namespace $eq_op $nameSpace " .
+                                       $bool_op .
                                        " rc_namespace $eq_op $associatedNS";
                        }
                } else {
@@ -190,6 +182,14 @@ class SpecialWatchlist extends SpecialPage {
                        wfAppendToArrayIfNotDefault( $name, $values[$name], $defaults, $nondefaults );
                }
 
+               if( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) &&
+                       $request->wasPosted() )
+               {
+                       $user->clearAllNotifications();
+                       $output->redirect( $this->getTitle()->getFullUrl( $nondefaults ) );
+                       return;
+               }
+
                $dbr = wfGetDB( DB_SLAVE, 'watchlist' );
 
                # Possible where conditions
@@ -263,15 +263,25 @@ class SpecialWatchlist extends SpecialPage {
                                                'id' => 'mw-watchlist-resetbutton' ) ) .
                                        $this->msg( 'wlheader-showupdated' )->parse() . ' ' .
                                        Xml::submitButton( $this->msg( 'enotif_reset' )->text(), array( 'name' => 'dummy' ) ) .
-                                       Html::hidden( 'reset', 'all' ) .
-                                       Xml::closeElement( 'form' );
+                                       Html::hidden( 'reset', 'all' );
+                                       foreach ( $nondefaults as $key => $value ) {
+                                               $form .= Html::hidden( $key, $value );
+                                       }
+                                       $form .= Xml::closeElement( 'form' );
                }
                $form .= '<hr />';
 
                $tables = array( 'recentchanges', 'watchlist' );
                $fields = array( $dbr->tableName( 'recentchanges' ) . '.*' );
                $join_conds = array(
-                       'watchlist' => array('INNER JOIN',"wl_user='{$user->getId()}' AND wl_namespace=rc_namespace AND wl_title=rc_title"),
+                       'watchlist' => array(
+                               'INNER JOIN',
+                               array(
+                                       'wl_user' => $user->getId(),
+                                       'wl_namespace=rc_namespace',
+                                       'wl_title=rc_title'
+                               ),
+                       ),
                );
                $options = array( 'ORDER BY' => 'rc_timestamp DESC' );
                if( $wgShowUpdatedMarker ) {