Prevent blocked users from changing page protection levels
[lhc/web/wiklou.git] / includes / SpecialDisambiguations.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 *
10 */
11 require_once('QueryPage.php');
12
13 /**
14 *
15 * @package MediaWiki
16 * @subpackage SpecialPage
17 */
18 class DisambiguationsPage extends PageQueryPage {
19
20 function getName() {
21 return 'Disambiguations';
22 }
23
24 function isExpensive( ) { return true; }
25 function isSyndicated() { return false; }
26
27 function getPageHeader( ) {
28 global $wgUser;
29 $sk = $wgUser->getSkin();
30
31 #FIXME : probably need to add a backlink to the maintenance page.
32 return '<p>'.wfMsg("disambiguationstext", $sk->makeKnownLink(wfMsgForContent('disambiguationspage')) )."</p><br />\n";
33 }
34
35 function getSQL() {
36 $dbr =& wfGetDB( DB_SLAVE );
37 extract( $dbr->tableNames( 'page', 'pagelinks' ) );
38
39 $dp = Title::newFromText(wfMsgForContent("disambiguationspage"));
40 $id = $dp->getArticleId();
41 $dns = $dp->getNamespace();
42 $dtitle = $dbr->addQuotes( $dp->getDBkey() );
43
44 $sql = "SELECT 'Disambiguations' AS type, pa.page_namespace AS namespace,"
45 ." pa.page_title AS title, la.pl_from AS value"
46 ." FROM {$pagelinks} AS lb, {$page} AS pa, {$pagelinks} AS la"
47 ." WHERE lb.pl_namespace = $dns AND lb.pl_title = $dtitle" # disambiguation template
48 ." AND pa.page_id = lb.pl_from"
49 ." AND pa.page_namespace = la.pl_namespace"
50 ." AND pa.page_title = la.pl_title";
51 return $sql;
52 }
53
54 function getOrder() {
55 return '';
56 }
57
58 function formatResult( $skin, $result ) {
59 $title = Title::newFromId( $result->value );
60 $dp = Title::makeTitle( $result->namespace, $result->title );
61
62 $from = $skin->makeKnownLinkObj( $title,'');
63 $edit = $skin->makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
64 $to = $skin->makeKnownLinkObj( $dp,'');
65
66 return "$from $edit => $to";
67 }
68 }
69
70 /**
71 * Constructor
72 */
73 function wfSpecialDisambiguations() {
74 list( $limit, $offset ) = wfCheckLimits();
75
76 $sd = new DisambiguationsPage();
77
78 return $sd->doQuery( $offset, $limit );
79 }
80 ?>