- $id = $this->mTitle->getArticleID() ;
-
- # FIXME: add limits
- $dbr =& wfGetDB( DB_SLAVE );
- $cur = $dbr->tableName( 'cur' );
- $categorylinks = $dbr->tableName( 'categorylinks' );
-
- $t = $dbr->strencode( $this->mTitle->getDBKey() );
- $sql = "SELECT DISTINCT cur_title,cur_namespace FROM $cur,$categorylinks " .
- "WHERE cl_to='$t' AND cl_from=cur_id AND cur_is_redirect=0 ORDER BY cl_sortkey" ;
- $res = $dbr->query( $sql, $fname ) ;
- # For all pages that link to this category
- while ( $x = $dbr->fetchObject ( $res ) )
- {
- $t = $wgContLang->getNsText ( $x->cur_namespace ) ;
- if ( $t != '' ) $t .= ':' ;
- $t .= $x->cur_title ;
-
- if ( $x->cur_namespace == NS_CATEGORY ) {
- array_push ( $children , $sk->makeLink ( $t ) ) ; # Subcategory
- } else {
- array_push ( $articles , $sk->makeLink ( $t ) ) ; # Page in this category
- }
- }
- $dbr->freeResult ( $res ) ;
-
- # Showing subcategories
- if ( count ( $children ) > 0 ) {
- $r .= '<h2>'.wfMsg('subcategories')."</h2>\n" ;
- $r .= implode ( ', ' , $children ) ;
- }
-
- # Showing pages in this category
- if ( count ( $articles ) > 0 ) {
- $ti = $this->mTitle->getText() ;
- $h = wfMsg( 'category_header', $ti );
- $r .= "<h2>$h</h2>\n" ;
- $r .= implode ( ', ' , $articles ) ;
- }
-
- return $r ;
+ $id = $this->mTitle->getArticleID() ;
+
+ # FIXME: add limits
+ $dbr =& wfGetDB( DB_SLAVE );
+ $cur = $dbr->tableName( 'cur' );
+ $categorylinks = $dbr->tableName( 'categorylinks' );
+
+ $t = $dbr->strencode( $this->mTitle->getDBKey() );
+ $sql = "SELECT DISTINCT cur_title,cur_namespace FROM $cur,$categorylinks " .
+ "WHERE cl_to='$t' AND cl_from=cur_id AND cur_is_redirect=0 ORDER BY cl_sortkey" ;
+ $res = $dbr->query( $sql, $fname ) ;
+ # For all pages that link to this category
+ while ( $x = $dbr->fetchObject ( $res ) )
+ {
+ $t = $wgContLang->getNsText ( $x->cur_namespace ) ;
+ if ( $t != '' ) $t .= ':' ;
+ $t .= $x->cur_title ;
+
+ if ( $x->cur_namespace == NS_CATEGORY ) {
+ array_push ( $children , $sk->makeLink ( $t ) ) ; # Subcategory
+ } else {
+ array_push ( $articles , $sk->makeLink ( $t ) ) ; # Page in this category
+ }
+ }
+ $dbr->freeResult ( $res ) ;
+
+ # Showing subcategories
+ if ( count ( $children ) > 0 ) {
+ $r .= '<h2>'.wfMsg('subcategories')."</h2>\n" ;
+ $r .= implode ( ', ' , $children ) ;
+ }
+
+ # Showing pages in this category
+ if ( count ( $articles ) > 0 ) {
+ $ti = $this->mTitle->getText() ;
+ $h = wfMsg( 'category_header', $ti );
+ $r .= "<h2>$h</h2>\n" ;
+ $r .= implode ( ', ' , $articles ) ;
+ }
+
+ return $r ;