*/
class SpecialListFiles extends IncludableSpecialPage {
-
public function __construct() {
parent::__construct( 'Listfiles' );
}
$search = $this->getRequest()->getText( 'ilsearch', '' );
}
- $pager = new ImageListPager( $this->getContext(), $userName, $search, $this->including() );
+ $pager = new ImageListPager(
+ $this->getContext(),
+ $userName,
+ $search,
+ $this->including()
+ );
if ( $this->including() ) {
$html = $pager->getBody();
}
$this->getOutput()->addHTML( $html );
}
+
+ protected function getGroupName() {
+ return 'media';
+ }
}
/**
var $mSearch = '';
var $mIncluding = false;
- function __construct( IContextSource $context, $userName = null, $search = '', $including = false ) {
+ function __construct( IContextSource $context, $userName = null, $search = '',
+ $including = false
+ ) {
global $wgMiserMode;
$this->mIncluding = $including;
if ( $search != '' && !$wgMiserMode ) {
$this->mSearch = $search;
$nt = Title::newFromURL( $this->mSearch );
+
if ( $nt ) {
$dbr = wfGetDB( DB_SLAVE );
$this->mQueryConds[] = 'LOWER(img_name)' .
'img_user_text' => $this->msg( 'listfiles_user' )->text(),
'img_description' => $this->msg( 'listfiles_description' )->text(),
);
- if( !$wgMiserMode ) {
+ if ( !$wgMiserMode ) {
$this->mFieldNames['count'] = $this->msg( 'listfiles_count' )->text();
}
}
+
return $this->mFieldNames;
}
# No index for both img_size and img_user_text
return !isset( $this->mQueryConds['img_user_text'] );
}
+
return in_array( $field, $sortable );
}
$tables = array( 'image' );
$fields = array_keys( $this->getFieldNames() );
$fields[] = 'img_user';
- $fields[array_search('thumb', $fields)] = 'img_name AS thumb';
+ $fields[array_search( 'thumb', $fields )] = 'img_name AS thumb';
$options = $join_conds = array();
# Depends on $wgMiserMode
- if( isset( $this->mFieldNames['count'] ) ) {
+ if ( isset( $this->mFieldNames['count'] ) ) {
$tables[] = 'oldimage';
# Need to rewrite this one
unset( $field );
$dbr = wfGetDB( DB_SLAVE );
- if( $dbr->implicitGroupby() ) {
+ if ( $dbr->implicitGroupby() ) {
$options = array( 'GROUP BY' => 'img_name' );
} else {
$columnlist = preg_grep( '/^img/', array_keys( $this->getFieldNames() ) );
}
$join_conds = array( 'oldimage' => array( 'LEFT JOIN', 'oi_name = img_name' ) );
}
+
return array(
- 'tables' => $tables,
- 'fields' => $fields,
- 'conds' => $this->mQueryConds,
- 'options' => $options,
+ 'tables' => $tables,
+ 'fields' => $fields,
+ 'conds' => $this->mQueryConds,
+ 'options' => $options,
'join_conds' => $join_conds
);
}
case 'thumb':
$file = wfLocalFile( $value );
$thumb = $file->transform( array( 'width' => 180, 'height' => 360 ) );
+
return $thumb->toHtml( array( 'desc-link' => true ) );
case 'img_timestamp':
- return htmlspecialchars( $this->getLanguage()->userTimeAndDate( $value, $this->getUser() ) );
+ $timeAndDate = $this->getLanguage()->userTimeAndDate( $value, $this->getUser() );
+ return htmlspecialchars( $timeAndDate );
case 'img_name':
static $imgfile = null;
- if ( $imgfile === null ) $imgfile = $this->msg( 'imgfile' )->text();
+ if ( $imgfile === null ) {
+ $imgfile = $this->msg( 'imgfile' )->text();
+ }
// Weird files can maybe exist? Bug 22227
$filePage = Title::makeTitleSafe( NS_FILE, $value );
- if( $filePage ) {
- $link = Linker::linkKnown( $filePage, htmlspecialchars( $filePage->getText() ) );
+ if ( $filePage ) {
+ $link = Linker::linkKnown(
+ $filePage,
+ htmlspecialchars( $filePage->getText() )
+ );
$download = Xml::element( 'a',
array( 'href' => wfLocalFile( $filePage )->getURL() ),
$imgfile
);
$download = $this->msg( 'parentheses' )->rawParams( $download )->escaped();
+
return "$link $download";
} else {
return htmlspecialchars( $value );
} else {
$link = htmlspecialchars( $value );
}
+
return $link;
case 'img_size':
return htmlspecialchars( $this->getLanguage()->formatSize( $value ) );
$inputForm = array();
$inputForm['table_pager_limit_label'] = $this->getLimitSelect();
if ( !$wgMiserMode ) {
- $inputForm['listfiles_search_for'] = Html::input( 'ilsearch', $this->mSearch, 'text',
+ $inputForm['listfiles_search_for'] = Html::input(
+ 'ilsearch',
+ $this->mSearch,
+ 'text',
array(
- 'size' => '40',
+ 'size' => '40',
'maxlength' => '255',
- 'id' => 'mw-ilsearch',
- ) );
+ 'id' => 'mw-ilsearch',
+ )
+ );
}
$inputForm['username'] = Html::input( 'user', $this->mUserName, 'text', array(
- 'size' => '40',
+ 'size' => '40',
'maxlength' => '255',
- 'id' => 'mw-listfiles-user',
+ 'id' => 'mw-listfiles-user',
) );
+
return Html::openElement( 'form',
- array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' ) ) .
+ array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' )
+ ) .
Xml::fieldset( $this->msg( 'listfiles' )->text() ) .
Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
Xml::buildForm( $inputForm, 'table_pager_limit_submit' ) .
$query['user'] = $this->mUserName;
}
}
+
return $queries;
}
if ( !isset( $queries['user'] ) && !is_null( $this->mUserName ) ) {
$queries['user'] = $this->mUserName;
}
+
return $queries;
}