3 function wfSpecialUnusedimages()
5 global $wgUser, $wgOut, $wgLang, $wgTitle;
6 global $limit, $offset; # From query string
7 $fname = "wfSpecialUnusedimages";
9 list( $limit, $offset ) = wfCheckLimits();
11 $sql = "SELECT img_name,img_user,img_user_text,img_timestamp,img_description " .
12 "FROM image LEFT JOIN imagelinks ON img_name=il_to WHERE il_to IS NULL " .
13 "ORDER BY img_timestamp LIMIT {$offset}, {$limit}";
14 $res = wfQuery( $sql, $fname );
16 $sk = $wgUser->getSkin();
18 $wgOut->addHTML( wfMsg( "unusedimagestext" ) );
19 $top = wfShowingResults( $offset, $limit );
20 $wgOut->addHTML( "<p>{$top}\n" );
22 $sl = wfViewPrevNext( $offset, $limit,
23 $wgLang->specialPage( "Unusedimages" ) );
24 $wgOut->addHTML( "<br>{$sl}\n" );
26 $ins = $wgLang->getNsText ( 6 ) ;
27 $s = "<ol start=" . ( $offset +
1 ) . ">";
28 while ( $obj = wfFetchObject( $res ) ) {
29 $name = $obj->img_name
;
30 $dlink = $sk->makeKnownLink( "{$ins}:{$name}", wfMsg( "imgdesc" ) );
31 $ilink = "<a href=\"" . wfImageUrl( $name ) . "\">{$name}</a>";
33 $d = $wgLang->timeanddate( $obj->img_timestamp
, true );
35 $ut = $obj->img_user_text
;
36 $c = $obj->img_description
;
38 if ( 0 == $u ) { $ul = $ut; }
39 else { $ul = $sk->makeLink( $wgLang->getNsText(2).":{$ut}", $ut ); }
41 $s .= "<li>({$dlink}) {$ilink} . . {$d} . . {$ul}";
43 if ( "" != $c && "*" != $c ) { $s .= " <em>({$c})</em>"; }
48 $wgOut->addHTML( $s );
49 $wgOut->addHTML( "<p>{$sl}\n" );