if( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
$opts['days'] = $m[1];
}
+ if( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
+ $opts['namespace'] = $m[1];
+ }
}
}
# 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;
}
}
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.
// 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
// 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";
}