Bug 32673: Keep the username in the input field if not existing
[lhc/web/wiklou.git] / includes / specials / SpecialRecentchanges.php
index 8b9e72a..85b93b0 100644 (file)
@@ -232,6 +232,9 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                        if( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
                                $opts['days'] = $m[1];
                        }
+                       if( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
+                               $opts['namespace'] = $m[1];
+                       }
                }
        }
 
@@ -325,24 +328,25 @@ class SpecialRecentChanges extends IncludableSpecialPage {
 
                # Namespace filtering
                if( $opts['namespace'] !== '' ) {
-                       $namespaces[] = $opts['namespace'];
-
-                       $inversionSuffix = $opts['invert'] ? '!' : '';
+                       $selectedNS = $dbr->addQuotes( $opts['namespace'] );
+                       $operator = $opts['invert'] ? '!='  : '=';
+                       $boolean  = $opts['invert'] ? 'AND' : 'OR';
 
-                       if( $opts['associated'] ) {
-                               # namespace association (bug 2429)
-                               $namespaces[] = MWNamespace::getAssociated( $opts['namespace'] );
+                       # namespace association (bug 2429)
+                       if( !$opts['associated'] ) {
+                               $condition = "rc_namespace $operator $selectedNS";
+                       } else {
+                               # Also add the associated namespace
+                               $associatedNS = $dbr->addQuotes(
+                                       MWNamespace::getAssociated( $opts['namespace'] )
+                               );
+                               $condition = "(rc_namespace $operator $selectedNS "
+                                                  . $boolean
+                                                  . " rc_namespace $operator $associatedNS)";
                        }
 
-                       $condition = $dbr->makeList(
-                               array( 'rc_namespace' . $inversionSuffix
-                                       => $namespaces ),
-                               LIST_AND
-                       );
-
                        $conds[] = $condition;
                }
-
                return $conds;
        }
 
@@ -770,10 +774,10 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                }
                if( $options['from'] ) {
                        $note .= wfMsgExt( 'rcnotefrom', array( 'parseinline' ),
-                               $this->getLang()->formatNum( $options['limit'] ),
-                               $this->getLang()->timeanddate( $options['from'], true ),
-                               $this->getLang()->date( $options['from'], true ),
-                               $this->getLang()->time( $options['from'], true ) ) . '<br />';
+                               $this->getLanguage()->formatNum( $options['limit'] ),
+                               $this->getLanguage()->timeanddate( $options['from'], true ),
+                               $this->getLanguage()->date( $options['from'], true ),
+                               $this->getLanguage()->time( $options['from'], true ) ) . '<br />';
                }
 
                # Sort data for display and make sure it's unique after we've added user data.
@@ -786,17 +790,17 @@ class SpecialRecentChanges extends IncludableSpecialPage {
 
                // limit links
                foreach( $wgRCLinkLimits as $value ) {
-                       $cl[] = $this->makeOptionsLink( $this->getLang()->formatNum( $value ),
+                       $cl[] = $this->makeOptionsLink( $this->getLanguage()->formatNum( $value ),
                                array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
                }
-               $cl = $this->getLang()->pipeList( $cl );
+               $cl = $this->getLanguage()->pipeList( $cl );
 
                // day links, reset 'from' to none
                foreach( $wgRCLinkDays as $value ) {
-                       $dl[] = $this->makeOptionsLink( $this->getLang()->formatNum( $value ),
+                       $dl[] = $this->makeOptionsLink( $this->getLanguage()->formatNum( $value ),
                                array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
                }
-               $dl = $this->getLang()->pipeList( $dl );
+               $dl = $this->getLanguage()->pipeList( $dl );
 
 
                // show/hide links
@@ -826,13 +830,13 @@ class SpecialRecentChanges extends IncludableSpecialPage {
 
                // show from this onward link
                $timestamp = wfTimestampNow();
-               $now = $this->getLang()->timeanddate( $timestamp, true );
+               $now = $this->getLanguage()->timeanddate( $timestamp, true );
                $tl = $this->makeOptionsLink(
                        $now, array( 'from' => $timestamp ), $nondefaults
                );
 
                $rclinks = wfMsgExt( 'rclinks', array( 'parseinline', 'replaceafter' ),
-                       $cl, $dl, $this->getLang()->pipeList( $links ) );
+                       $cl, $dl, $this->getLanguage()->pipeList( $links ) );
                $rclistfrom = wfMsgExt( 'rclistfrom', array( 'parseinline', 'replaceafter' ), $tl );
                return "{$note}$rclinks<br />$rclistfrom";
        }