Use Doxygen @addtogroup instead of phpdoc @package && @subpackage
[lhc/web/wiklou.git] / includes / SpecialUnusedimages.php
1 <?php
2 /**
3 *
4 * @addtogroup SpecialPage
5 */
6
7 /**
8 * @addtogroup SpecialPage
9 */
10 class UnusedimagesPage extends QueryPage {
11
12 function getName() {
13 return 'Unusedimages';
14 }
15
16 function sortDescending() {
17 return false;
18 }
19 function isSyndicated() { return false; }
20
21 function getSQL() {
22 global $wgCountCategorizedImagesAsUsed;
23 $dbr =& wfGetDB( DB_SLAVE );
24
25 if ( $wgCountCategorizedImagesAsUsed ) {
26 list( $page, $image, $imagelinks, $categorylinks ) = $dbr->tableNamesN( 'page', 'image', 'imagelinks', 'categorylinks' );
27
28 return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description
29 FROM ((('.$page.' AS I LEFT JOIN '.$categorylinks.' AS L ON I.page_id = L.cl_from)
30 LEFT JOIN '.$imagelinks.' AS P ON I.page_title = P.il_to)
31 INNER JOIN '.$image.' AS G ON I.page_title = G.img_name)
32 WHERE I.page_namespace = '.NS_IMAGE.' AND L.cl_from IS NULL AND P.il_to IS NULL';
33 } else {
34 list( $image, $imagelinks ) = $dbr->tableNamesN( 'image','imagelinks' );
35
36 return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description' .
37 ' FROM '.$image.' LEFT JOIN '.$imagelinks.' ON img_name=il_to WHERE il_to IS NULL ';
38 }
39 }
40
41 function formatResult( $skin, $result ) {
42 global $wgLang, $wgContLang;
43 $title = Title::makeTitle( NS_IMAGE, $result->title );
44
45 $imageUrl = htmlspecialchars( Image::imageUrl( $result->title ) );
46 $dirmark = $wgContLang->getDirMark(); // To keep text in correct order
47
48 $return =
49 # The 'desc' linking to the image page
50 '('.$skin->makeKnownLinkObj( $title, wfMsg('imgdesc') ).') ' . $dirmark .
51
52 # Link to the image itself
53 '<a href="' . $imageUrl . '">' . htmlspecialchars( $title->getText() ) .
54 '</a> . . ' . $dirmark .
55
56 # Last modified date
57 $wgLang->timeanddate($result->value) . ' . . ' . $dirmark .
58
59 # Link to username
60 $skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ),
61 $result->img_user_text) . $dirmark .
62
63 # If there is a description, show it
64 $skin->commentBlock( $wgContLang->convert( $result->img_description ) );
65
66 return $return;
67 }
68
69 function getPageHeader() {
70 return wfMsg( "unusedimagestext" );
71 }
72
73 }
74
75 /**
76 * Entry point
77 */
78 function wfSpecialUnusedimages() {
79 list( $limit, $offset ) = wfCheckLimits();
80 $uip = new UnusedimagesPage();
81
82 return $uip->doQuery( $offset, $limit );
83 }
84 ?>