Reject titles with %XX hex codes (since these have special meaning in URL links and...
[mediawiki.git] / includes / SpecialUnusedimages.php
blob574899b7bd62303879d36ce474fb1b39765f3f6c
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /** */
9 require_once("QueryPage.php");
11 /**
14 class UnusedimagesPage extends QueryPage {
16 function getName() {
17 return 'Unusedimages';
20 function sortDescending() {
21 return false;
24 function getSQL() {
25 $dbr =& wfGetDB( DB_SLAVE );
26 extract( $dbr->tableNames( 'image','imagelinks' ) );
28 return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description' .
29 ' FROM '.$image.' LEFT JOIN '.$imagelinks.' ON img_name=il_to WHERE il_to IS NULL ';
32 function formatResult( $skin, $result ) {
33 global $wgLang, $wgContLang;
34 $title = Title::makeTitle( NS_IMAGE, $result->title );
36 $imageUrl = htmlspecialchars( Image::wfImageUrl( $result->title ) );
37 $return =
38 # The 'desc' linking to the image page
39 '('.$skin->makeKnownLinkObj( $title, wfMsg('imgdesc') ).') '
40 # Link to the image itself
41 . '<a href="' . $imageUrl . '">' . htmlspecialchars( $title->getText() ) . '</a>'
42 # Last modified date
43 . ' . . '.$wgLang->timeanddate($result->value)
44 # Link to username
45 . ' . . '.$skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text);
47 # If there is a description, show it
48 if($result->img_description != '') {
49 $return .= ' <i>(' . $skin->formatComment( $result->img_description ) . ')</i>';
51 return $return;
54 function getPageHeader() {
55 return wfMsg( "unusedimagestext" );
60 /**
61 * Entry point
63 function wfSpecialUnusedimages() {
64 list( $limit, $offset ) = wfCheckLimits();
65 $uip = new UnusedimagesPage();
67 return $uip->doQuery( $offset, $limit );