5 * @subpackage SpecialPage
11 * @subpackage SpecialPage
13 class DisambiguationsPage
extends PageQueryPage
{
16 return 'Disambiguations';
19 function isExpensive( ) { return true; }
20 function isSyndicated() { return false; }
22 function getPageHeader( ) {
24 $sk = $wgUser->getSkin();
26 return '<p>'.wfMsg('disambiguationstext', $sk->makeKnownLink(wfMsgForContent('disambiguationspage')) )."</p><br />\n";
30 $dbr =& wfGetDB( DB_SLAVE
);
31 extract( $dbr->tableNames( 'page', 'pagelinks', 'templatelinks' ) );
33 $dp = Title
::newFromText(wfMsgForContent('disambiguationspage'));
34 $id = $dp->getArticleId();
35 $dns = $dp->getNamespace();
36 $dtitle = $dbr->addQuotes( $dp->getDBkey() );
38 if($dns != NS_TEMPLATE
) {
39 # FIXME we assume the disambiguation message is a template but
40 # the page can potentially be from another namespace :/
41 wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n");
44 $sql = "SELECT 'Disambiguations' AS \"type\", pa.page_namespace AS namespace,"
45 ." pa.page_title AS title, la.pl_from AS value"
46 ." FROM {$templatelinks} AS lb, {$page} AS pa, {$pagelinks} AS la"
47 ." WHERE lb.tl_namespace = $dns AND lb.tl_title = $dtitle" # disambiguation template
48 .' AND pa.page_id = lb.tl_from'
49 .' AND pa.page_namespace = la.pl_namespace'
50 .' AND pa.page_title = la.pl_title';
58 function formatResult( $skin, $result ) {
60 $title = Title
::newFromId( $result->value
);
61 $dp = Title
::makeTitle( $result->namespace, $result->title
);
63 $from = $skin->makeKnownLinkObj( $title,'');
64 $edit = $skin->makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
65 $arr = $wgContLang->getArrow();
66 $to = $skin->makeKnownLinkObj( $dp,'');
68 return "$from $edit $arr $to";
75 function wfSpecialDisambiguations() {
76 list( $limit, $offset ) = wfCheckLimits();
78 $sd = new DisambiguationsPage();
80 return $sd->doQuery( $offset, $limit );