based on QueryPage, fixed query to really return all categories
[lhc/web/wiklou.git] / includes / SpecialCategories.php
1 <?php
2
3 require_once("QueryPage.php");
4
5 class CategoriesPage extends QueryPage {
6
7 function getName() {
8 return "Categories";
9 }
10
11 function isExpensive() {
12 return false;
13 }
14
15 function getSQL() {
16 $NScat = Namespace::getCategory();
17 return "SELECT DISTINCT 'Categories' as type,
18 {$NScat} as namespace,
19 cl_to as title,
20 1 as value
21 FROM categorylinks";
22 }
23
24 function sortDescending() {
25 return false;
26 }
27
28 function formatResult( $skin, $result ) {
29 global $wgLang;
30 return $skin->makeLink( $wgLang->getNsText( NS_CATEGORY ).":".$result->title, $result->title );
31 }
32 }
33
34 function wfSpecialCategories()
35 {
36 list( $limit, $offset ) = wfCheckLimits();
37
38 $cap = new CategoriesPage();
39
40 return $cap->doQuery( $offset, $limit );
41 }
42
43 ?>