From: Bryan Tong Minh Date: Wed, 14 Apr 2010 16:15:14 +0000 (+0000) Subject: Follow-up to r65013: Preserve username when clicking navigation links. X-Git-Tag: 1.31.0-rc.0~37113 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=3a7f20b00bf5d456239047c6925930596f0b6814;p=lhc%2Fweb%2Fwiklou.git Follow-up to r65013: Preserve username when clicking navigation links. --- diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index 227adaa37e..09e61e76cd 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -24,6 +24,7 @@ function wfSpecialListfiles( $par = null ) { class ImageListPager extends TablePager { var $mFieldNames = null; var $mQueryConds = array(); + var $mUserName = null; function __construct( $par = null ) { global $wgRequest, $wgMiserMode; @@ -37,14 +38,15 @@ class ImageListPager extends TablePager { if ( $userName ) { $nt = Title::newFromText( $userName, NS_USER ); if ( !is_null( $nt ) ) { - $this->mQueryConds['img_user_text'] = $nt->getText(); + $this->mUserName = $nt->getText(); + $this->mQueryConds['img_user_text'] = $this->mUserName; } } $search = $wgRequest->getText( 'ilsearch' ); if ( $search != '' && !$wgMiserMode ) { $nt = Title::newFromURL( $search ); - if( $nt ) { + if ( $nt ) { $dbr = wfGetDB( DB_SLAVE ); $this->mQueryConds[] = 'LOWER(img_name)' . $dbr->buildLike( $dbr->anyString(), strtolower( $nt->getDBkey() ), $dbr->anyString() ); @@ -200,4 +202,15 @@ class ImageListPager extends TablePager { function getSortHeaderClass() { return 'listfiles_sort ' . parent::getSortHeaderClass(); } + + function getPagingQueries() { + $queries = parent::getPagingQueries(); + if ( !is_null( $this->mUserName ) ) { + # Append the username to the query string + foreach ( $queries as $key => &$query ) { + $query['username'] = $this->mUserName; + } + } + return $queries; + } }