Commit graph

10 commits

Author SHA1 Message Date
Bryan Davis
b8332e9916 Support language fallbacks for Special:MyLanguage
Add fallback lookup based on the interface language to
Special:MyLanguage. Lookup order:

  <user lang> -> <explicit lang> -> <fallback lang(s)> -> <base>

Example when the user's lang is arz:

  arz -> <explicit lang> -> ar -> en -> <base>

Bug: T50292
Change-Id: I245cab71fdd4b4585f86dde808493cd69841b09a
2017-10-30 00:07:21 +00:00
Florian
29cac40c82 SpecialMyLanguage: Use page language instead of wiki language for redirect target check
With the change, named in Follow up, it's possible for site owners to
allow to change the language of a page using a special page.
Theoretically, any page can have another or a different page language,
depending on, if the language was changed using the special page or not.
For Special:MyLanguage it isn't enough anymore to check, if the current
user language is the same as the default content language. It has to
check, if the page language (which can potentionally differ from the
default content language) is the same as the user language.

The problem:
If content language is the same as the user language, Special:MyLanguage
currently redirects to the "base page" of a page ("Testpage" instead of
"Testpage/de"), no matter, if the page language of the base part is
another one as the default content language. This can result in the
problem, that Special:MyLanguage redirects to a page, that has a
different language as the user language, even if a subpage with the user
language code exists. This is fixed with this change.

Follow up: I0f82b146fbe948f917c1

Bug: T121834
Change-Id: Ic9fc9049813c153111829d37a2c248dc0768e0fb
2016-08-23 12:57:37 +00:00
csteipp
1461ff2ecf SECURITY: Make Special:MyPage and friends fake redirect to prevent info leak
This prevents a malicious person from using external resources on their
website to cause the victim's web browser to load
Special:MyPage -> User:Username, and then looking it up in the page hit
statistics in order to correlate IPs from the malicious person's server
log, with usernames on wiki.

This feature can be disabled with $wgHideIdentifiableRedirects.

Bug: T109724
Signed-off-by: Chad Horohoe <chadh@wikimedia.org>
Change-Id: Ia0e742dc92c77af4832174dfa24c6dcaa6ee80e9
2015-12-18 01:46:03 -08:00
Timo Tijhof
f95dc8faff specials: Clean up redirect special pages ($subpage can be null)
$subpage being null is clearly documented in SpecialPage::run,
SpecialPage::execute, and most special page subclasses.

But all the redirect subclasses only copied part of the typehint,
making it look like it's always a string.

For SpecialMyLanguage, follows-up b1853bba0. Don't cast null to
empty string, and don't bother giving Title::newFromText an empty
string only to bail out with null again.

Also:
* Add visibility 'public' where missing.
* Add or correct relevant documentation comments.
* In SpecialMyRedirectPages, handle error first and avoid having
  final return inside a conditional; Remove redunant 'else'.

Change-Id: Ie3543f44011832b198bb3d3e32528b6a2868dee1
2015-04-13 20:10:00 +01:00
Niklas Laxström
b1853bba02 Do not pass null to Title::newFromText in Special:MyLanguage
This currently breaks phpunit integration test in Translate.

Change-Id: Ibdc04e9e20c0264076d7a8766ac9a4826033371e
2015-04-07 10:49:43 +00:00
Erik Bernhardson
5248dfa7ad Gracefully handle redirects in SpecialMyLanguage
Currently if you have a link that goes through SpecialMyLanguage
and that page is redirected you will no longer get it in your
language. This adjusts to follow redirects before resolving language.

Bug: T58036
Change-Id: I88fcfeb86d81a33a8eccc6119693c2ecb857afb2
2015-02-26 16:22:45 -08:00
Kunal Mehta
53dffe6265 SpecialMyLanguage: Use Config instead of globals
Change-Id: I30291d1e062ccaa7f3d05697c2b4ade3ac4ef11d
2014-08-03 17:11:17 -07:00
Aaron Schulz
868338b8cb Fixed fatal error for invalid codes in Special:MyLanguage
* Fixes "Exception from line 339 of languages/Language.php: Language::isValidBuiltInCode must be passed a string, boolean given"

Change-Id: I546998fe89261f3012fa404578d5684c7ddf59a5
2014-07-30 11:16:36 -07:00
umherirrender
768ac15c70 Cleanup some docs (includes/[s-z])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: Ie419638e909a47aa72a274043604247830ee1a81
2014-07-24 19:43:44 +02:00
Max Semenik
062cfffeb2 Integrate Special:MyLanguage from the Translate extension
In practice, this means the MediaWiki canonical way to uniquely and
humanly name translation pages on a multilingual wiki becomes
$source_page_title + '/' + $target_language_code, irrespective of
the enabling of the navigational subtitle and of the relative
titles (..) syntax for linking and transcluding, which are unrelated
and keep being controlled by $wgNamespacesWithSubpages.

This syntax has been prevalent on most wikis including mediawiki.org
since at least 2009, also thanks to #titleparts in ParserFunctions.

The part of the special page's functionality that made links to it red
when destination page wasn't present will be integrated with a follow-up
commit because they require more performance work.

I'm also including some Title tests that were written for testing the
redlinking functionality but are useful in general.

Bug: 66762
Change-Id: I520077c931431b5919e0208f75c20b5b25f3159d
2014-07-22 11:33:15 -07:00