* some comments (using # instead of /* */ )
[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 = NS_CATEGORY;
17 $dbr =& wfGetDB( DB_SLAVE );
18 $categorylinks = $dbr->tableName( 'categorylinks' );
19 return "SELECT DISTINCT 'Categories' as type,
20 {$NScat} as namespace,
21 cl_to as title,
22 1 as value
23 FROM $categorylinks";
24 }
25
26 function sortDescending() {
27 return false;
28 }
29
30 function formatResult( $skin, $result ) {
31 global $wgLang;
32 $title = Title::makeTitle( NS_CATEGORY, $result->title );
33 return $skin->makeLinkObj( $title, $title->getText() );
34 }
35 }
36
37 function wfSpecialCategories()
38 {
39 list( $limit, $offset ) = wfCheckLimits();
40
41 $cap = new CategoriesPage();
42
43 return $cap->doQuery( $offset, $limit );
44 }
45
46 ?>