Clarifying unorthodox MIME type
[lhc/web/wiklou.git] / includes / SpecialWithoutinterwiki.php
1 <?php
2
3 /**
4 * Special page lists pages without language links
5 *
6 * @package MediaWiki
7 * @addtogroup SpecialPage
8 * @author Rob Church <robchur@gmail.com>
9 */
10 class WithoutInterwikiPage extends PageQueryPage {
11 private $prefix = '';
12
13 function getName() {
14 return 'Withoutinterwiki';
15 }
16
17 function getPageHeader() {
18 global $wgScript, $wgContLang;
19 $prefix = $this->prefix;
20 $t = SpecialPage::getTitleFor( $this->getName() );
21 $align = $wgContLang->isRtl() ? 'left' : 'right';
22
23 $s = '<p>' . wfMsgExt( 'withoutinterwiki-header', array( 'parseinline' ) ) . '</p>';
24 $s .= Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) );
25 $s .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
26 $s .= Xml::hidden( 'title', $t->getPrefixedText() );
27 $s .= Xml::openElement( 'table', array( 'id' => 'nsselect', 'class' => 'withoutinterwiki' ) );
28 $s .= "<tr>
29 <td align='$align'>" .
30 Xml::label( wfMsg( 'allpagesprefix' ), 'wiprefix' ) .
31 "</td>
32 <td>" .
33 Xml::input( 'prefix', 20, htmlspecialchars ( $prefix ), array( 'id' => 'wiprefix' ) ) .
34 "</td>
35 </tr>
36 <tr>
37 <td align='$align'></td>
38 <td>" .
39 Xml::submitButton( wfMsgHtml( 'withoutinterwiki-submit' ) ) .
40 "</td>
41 </tr>";
42 $s .= Xml::closeElement( 'table' );
43 $s .= Xml::closeElement( 'form' );
44 $s .= Xml::closeElement( 'div' );
45 return $s;
46 }
47
48 function sortDescending() {
49 return false;
50 }
51
52 function isExpensive() {
53 return true;
54 }
55
56 function isSyndicated() {
57 return false;
58 }
59
60 function getSQL() {
61 $dbr = wfGetDB( DB_SLAVE );
62 list( $page, $langlinks ) = $dbr->tableNamesN( 'page', 'langlinks' );
63 $prefix = $this->prefix ? "AND page_title LIKE '" . $dbr->escapeLike( $this->prefix ) . "%'" : '';
64 return
65 "SELECT 'Withoutinterwiki' AS type,
66 page_namespace AS namespace,
67 page_title AS title,
68 page_title AS value
69 FROM $page
70 LEFT JOIN $langlinks
71 ON ll_from = page_id
72 WHERE ll_title IS NULL
73 AND page_namespace=" . NS_MAIN . "
74 AND page_is_redirect = 0
75 {$prefix}";
76 }
77
78 function setPrefix( $prefix = '' ) {
79 $this->prefix = $prefix;
80 }
81
82 }
83
84 function wfSpecialWithoutinterwiki() {
85 global $wgRequest;
86 list( $limit, $offset ) = wfCheckLimits();
87 $prefix = $wgRequest->getVal( 'prefix' );
88 $wip = new WithoutInterwikiPage();
89 $wip->setPrefix( $prefix );
90 $wip->doQuery( $offset, $limit );
91 }
92
93