Index: trunk/extensions/intersection/DynamicPageList.php |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | $stable = $quality = 'include'; |
104 | 104 | $flaggedRevs = false; |
105 | 105 | |
106 | | - $bNamespace = false; |
| 106 | + $namespaceFiltering = false; |
107 | 107 | $namespaceIndex = 0; |
108 | 108 | |
109 | 109 | $offset = 0; |
— | — | @@ -125,12 +125,12 @@ |
126 | 126 | $poptions = new ParserOptions; |
127 | 127 | |
128 | 128 | foreach ( $parameters as $parameter ) { |
129 | | - $aParam = explode( '=', $parameter, 2 ); |
130 | | - if( count( $aParam ) < 2 ) { |
| 129 | + $paramField = explode( '=', $parameter, 2 ); |
| 130 | + if( count( $paramField ) < 2 ) { |
131 | 131 | continue; |
132 | 132 | } |
133 | | - $type = trim( $aParam[0] ); |
134 | | - $arg = trim( $aParam[1] ); |
| 133 | + $type = trim( $paramField[0] ); |
| 134 | + $arg = trim( $paramField[1] ); |
135 | 135 | switch ( $type ) { |
136 | 136 | case 'category': |
137 | 137 | $title = Title::newFromText( |
— | — | @@ -154,13 +154,20 @@ |
155 | 155 | $ns = $wgContLang->getNsIndex( $arg ); |
156 | 156 | if ( $ns != null ) { |
157 | 157 | $namespaceIndex = $ns; |
158 | | - $bNamespace = true; |
| 158 | + $namespaceFiltering = true; |
159 | 159 | } else { |
| 160 | + // Note, since intval("some string") = 0 |
| 161 | + // this considers pretty much anything |
| 162 | + // invalid here as the main namespace. |
| 163 | + // This was probably originally a bug, |
| 164 | + // but is now depended upon by people |
| 165 | + // writing things like namespace=main |
| 166 | + // so be careful when changing this code. |
160 | 167 | $namespaceIndex = intval( $arg ); |
161 | 168 | if ( $namespaceIndex >= 0 ) { |
162 | | - $bNamespace = true; |
| 169 | + $namespaceFiltering = true; |
163 | 170 | } else { |
164 | | - $bNamespace = false; |
| 171 | + $namespaceFiltering = false; |
165 | 172 | } |
166 | 173 | } |
167 | 174 | break; |
— | — | @@ -384,7 +391,7 @@ |
385 | 392 | $excludeCatCount = count( $excludeCategories ); |
386 | 393 | $totalCatCount = $catCount + $excludeCatCount; |
387 | 394 | |
388 | | - if ( $catCount < 1 && false == $bNamespace ) { |
| 395 | + if ( $catCount < 1 && false == $namespaceFiltering ) { |
389 | 396 | if ( $suppressErrors == false ) { |
390 | 397 | return htmlspecialchars( wfMsg( 'intersection_noincludecats' ) ); // "!!no included categories!!"; |
391 | 398 | } else { |
— | — | @@ -437,7 +444,7 @@ |
438 | 445 | $fields[] = 'c1.cl_timestamp'; |
439 | 446 | } |
440 | 447 | |
441 | | - if ( $bNamespace == true ) { |
| 448 | + if ( $namespaceFiltering == true ) { |
442 | 449 | $where['page_namespace'] = $namespaceIndex; |
443 | 450 | } |
444 | 451 | |