Localisation updates for core messages from Betawiki (2008-05-18 15:17 CEST)
[lhc/web/wiklou.git] / includes / SpecialWithoutinterwiki.php
1 <?php
2
3 /**
4 * Special page lists pages without language links
5 *
6 * @addtogroup SpecialPage
7 * @author Rob Church <robchur@gmail.com>
8 */
9 class WithoutInterwikiPage extends PageQueryPage {
10 private $prefix = '';
11
12 function getName() {
13 return 'Withoutinterwiki';
14 }
15
16 function getPageHeader() {
17 global $wgScript, $wgMiserMode;
18
19 # Do not show useless input form if wiki is running in misermode
20 if( $wgMiserMode ) {
21 return '';
22 }
23
24 $prefix = $this->prefix;
25 $t = SpecialPage::getTitleFor( $this->getName() );
26
27 return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
28 Xml::openElement( 'fieldset' ) .
29 Xml::element( 'legend', null, wfMsg( 'withoutinterwiki-legend' ) ) .
30 Xml::hidden( 'title', $t->getPrefixedText() ) .
31 Xml::inputLabel( wfMsg( 'allpagesprefix' ), 'prefix', 'wiprefix', 20, $prefix ) . ' ' .
32 Xml::submitButton( wfMsg( 'withoutinterwiki-submit' ) ) .
33 Xml::closeElement( 'fieldset' ) .
34 Xml::closeElement( 'form' );
35 }
36
37 function sortDescending() {
38 return false;
39 }
40
41 function isExpensive() {
42 return true;
43 }
44
45 function isSyndicated() {
46 return false;
47 }
48
49 function getSQL() {
50 $dbr = wfGetDB( DB_SLAVE );
51 list( $page, $langlinks ) = $dbr->tableNamesN( 'page', 'langlinks' );
52 $prefix = $this->prefix ? "AND page_title LIKE '" . $dbr->escapeLike( $this->prefix ) . "%'" : '';
53 return
54 "SELECT 'Withoutinterwiki' AS type,
55 page_namespace AS namespace,
56 page_title AS title,
57 page_title AS value
58 FROM $page
59 LEFT JOIN $langlinks
60 ON ll_from = page_id
61 WHERE ll_title IS NULL
62 AND page_namespace=" . NS_MAIN . "
63 AND page_is_redirect = 0
64 {$prefix}";
65 }
66
67 function setPrefix( $prefix = '' ) {
68 $this->prefix = $prefix;
69 }
70
71 }
72
73 function wfSpecialWithoutinterwiki() {
74 global $wgRequest, $wgContLang, $wgCapitalLinks;
75 list( $limit, $offset ) = wfCheckLimits();
76 if( $wgCapitalLinks ) {
77 $prefix = $wgContLang->ucfirst( $wgRequest->getVal( 'prefix' ) );
78 } else {
79 $prefix = $wgRequest->getVal( 'prefix' );
80 }
81 $wip = new WithoutInterwikiPage();
82 $wip->setPrefix( $prefix );
83 $wip->doQuery( $offset, $limit );
84 }