/**
*
*/
-function wfSpecialListfiles() {
+function wfSpecialListfiles( $par = null ) {
global $wgOut;
- $pager = new ImageListPager;
+ $pager = new ImageListPager( $par );
$limit = $pager->getForm();
$body = $pager->getBody();
class ImageListPager extends TablePager {
var $mFieldNames = null;
var $mQueryConds = array();
-
- function __construct() {
+
+ function __construct( $par = null ) {
global $wgRequest, $wgMiserMode;
if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) {
$this->mDefaultDirection = true;
} else {
$this->mDefaultDirection = false;
}
+
+ $userName = $wgRequest->getText( 'username', $par );
+ if ( $userName ) {
+ $nt = Title::newFromText( $userName, NS_USER );
+ if ( !is_null( $nt ) ) {
+ $this->mQueryConds['img_user_text'] = $nt->getText();
+ }
+ }
+
$search = $wgRequest->getText( 'ilsearch' );
if ( $search != '' && !$wgMiserMode ) {
$nt = Title::newFromURL( $search );
if( $nt ) {
$dbr = wfGetDB( DB_SLAVE );
- $this->mQueryConds = array( 'LOWER(img_name)' . $dbr->buildLike( $dbr->anyString(),
- strtolower( $nt->getDBkey() ), $dbr->anyString() ) );
+ $this->mQueryConds[] = 'LOWER(img_name)' . $dbr->buildLike( $dbr->anyString(),
+ strtolower( $nt->getDBkey() ), $dbr->anyString() );
}
}
}
function isFieldSortable( $field ) {
- static $sortable = array( 'img_timestamp', 'img_name', 'img_size' );
+ static $sortable = array( 'img_timestamp', 'img_name' );
+ if ( $field == 'img_size' ) {
+ # No index for both img_size and img_user_text
+ return !isset( $this->mQueryConds['img_user_text'] );
+ }
return in_array( $field, $sortable );
}