* (bug 1477) hide details of SQL error messages by default
[mediawiki.git] / includes / SpecialUnusedimages.php
blob947ab7a38d684985415623ce8d916da768ca8be0
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /** */
9 require_once("QueryPage.php");
11 /**
12 * @package MediaWiki
13 * @subpackage SpecialPage
15 class UnusedimagesPage extends QueryPage {
17 function getName() {
18 return 'Unusedimages';
21 function sortDescending() {
22 return false;
24 function isSyndicated() { return false; }
26 function getSQL() {
27 $dbr =& wfGetDB( DB_SLAVE );
28 extract( $dbr->tableNames( 'image','imagelinks' ) );
30 return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description' .
31 ' FROM '.$image.' LEFT JOIN '.$imagelinks.' ON img_name=il_to WHERE il_to IS NULL ';
34 function formatResult( $skin, $result ) {
35 global $wgLang, $wgContLang;
36 $title = Title::makeTitle( NS_IMAGE, $result->title );
38 $imageUrl = htmlspecialchars( Image::wfImageUrl( $result->title ) );
39 $return =
40 # The 'desc' linking to the image page
41 '('.$skin->makeKnownLinkObj( $title, wfMsg('imgdesc') ).') '
42 # Link to the image itself
43 . '<a href="' . $imageUrl . '">' . htmlspecialchars( $title->getText() ) . '</a>'
44 # Last modified date
45 . ' . . '.$wgLang->timeanddate($result->value)
46 # Link to username
47 . ' . . '.$skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text);
49 # If there is a description, show it
50 if($result->img_description != '') {
51 $return .= ' <i>(' . $skin->formatComment( $result->img_description ) . ')</i>';
53 return $return;
56 function getPageHeader() {
57 return wfMsg( "unusedimagestext" );
62 /**
63 * Entry point
65 function wfSpecialUnusedimages() {
66 list( $limit, $offset ) = wfCheckLimits();
67 $uip = new UnusedimagesPage();
69 return $uip->doQuery( $offset, $limit );