From 10335b49431302a45b8e3fcae3d6b58a2030fb7f Mon Sep 17 00:00:00 2001 From: Rob Church Date: Wed, 3 May 2006 01:23:10 +0000 Subject: [PATCH] * (bug 5801) Correct handling of underscores in Special:Listusers * Clean up Special:Listusers; add an "(all)" label to the group selection box --- RELEASE-NOTES | 3 +- includes/QueryPage.php | 9 ++++++ includes/SpecialListusers.php | 58 ++++++++++++++++++++--------------- languages/Messages.php | 1 + 4 files changed, 46 insertions(+), 25 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index dd6b33ae90..35070ad712 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -190,7 +190,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Add 'EmailConfirmed' hook * New findhooks.php script to find undocumented hooks. * Silently ignore errors on profiling table update. - +* (bug 5801) Correct handling of underscores in Special:Listusers +* Clean up Special:Listusers; add an "(all)" label to the group selection box == Compatibility == diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 1c9c2506d2..7848c53cbc 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -90,6 +90,15 @@ class QueryPage { return ''; } + /** + * Return title object representing this page + * + * @return Title + */ + function getTitle() { + return Title::makeTitle( NS_SPECIAL, $this->getName() ); + } + /** * Subclasses return an SQL query here. * diff --git a/includes/SpecialListusers.php b/includes/SpecialListusers.php index 46244a374b..a35794c440 100644 --- a/includes/SpecialListusers.php +++ b/includes/SpecialListusers.php @@ -83,33 +83,39 @@ class ListUsersPage extends QueryPage { $title = Title::makeTitle( NS_SPECIAL, 'Listusers' ); $special = htmlspecialchars( $title->getPrefixedDBkey() ); - // form header - $out = '
' . - '' . - wfMsgHtml( 'groups-editgroup-name' ) . ' '; + $out .= wfCloseElement( 'select' ) . ' ';;# . wfElement( 'br' ); + + # Username field + $out .= wfElement( 'label', array( 'for' => 'username' ), wfMsg( 'specialloguserlabel' ) ) . ' '; + $out .= wfElement( 'input', array( 'type' => 'text', 'id' => 'username', 'name' => 'username', + 'value' => $this->requestedUser ) ) . ' '; - $out .= wfMsgHtml( 'specialloguserlabel' ) . ' '; + # Preserve offset and limit + if( $this->offset ) + $out .= wfElement( 'input', array( 'type' => 'hidden', 'name' => 'offset', 'value' => $this->offset ) ); + if( $this->limit ) + $out .= wfElement( 'input', array( 'type' => 'hidden', 'name' => 'limit', 'value' => $this->limit ) ); + + # Submit button and form bottom + $out .= wfElement( 'input', array( 'type' => 'submit', 'value' => wfMsg( 'allpagessubmit' ) ) ); + $out .= wfCloseElement( 'form' ); - // OK button, end of form. - $out .= '
'; - // congratulations the form is now build return $out; } @@ -217,7 +223,11 @@ function wfSpecialListusers( $par = null ) { */ $groupTarget = isset($par) ? $par : $wgRequest->getVal( 'group' ); $slu->requestedGroup = $groupTarget; - $slu->requestedUser = $wgContLang->ucfirst( $wgRequest->getVal('username') ); + + # 'Validate' the username first + $username = $wgRequest->getText( 'username', '' ); + $user = User::newFromName( $username ); + $slu->requestedUser = is_object( $user ) ? $user->getName() : ''; return $slu->doQuery( $offset, $limit ); } diff --git a/languages/Messages.php b/languages/Messages.php index 9a0bfe8296..194e61ddbc 100644 --- a/languages/Messages.php +++ b/languages/Messages.php @@ -1943,6 +1943,7 @@ is collapsed. Others will be hidden by default. 'watchlistall1' => 'all', 'watchlistall2' => 'all', 'namespacesall' => 'all', +'groupsall' => 'all', # E-mail address confirmation 'confirmemail' => 'Confirm E-mail address', -- 2.20.1