X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSpecialUnusedimages.php;h=57ac474caca640958556c94dd540da497e83bc92;hb=eb1cf2c5b3aed2a7f84bee462b321f3d4eab13c7;hp=a594be04715914721b9718310e037d92f965d8a8;hpb=9b28aa9905556af87942ba3ee4db5fab087fa974;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialUnusedimages.php b/includes/SpecialUnusedimages.php index a594be0471..57ac474cac 100644 --- a/includes/SpecialUnusedimages.php +++ b/includes/SpecialUnusedimages.php @@ -1,52 +1,81 @@ -getSkin(); - - $wgOut->addHTML( wfMsg( "unusedimagestext" ) ); - $top = wfShowingResults( $offset, $limit ); - $wgOut->addHTML( "

{$top}\n" ); +/** + * @package MediaWiki + * @subpackage SpecialPage + */ +class UnusedimagesPage extends QueryPage { - $sl = wfViewPrevNext( $offset, $limit, - $wgLang->specialPage( "Unusedimages" ) ); - $wgOut->addHTML( "
{$sl}\n" ); - - $ins = $wgLang->getNsText ( 6 ) ; - $s = "

    "; - while ( $obj = wfFetchObject( $res ) ) { - $name = $obj->img_name; - $dlink = $sk->makeKnownLink( "{$ins}:{$name}", wfMsg( "imgdesc" ) ); - $ilink = "{$name}"; + function getName() { + return 'Unusedimages'; + } + + function sortDescending() { + return false; + } + function isSyndicated() { return false; } - $d = $wgLang->timeanddate( $obj->img_timestamp, true ); - $u = $obj->img_user; - $ut = $obj->img_user_text; - $c = $obj->img_description; + function getSQL() { + global $wgCountCategorizedImagesAsUsed; + $dbr =& wfGetDB( DB_SLAVE ); + + if ( $wgCountCategorizedImagesAsUsed ) { + extract( $dbr->tableNames( 'page', 'image', 'imagelinks', 'categorylinks' ) ); + + return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description + FROM ((('.$page.' AS I LEFT JOIN '.$categorylinks.' AS L ON I.page_id = L.cl_from) + LEFT JOIN '.$imagelinks.' AS P ON I.page_title = P.il_to) + INNER JOIN '.$image.' AS G ON I.page_title = G.img_name) + WHERE I.page_namespace = '.NS_IMAGE.' AND L.cl_from IS NULL AND P.il_to IS NULL'; + } else { + extract( $dbr->tableNames( 'image','imagelinks' ) ); + + return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description' . + ' FROM '.$image.' LEFT JOIN '.$imagelinks.' ON img_name=il_to WHERE il_to IS NULL '; + } + } + + function formatResult( $skin, $result ) { + global $wgLang, $wgContLang; + $title = Title::makeTitle( NS_IMAGE, $result->title ); + + $imageUrl = htmlspecialchars( Image::imageUrl( $result->title ) ); + $return = + # The 'desc' linking to the image page + '('.$skin->makeKnownLinkObj( $title, wfMsg('imgdesc') ).') ' + # Link to the image itself + . '' . htmlspecialchars( $title->getText() ) . '' + # Last modified date + . ' . . '.$wgLang->timeanddate($result->value) + # Link to username + . ' . . '.$skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text) + # If there is a description, show it + . $skin->commentBlock( $result->img_description ); + + return $return; + } + + function getPageHeader() { + return wfMsg( "unusedimagestext" ); + } - if ( 0 == $u ) { $ul = $ut; } - else { $ul = $sk->makeLink( $wgLang->getNsText(2).":{$ut}", $ut ); } +} - $s .= "
  1. ({$dlink}) {$ilink} . . {$d} . . {$ul}"; +/** + * Entry point + */ +function wfSpecialUnusedimages() { + list( $limit, $offset ) = wfCheckLimits(); + $uip = new UnusedimagesPage(); - if ( "" != $c && "*" != $c ) { $s .= " ({$c})"; } - $s .= "
  2. \n"; - } - wfFreeResult( $res ); - $s .= "
"; - $wgOut->addHTML( $s ); - $wgOut->addHTML( "

{$sl}\n" ); + return $uip->doQuery( $offset, $limit ); } - ?>