From f6aae4d1265755d101af9dabe9b46332f31b093c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerg=C5=91=20Tisza?= Date: Thu, 6 Dec 2018 16:18:47 -0800 Subject: [PATCH] Login-related messages should get the URL as a parameter System messages along the lines of "you can't view this page, please log in" get the login link (with returnto parameters) as a HTML string, but sometimes one might want to customize the link on one page without affecting all the other pages so it's nice to have the raw link available as well. Change-Id: Ib71791ea28718455d2925e4424147e87ef901f33 --- includes/OutputPage.php | 6 ++++-- languages/i18n/qqq.json | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 2423315cb9..02e13e74fe 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2847,16 +2847,18 @@ class OutputPage extends ContextSource { $query['returntoquery'] = wfArrayToCgi( $returntoquery ); } } + $title = SpecialPage::getTitleFor( 'Userlogin' ); $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); + $loginUrl = $title->getLinkURL( $query, false, PROTO_RELATIVE ); $loginLink = $linkRenderer->makeKnownLink( - SpecialPage::getTitleFor( 'Userlogin' ), + $title, $this->msg( 'loginreqlink' )->text(), [], $query ); $this->prepareErrorPage( $this->msg( 'loginreqtitle' ) ); - $this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->parse() ); + $this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->params( $loginUrl )->parse() ); # Don't return to a page the user can't read otherwise # we'll end up in a pointless loop diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 142cb9bf25..b98725da17 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -876,13 +876,13 @@ "autoblockedtext": "Text displayed to automatically blocked users.\n\n\"email this user\" should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - the blocking sysop (with a link to his/her userpage)\n* $2 - the reason for the block (in case of autoblocks: {{msg-mw|autoblocker}})\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the blocking sysop's username (plain text, without the link). Use it for GENDER.\n* $5 - the unique numeric identifier of the applied autoblock\n* $6 - the expiry of the block\n* $7 - the intended target of the block (what the blocking user specified in the blocking form)\n* $8 - the timestamp when the block started\nSee also:\n* {{msg-mw|Grouppage-sysop}}\n* {{msg-mw|Blockedtext|notext=1}}\n* {{msg-mw|Systemblockedtext|notext=1}}", "systemblockedtext": "Text displayed to requests blocked by MediaWiki configuration.\n\n\"email this user\" should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - (Unused) A dummy user attributed as the blocker, possibly as a link to a user page.\n* $2 - the reason for the block\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the dummy blocking user's username (plain text, without the link).\n* $5 - A short string indicating the type of system block.\n* $6 - the expiry of the block\n* $7 - the intended target of the block\n* $8 - the timestamp when the block started\nSee also:\n* {{msg-mw|Grouppage-sysop}}\n* {{msg-mw|Blockedtext|notext=1}}\n* {{msg-mw|Autoblockedtext|notext=1}}", "blockednoreason": "Substituted with $2 in the following message if the reason is not given:\n* {{msg-mw|cantcreateaccount-text}}.\n{{Identical|No reason given}}", - "whitelistedittext": "Used as error message. Parameters:\n* $1 - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description\nSee also:\n* {{msg-mw|Nocreatetext}}\n* {{msg-mw|Uploadnologintext}}\n* {{msg-mw|Loginreqpagetext}}", + "whitelistedittext": "Used as error message. Parameters:\n* $1 - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description\n* $2 - an URL to the same\n\nSee also:\n* {{msg-mw|Nocreatetext}}\n* {{msg-mw|Uploadnologintext}}\n* {{msg-mw|Loginreqpagetext}}", "confirmedittext": "Used as error message.", "nosuchsectiontitle": "Used as error message when the user has attempted to edit a nonexistent section.", "nosuchsectiontext": "This message is displayed when a user tries to edit a section that does not exist.", "loginreqtitle": "Used as title of error message.\n\nSee also:\n* {{msg-mw|permissionserrors}}\n{{Identical|Login required}}", "loginreqlink": "Take a look on inflection. Used as $1 in the following messages:\n* {{msg-mw|loginreqpagetext}}\n* {{msg-mw|exception-nologin-text-manual}}\n* {{msg-mw|whitelistedittext}}\n* {{msg-mw|Uploadnologintext}}\n* {{msg-mw|watchlistanontext}}\n* {{msg-mw|confirmemail_needlogin}}\n* {{msg-mw|changeemail-no-info}}\n* {{msg-mw|resetpass-no-info}}\n* {{msg-mw|prefsnologintext2}}\n{{Identical|Log in}}", - "loginreqpagetext": "This message is displayed if an anonymous reader attempts to access a page which is only available to logged-in users.\n\nParameters:\n* $1 - a link to [[Special:UserLogin]] with {{msg-mw|Loginreqlink}} as link description\nSee also:\n* {{msg-mw|Whitelistedittext}}\n* {{msg-mw|Nocreatetext}}\n* {{msg-mw|Uploadnologintext}}", + "loginreqpagetext": "This message is displayed if an anonymous reader attempts to access a page which is only available to logged-in users.\n\nParameters:\n* $1 - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description\n* $2 - an URL to the same\n\nSee also:\n* {{msg-mw|Whitelistedittext}}\n* {{msg-mw|Nocreatetext}}\n* {{msg-mw|Uploadnologintext}}", "accmailtitle": "Page title when temporary password was sent to a user via email.", "accmailtext": "{{doc-important|Do not translate [[User talk:$1|$1]] and Special:ChangePassword.}}\nThe message shown when a temporary password has been sent to the user's email address.\n\nParameters:\n* $1 - username\n* $2 - email address", "newarticle": "{{Identical|New}}", @@ -949,7 +949,7 @@ "hiddencategories": "This message is shown below the edit form, like you have a section ''\"Templates used on this page\"''.\n\nParameters:\n* $1 - number of categories", "edittools": "{{optional}}\nThis text will be shown below edit and upload forms. It can be used to offer special characters not present on most keyboards for copying/pasting, and also often makes them clickable for insertion via a JavaScript. Since these are seen as specific to a wiki, however, this message should not contain anything but an html comment explaining how it should be used once the wiki has been installed.", "edittools-upload": "{{optional}}\nThis text will be shown below upload forms. It will default to the contents of edittools.", - "nocreatetext": "Used as error message.\n\nSee also:\n* {{msg-mw|Nocreate-loggedin}}\n* {{msg-mw|Whitelistedittext}}\n* {{msg-mw|Uploadnologintext}}\n* {{msg-mw|Loginreqpagetext}}", + "nocreatetext": "Used as error message.\n\nParameters:\n* $1 - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description\n* $2 - an URL to the same\n\nSee also:\n* {{msg-mw|Nocreate-loggedin}}\n* {{msg-mw|Whitelistedittext}}\n* {{msg-mw|Uploadnologintext}}\n* {{msg-mw|Loginreqpagetext}}", "nocreate-loggedin": "Used as error message.\n\nSee also:\n* {{msg-mw|Nocreatetext}}", "sectioneditnotsupported-title": "Page title of special page, which presumably appears when someone tries to edit a section, and section editing is disabled. Explanation of section editing on [[meta:Help:Section_editing#Section_editing|meta]].", "sectioneditnotsupported-text": "I think this is the text of an error message, which presumably appears when someone tries to edit a section, and section editing is disabled. Explanation of section editing on [[meta:Help:Section_editing#Section_editing|meta]].", @@ -1804,7 +1804,7 @@ "upload-tryagain": "Used as Submit button text in [[Special:Upload]].\n\nSee also:\n* {{msg-mw|Uploaderror|section header}}\n* {{msg-mw|ignorewarning|button text}}\n* {{msg-mw|reuploaddesc|button text}}", "upload-tryagain-nostash": "Used as Submit button text in [[Special:Upload]] when the upload could not be stashed & the file needs to be reuploaded.\n\nSee also:\n* {{msg-mw|Uploaderror|section header}}\n* {{msg-mw|ignorewarning|button text}}\n* {{msg-mw|reuploaddesc|button text}}", "uploadnologin": "Used as title of the error message {{msg-mw|Uploadnologintext}}.\n{{Identical|Not logged in}}", - "uploadnologintext": "Used as error message.\n\nThe title for this message is {{msg-mw|Uploadnologin}}.\n\nParameters:\n* $1 - link text {{msg-mw|Loginreqlink}}. The link points to [[Special:UserLogin]].\nSee also:\n* {{msg-mw|Whitelistedittext}}\n* {{msg-mw|Nocreatetext}}\n* {{msg-mw|Loginreqpagetext}}", + "uploadnologintext": "Used as error message.\n\nThe title for this message is {{msg-mw|Uploadnologin}}.\n\nParameters:\n* $1 - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description\n* $2 - an URL to the same\n\nSee also:\n* {{msg-mw|Whitelistedittext}}\n* {{msg-mw|Nocreatetext}}\n* {{msg-mw|Loginreqpagetext}}", "upload_directory_missing": "Parameters:\n* $1 - directory name", "upload_directory_read_only": "Parameters:\n* $1 - directory name", "uploaderror": "Used as section header in [[Special:Upload]].\n\nSee also:\n* {{msg-mw|upload-tryagain|Submit text}}", -- 2.20.1