Fixes to input validation and output escaping for user preferences.
[lhc/web/wiklou.git] / includes / SpecialUnusedtemplates.php
1 <?php
2
3 /**
4 * @package MediaWiki
5 * @subpackage Special pages
6 *
7 * @author Rob Church <robchur@gmail.com>
8 * @copyright © 2006 Rob Church
9 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
10 */
11
12 /* */
13 require_once 'QueryPage.php';
14
15 /**
16 * @package MediaWiki
17 * @subpackage SpecialPage
18 */
19
20 class UnusedtemplatesPage extends QueryPage {
21
22 function getName() { return( 'Unusedtemplates' ); }
23 function isExpensive() { return true; }
24 function isSyndicated() { return false; }
25 function sortDescending() { return false; }
26
27 function getSQL() {
28 $dbr =& wfGetDB( DB_SLAVE );
29 extract( $dbr->tableNames( 'page', 'templatelinks' ) );
30 $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title,
31 page_namespace AS namespace, 0 AS value
32 FROM $page
33 LEFT JOIN $templatelinks
34 ON page_namespace = tl_namespace AND page_title = tl_title
35 WHERE page_namespace = 10 AND tl_from IS NULL";
36 return $sql;
37 }
38
39 function formatResult( $skin, $result ) {
40 $title = Title::makeTitle( NS_TEMPLATE, $result->title );
41 $pageLink = $skin->makeKnownLinkObj( $title, '', 'redirect=no' );
42 $wlhLink = $skin->makeKnownLinkObj(
43 Title::makeTitle( NS_SPECIAL, 'Whatlinkshere' ),
44 wfMsgHtml( 'unusedtemplateswlh' ),
45 'target=' . $title->getPrefixedUrl() );
46 return wfSpecialList( $pageLink, $wlhLink );
47 }
48
49 function getPageHeader() {
50 global $wgOut;
51 return $wgOut->parse( wfMsg( 'unusedtemplatestext' ) );
52 }
53
54 }
55
56 function wfSpecialUnusedtemplates() {
57 list( $limit, $offset ) = wfCheckLimits();
58 $utp = new UnusedtemplatesPage();
59 $utp->doQuery( $offset, $limit );
60 }
61
62 ?>