5 * @subpackage SpecialPage
9 require_once ( "SpecialFilelist.php" ) ;
11 function wfSpecialImagelist( $par, $specialPage ) {
12 wfSpecialFilelist ( $par , $specialPage , false ) ;
15 # _____________________________________________
16 # The rest of this file is obsolete
17 # _____________________________________________
23 function OLD_wfSpecialImagelist() {
24 global $wgUser, $wgOut, $wgLang, $wgRequest, $wgMiserMode;
26 $sort = $wgRequest->getVal( 'sort' );
27 $wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
28 $dbr =& wfGetDB( DB_SLAVE
);
29 $image = $dbr->tableName( 'image' );
30 $sql = "SELECT img_size,img_name,img_user,img_user_text," .
31 "img_description,img_timestamp FROM $image";
33 $byname = wfMsg( "byname" );
34 $bydate = wfMsg( "bydate" );
35 $bysize = wfMsg( "bysize" );
37 if ( !$wgMiserMode && !empty( $wpIlMatch ) ) {
38 $nt = Title
::newFromUrl( $wpIlMatch );
40 $m = $dbr->strencode( strtolower( $nt->getDBkey() ) );
41 $m = str_replace( "%", "\\%", $m );
42 $m = str_replace( "_", "\\_", $m );
43 $sql .= " WHERE LCASE(img_name) LIKE '%{$m}%'";
46 if ( "bysize" == $sort ) {
47 $sql .= " ORDER BY img_size DESC";
49 } else if ( "byname" == $sort ) {
50 $sql .= " ORDER BY img_name";
54 $sql .= " ORDER BY img_timestamp DESC";
57 list( $limit, $offset ) = wfCheckLimits( 50 );
59 $lt = wfMsg( 'imagelistall' );
61 $lt = $wgLang->formatNum( "${limit}" );
62 $sql .= " LIMIT {$limit}";
64 $wgOut->addHTML( "<p>" . wfMsg( "imglegend" ) . "</p>\n" );
66 $text = wfMsg( "imagelisttext",
67 "<strong>{$lt}</strong>", "<strong>{$st}</strong>" );
68 $wgOut->addHTML( "<p>{$text}\n</p>" );
70 $sk = $wgUser->getSkin();
71 $sub = wfMsg( "ilsubmit" );
72 $titleObj = Title
::makeTitle( NS_SPECIAL
, "Imagelist" );
73 $action = $titleObj->escapeLocalURL( "sort={$sort}&limit={$limit}" );
75 if ( !$wgMiserMode ) {
76 $wgOut->addHTML( "<form id=\"imagesearch\" method=\"post\" action=\"" .
78 "<input type='text' size='20' name=\"wpIlMatch\" value=\"" .
79 htmlspecialchars( $wpIlMatch ) . "\" /> " .
80 "<input type='submit' name=\"wpIlSubmit\" value=\"{$sub}\" /></form>" );
82 $nums = array( 50, 100, 250, 500 );
83 $here = Title
::makeTitle( NS_SPECIAL
, 'Imagelist' );
87 foreach ( $nums as $num ) {
88 if ( ! $first ) { $fill .= " | "; }
91 $fill .= $sk->makeKnownLinkObj( $here, $wgLang->formatNum( $num ),
92 "sort=byname&limit={$num}&wpIlMatch=" . urlencode( $wpIlMatch ) );
94 $text = wfMsg( "showlast", $fill, $byname );
95 $wgOut->addHTML( "<p>{$text}<br />\n" );
99 foreach ( $nums as $num ) {
100 if ( ! $first ) { $fill .= " | "; }
103 $fill .= $sk->makeKnownLinkObj( $here, $wgLang->formatNum( $num ),
104 "sort=bysize&limit={$num}&wpIlMatch=" . urlencode( $wpIlMatch ) );
106 $text = wfMsg( "showlast", $fill, $bysize );
107 $wgOut->addHTML( "{$text}<br />\n" );
111 foreach ( $nums as $num ) {
112 if ( ! $first ) { $fill .= " | "; }
115 $fill .= $sk->makeKnownLinkObj( $here, $wgLang->formatNum( $num ),
116 "sort=bydate&limit={$num}&wpIlMatch=" . urlencode( $wpIlMatch ) );
118 $text = wfMsg( "showlast", $fill, $bydate );
119 $wgOut->addHTML( "{$text}</p>\n<p>" );
121 $res = $dbr->query( $sql, "wfSpecialImagelist" );
122 while ( $s = $dbr->fetchObject( $res ) ) {
123 $name = $s->img_name
;
124 $ut = $s->img_user_text
;
125 if ( 0 == $s->img_user
) {
128 $ul = $sk->makeLinkObj( Title
::makeTitle( NS_USER
, $ut ), $ut );
131 $ilink = "<a href=\"" . htmlspecialchars( Image
::imageUrl( $name ) ) .
132 "\">" . strtr(htmlspecialchars( $name ), '_', ' ') . "</a>";
134 $nb = wfMsg( "nbytes", $wgLang->formatNum( $s->img_size
) );
136 $sk->makeKnownLinkObj( Title
::makeTitle( NS_IMAGE
, $name ),
137 wfMsg( "imgdesc" ) ) .
138 ") {$ilink} . . {$nb} . . {$ul} . . " .
139 $wgLang->timeanddate( $s->img_timestamp
, true );
141 $l .= $sk->commentBlock( $s->img_description
);
142 $wgOut->addHTML( "{$l}<br />\n" );
144 $wgOut->addHTML( "</p>" );
145 $dbr->freeResult( $res );