<?php
/**
+ * Implements Special:Listfiles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
* @file
* @ingroup SpecialPage
*/
-
-/**
- *
- */
+
function wfSpecialListfiles( $par = null ) {
global $wgOut;
$this->mDefaultDirection = false;
}
- $userName = $wgRequest->getText( 'username', $par );
+ $userName = $wgRequest->getText( 'user', $par );
if ( $userName ) {
$nt = Title::newFromText( $userName, NS_USER );
if ( !is_null( $nt ) ) {
if ( !$this->mFieldNames ) {
global $wgMiserMode;
$this->mFieldNames = array(
+ 'thumb' => wfMsg( 'listfiles_thumb' ),
'img_timestamp' => wfMsg( 'listfiles_date' ),
'img_name' => wfMsg( 'listfiles_name' ),
'img_user_text' => wfMsg( 'listfiles_user' ),
$tables = array( 'image' );
$fields = array_keys( $this->getFieldNames() );
$fields[] = 'img_user';
+ $fields[array_search('thumb', $fields)] = 'img_name AS thumb';
$options = $join_conds = array();
# Depends on $wgMiserMode
$tables[] = 'oldimage';
# Need to rewrite this one
- foreach ( $fields as &$field )
- if ( $field == 'count' )
- $field = 'COUNT(oi_archive_name) as count';
+ foreach ( $fields as &$field ) {
+ if ( $field == 'count' ) {
+ $field = 'COUNT(oi_archive_name) AS count';
+ }
+ }
unset( $field );
$dbr = wfGetDB( DB_SLAVE );
if ( $this->mResult->numRows() ) {
$lb = new LinkBatch;
$this->mResult->seek( 0 );
- while ( $row = $this->mResult->fetchObject() ) {
+ foreach ( $this->mResult as $row ) {
if ( $row->img_user ) {
$lb->add( NS_USER, str_replace( ' ', '_', $row->img_user_text ) );
}
function formatValue( $field, $value ) {
global $wgLang;
switch ( $field ) {
+ case 'thumb':
+ $file = wfLocalFile( $value );
+ $thumb = $file->transform( array( 'width' => 180 ) );
+ return $thumb->toHtml( array( 'desc-link' => true ) );
case 'img_timestamp':
return htmlspecialchars( $wgLang->timeanddate( $value, true ) );
case 'img_name':
'id' => 'mw-ilsearch',
) );
}
- $inputForm['username'] = Html::input( 'username', $this->mUserName, 'text', array(
+ $inputForm['username'] = Html::input( 'user', $this->mUserName, 'text', array(
'size' => '40',
'maxlength' => '255',
- 'id' => 'mw-listfiles-username',
+ 'id' => 'mw-listfiles-user',
) );
$s = Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' ) ) .
Xml::fieldset( wfMsg( 'listfiles' ) ) .
- Html::openElement( 'table', array( 'mw-listfiles-table' ) ) .
+ Html::openElement( 'table', array( 'id' => 'mw-listfiles-table' ) ) .
Xml::buildForm( $inputForm, 'table_pager_limit_submit' ) .
$this->getHiddenFields( array( 'limit', 'ilsearch', 'username' ) ) .
Html::closeElement( 'table' ) .
$queries = parent::getPagingQueries();
if ( !is_null( $this->mUserName ) ) {
# Append the username to the query string
- foreach ( $queries as $key => &$query ) {
+ foreach ( $queries as &$query ) {
$query['username'] = $this->mUserName;
}
}