If local language's magicwords list is incomplete, try fetching it from the English one
[lhc/web/wiklou.git] / includes / SpecialCategories.php
1 <?php
2
3 function wfSpecialCategories()
4 {
5 global $wgUser, $wgOut , $wgLang;
6
7 $sk = $wgUser->getSkin() ;
8 $sc = "Special:Categories" ;
9
10 # List all existant categories.
11 # Note: this list could become *very large*
12 $r = "<ol>\n" ;
13 $sql = "SELECT cur_title FROM cur WHERE cur_namespace=".Namespace::getCategory() ;
14 $res = wfQuery ( $sql, DB_READ ) ;
15 while ( $x = wfFetchObject ( $res ) ) {
16 $title =& Title::makeTitle( NS_CATEGORY, $x->cur_title );
17 $r .= "<li>" ;
18 $r .= $sk->makeKnownLinkObj ( $title, $title->getText() ) ;
19 $r .= "</li>\n" ;
20 }
21 wfFreeResult ( $res ) ;
22 $r .= "</ol>\n" ;
23
24 $r .= "<hr />\n" ;
25
26 # Links to category pages that haven't been created.
27 # FIXME: This could be slow if there are a lot, but the title index should
28 # make it reasonably snappy since we're using an index.
29 $cat = wfStrencode( $wgLang->getNsText( NS_CATEGORY ) );
30 $sql = "SELECT DISTINCT bl_to FROM brokenlinks WHERE bl_to LIKE \"{$cat}:%\"" ;
31 $res = wfQuery ( $sql, DB_READ ) ;
32 $r .= "<ol>\n" ;
33 while ( $x = wfFetchObject ( $res ) ) {
34 $title = Title::newFromDBkey( $x->bl_to );
35 $r .= "<li>" ;
36 $r .= $sk->makeBrokenLinkObj( $title, $title->getText() ) ;
37 $r .= "</li>\n" ;
38 }
39 wfFreeResult ( $res ) ;
40 $r .= "</ol>\n" ;
41
42 $wgOut->addHTML ( $r ) ;
43 }
44
45 ?>