From 4c1b49806b31db7412df8fd42caeb786ce3a1b6d Mon Sep 17 00:00:00 2001 From: Tina Johnson Date: Thu, 19 Mar 2015 21:04:50 +0530 Subject: [PATCH] Display warning message in Special:ListFiles when invalid username entered A warning message is to be displayed when an invalid username is entered in Special:ListFiles. This patch does the same Bug: T72784 Change-Id: I35fef559db812d347af7a313778e25f775e1bfb6 --- includes/specials/SpecialListfiles.php | 11 +++++++++++ languages/i18n/en.json | 1 + languages/i18n/qqq.json | 1 + 3 files changed, 13 insertions(+) diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index 7576c1fdb9..2d79aaf8e8 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -90,9 +90,20 @@ class ImageListPager extends TablePager { if ( $userName !== null && $userName !== '' ) { $nt = Title::newFromText( $userName, NS_USER ); + $user = User::newFromName( $userName, false ); if ( !is_null( $nt ) ) { $this->mUserName = $nt->getText(); } + if ( !$user || ( $user->isAnon() && !User::isIP( $user->getName() ) ) ) { + $this->getOutput()->wrapWikiMsg( + "
\n$1\n
", + array( + 'listfiles-userdoesnotexist', + wfEscapeWikiText( $userName ), + ) + ); + } + } if ( $search !== '' && !$this->getConfig()->get( 'MiserMode' ) ) { diff --git a/languages/i18n/en.json b/languages/i18n/en.json index e511502b11..bbd9455d36 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1451,6 +1451,7 @@ "listfiles-delete": "delete", "listfiles-summary": "This special page shows all uploaded files.", "listfiles_search_for": "Search for media name:", + "listfiles-userdoesnotexist": "User account \"$1\" is not registered.", "imgfile": "file", "listfiles": "File list", "listfiles_thumb": "Thumbnail", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 2bde387c5e..e60020827b 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1618,6 +1618,7 @@ "listfiles-delete": "Text of the delete links next to the entries on [[Special:ListFiles]], surrounded by parentheses.\n{{Identical|Delete}}", "listfiles-summary": "This message is displayed at the top of [[Special:ImageList]] to explain how to use that special page.", "listfiles_search_for": "Input label for the form displayed on [[Special:ListFiles]].", + "listfiles-userdoesnotexist": "This message is displayed on [[Special:ListFiles]] when a invalid username is entered.", "imgfile": "{{Identical|File}}", "listfiles": "Page title and grouping label for the form displayed on [[Special:ListFiles]].\n{{Identical|File list}}", "listfiles_thumb": "{{Identical|Thumbnail}}", -- 2.20.1