* Moving hardcoded styles into CSS.
[lhc/web/wiklou.git] / includes / SpecialDoubleRedirects.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 DoubleRedirectsPage extends PageQueryPage {
19
20 function getName() {
21 return 'DoubleRedirects';
22 }
23
24 function isExpensive( ) { return true; }
25 function isSyndicated() { return false; }
26
27 function getPageHeader( ) {
28 #FIXME : probably need to add a backlink to the maintenance page.
29 return '<p>'.wfMsg("doubleredirectstext")."</p><br />\n";
30 }
31
32 function getSQL() {
33 $dbr =& wfGetDB( DB_SLAVE );
34 extract( $dbr->tableNames( 'page', 'links', 'text' ) );
35
36 $sql = "SELECT pa.page_namespace as ns_a, pa.page_title as title_a,
37 pb.page_namespace as ns_b, pb.page_title as title_b,
38 old_text AS rt
39 FROM $text AS t, $links,$page AS pa,$page AS pb
40 WHERE pa.page_is_redirect=1 AND pb.page_is_redirect=1 AND l_to=pb.page_id
41 AND l_from=pa.page_id
42 AND pb.page_latest=t.old_id" ;
43 return $sql;
44 }
45
46 function getOrder() {
47 return '';
48 }
49
50 function formatResult( $skin, $result ) {
51 global $wgContLang ;
52 $ns = $wgContLang->getNamespaces() ;
53 $from = $skin->makeKnownLink( $ns[$result->ns_a].':'.$result->title_a ,'', 'redirect=no' );
54 $edit = $skin->makeBrokenLink( $ns[$result->ns_a].':'.$result->title_a , "(".wfMsg("qbedit").")" , 'redirect=no');
55 $to = $skin->makeKnownLink( $ns[$result->ns_b].':'.$result->title_b ,'');
56 $content = $result->rt;
57
58 return "$from $edit => $to ($content)";
59 }
60 }
61
62 /**
63 * constructor
64 */
65 function wfSpecialDoubleRedirects() {
66 list( $limit, $offset ) = wfCheckLimits();
67
68 $sdr = new DoubleRedirectsPage();
69
70 return $sdr->doQuery( $offset, $limit );
71
72 }
73 ?>