-<?
+<?php
-function wfSpecialUnusedimages()
-{
+function wfSpecialUnusedimages() {
global $wgUser, $wgOut, $wgLang, $wgTitle;
- global $limit, $offset; # From query string
- $limit = $_REQUEST["limit"];
- $offset = $_REQUEST["offset"];
-
$fname = "wfSpecialUnusedimages";
list( $limit, $offset ) = wfCheckLimits();
+ $dbr =& wfGetDB( DB_SLAVE );
+ extract( $dbr->tableNames( 'image','imagelinks' ) );
$sql = "SELECT img_name,img_user,img_user_text,img_timestamp,img_description " .
- "FROM image LEFT JOIN imagelinks ON img_name=il_to WHERE il_to IS NULL " .
- "ORDER BY img_timestamp LIMIT {$offset}, {$limit}";
- $res = wfQuery( $sql, DB_READ, $fname );
+ "FROM $image LEFT JOIN $imagelinks ON img_name=il_to WHERE il_to IS NULL " .
+ "ORDER BY img_timestamp ".$dbr->limitResult($limit,$offset);
+ $res = $dbr->query( $sql, $fname );
$sk = $wgUser->getSkin();
$sl = wfViewPrevNext( $offset, $limit,
$wgLang->specialPage( "Unusedimages" ) );
- $wgOut->addHTML( "<br>{$sl}\n" );
+ $wgOut->addHTML( "<br />{$sl}</p>\n" );
$ins = $wgLang->getNsText ( 6 ) ;
- $s = "<ol start=" . ( $offset + 1 ) . ">";
- while ( $obj = wfFetchObject( $res ) ) {
+ $s = "<ol start='" . ( $offset + 1 ) . "'>";
+ while ( $obj = $dbr->fetchObject( $res ) ) {
$name = $obj->img_name;
$dlink = $sk->makeKnownLink( "{$ins}:{$name}", wfMsg( "imgdesc" ) );
- $ilink = "<a href=\"" . wfImageUrl( $name ) . "\">{$name}</a>";
+ $ilink = "<a href=\"" . Image::wfImageUrl( $name ) . "\">{$name}</a>";
$d = $wgLang->timeanddate( $obj->img_timestamp, true );
$u = $obj->img_user;
if ( "" != $c && "*" != $c ) { $s .= " <em>({$c})</em>"; }
$s .= "</li>\n";
}
- wfFreeResult( $res );
- $s .= "</ol>";
+ $dbr->freeResult( $res );
+ $s .= "</ol>\n\n";
$wgOut->addHTML( $s );
- $wgOut->addHTML( "<p>{$sl}\n" );
+ $wgOut->addHTML( "<p>{$sl}</p>\n" );
}
?>