Commit graph

1145 commits

Author SHA1 Message Date
Krinkle
970a7ac8a8 (bug 27916) Don't prefix wgServer in mw.util.wikiGetlink
The check is not needed, if wgArticlePath is undefined there's probably a much bigger issue.

The wgServer doesn't need to be prefixed to the link (if someone really needs it (ie. external tools using the script and somehow defining wgServer in mw.config) they can surely prefix wgServer themselfs.

In most if not all cases this is used to create anchor tags, which are interprated by browsers relatively to the current window location and in some browsers it even auto-prefixes the current environment when setting the href/src attribute.

I did a grep search for "wikiGetlink" in /trunk (including ./extensions), there was one usage that assumed the wgServer prefix. Turned out that was actually a workaround untill this bug was fixed. I remove that workaround ( in mw.util.isMainPage).
2011-05-01 19:20:31 +00:00
Happy-melon
c80535ae10 Stop stubbing $wgLang and $wgContLang. There are no major code paths which do not call either $wgLang or $wgContLang at least once. All index.php calls unstub $wgContLang from MediaWiki::parseTitle() except in the edgecase of viewing pages referenced only by "curid=123", and since those will end up calling OutputPage::output() they will eventually be unstubbed at some point as well. All calls through load.php unstub $wgLang in ResourceLoaderContext::getLanguage() from ResouceLoader::respond() --> ResourceLoader::preloadModuleInfo(). All calls through api.php unstub $wgContLang in ApiResult::cleanUpUTF8() from ApiMain::printResult(). 2011-04-23 15:19:38 +00:00
Leo Koppelkamm
77e1e201f6 Followup r86088 per CR: Move month array builder into language; use mw.config.get(); Fix rowspans and some cleanup 2011-04-18 12:54:28 +00:00
Sam Reed
700d35ed29 Revert r85536 pending a better fix 2011-04-16 00:23:07 +00:00
Brion Vibber
8ee5e02054 Followup to r85706 and friends: now that Math messages have been moved to extension, move out the settings list and constants.
* MW_MATH_* constants are now defined in Math extension
* Language::getMathNames() is removed
* mathNames section in message files is removed
* A hardcoded preference override in refreshLinks moved to MaintenanceRefreshLinksInit hook
2011-04-09 19:57:35 +00:00
Chad Horohoe
e647d79ce9 Merge from 1.17wmf1: r84259 2011-04-06 13:50:45 +00:00
Tim Starling
7bb50c630a The beginnings of HipHop compiled mode support. It works now for parser cache hits.
* Work around HipHop issue 314 (volatile broken) and issue 308 (no compilation detection) by adding some large and ugly compilation detection code to WebStart.php and doMaintenance.php.
* Provide an MW_COMPILED constant which can be used to detect compiled mode throughout the codebase.
* Introduced wfIsHipHop(), which detects either compiled or interpreted mode. Used this to work around unusual eval() return value in eval.php.
* Work around lack of ini_get() in Maintenance.php, by duplicating wfIsHipHop(). 
* In Maintenance::shouldExecute(), accept "include" as an inclusion function name, since all kinds of inclusion give this string in HipHop.
* Introduced new class MWInit, which provides some static functions in the pre-autoloader environment.
* Introduced MWInit::compiledPath(), which provides a relative path for invoking a compiled file, and MWInit::interpretedPath(), which provides an absolute path for interpreting a PHP file. Used these new functions in the appropriate places.
* When we are running compiled code, don't include files which would generate duplicate class, function or constant definitions. Documented the new requirements on the contents of Defines.php and UtfNormalDefines.php.
* In HipHop compiled mode, it's not possible to have executable code in the same file as a class definition. 
  ** Moved MimeMagic initialisation to the constructor.
  ** Moved Namespace.php global variable initialisation to Setup.php.
  ** Moved MemcachedSessions.php initialisation to the caller in GlobalFunctions.php.
  ** Moved Sanitizer.php constants and global variables to static class members. Introduced an accessor function for the attribs regex, as a new place to put code formerly at file level. 
  ** Moved Language.php initialisation of $wgLanguageNames to Language::getLanguageNames(). Removed the global variable, marked "private" since forever.

* In two places: don't use error_log() with type=3 to append to a file, HipHop doesn't support it. Use file_put_contents() with FILE_APPEND instead.
* Work around the terrible breakage of class_exists() by using MWInit::classExists() instead in various places. In WebInstaller::getPageByName(), the class_exists() was marked with a fixme comment already, so I replaced it with an autoloader solution.
2011-04-04 12:59:55 +00:00
Sam Reed
e9b2da610b Fixup some ambiguously defined variables
Cast a substr back to int
2011-03-30 12:04:54 +00:00
Happy-melon
41ca27d283 Revert r84706, r84709 (UtfNormal rewrite). Clearly more work needed to get these in line with our coding standards. 2011-03-27 12:21:45 +00:00
Sam Reed
77e28f5385 Commiting simplest hack fix for strict errors
Instantiating new instance of UtfNormal

Will probably nee tidying up later, if we have some other instance we can normally use
2011-03-24 21:21:15 +00:00
Aaron Schulz
45c5c8fdd6 * Follow-up for r84660:
** Don't regress in terms of making sure truncating and adding an ellipses won't make the string longer (or equally long)
** Fixed ellipsis adjustment check in truncateHtml()
* Other:
** Made removeBadCharLast/removeBadCharFirst not give warnings on empty string input
** Removed tidy call in truncateHtml, slower and adds some garbage
** Code comment tweaks
2011-03-24 18:39:30 +00:00
Brian Wolff
7eb1053ee4 (follow-up r84660) Per comments, make truncate return original string instead of ellipsis if string is smaller then length and ellipsis is not. 2011-03-24 03:39:21 +00:00
Brian Wolff
2d64c69910 (follow-up 79778) Make $wgLang->truncate function consider the length of the ... (ellipsis message) in the truncation length.
The length of this message varries by localization, so the previous solution of telling truncate to truncate 5 bytes
less than needed is not good since this will be too little or too much.

Updated places where its used. Some places I left as is, as it looked like the new behaviour would work fine for them to.
(for example, the autosummary feature - it was cutting off at 200 bytes, which is no where near 250 limit, so I presume that
was for asethic reasons rather then to fit as much in before the db limit).

Will do another commit for extension callers in a moment.
2011-03-24 02:54:11 +00:00
Happy-melon
f8ab1088c2 Follow-ups to r84258. 2011-03-18 22:03:31 +00:00
Happy-melon
91e7b5a93c More cleanup in Block.php. Push Block::encodeExpiry() and Block::decodeExpiry() deeper into the callstack, to DatabaseBase for encode and Language for decode. The vast majority of callers of these functions are not handling block expiries, but expiries generally, particularly page protections. 2011-03-18 19:15:56 +00:00
Happy-melon
ad0e525ede First forays into the swamp of the Block.php backend:
* Move Block::parseExpiryInput() to the frontend SpecialBlock::parseExpiryInput()
* consolidate the several implementations of the MediaWiki:Ipblockoptions parsing into SpecialBlock::getSuggestedDurations()
2011-03-18 16:35:22 +00:00
Antoine Musso
0330258617 Underscore are not valid in language code
* Reject underscore in validation
* Still case unsensitive
* Corrected tests using underscore


Follow up r83160 which was a follow up of r82927 (language code validation)
2011-03-04 17:16:09 +00:00
Antoine Musso
93348f39d4 Fix language code validation (from r82927)
A language code may contains the underscore character (be_tarask)
and might as well be upper case (FR).

Add tests for Language::isValidBuiltInCode() against some language codes
2011-03-03 19:13:57 +00:00
Tim Starling
1e67922842 Followup for r81340:
* Allow any language code which consists entirely of valid title characters, and does not contain any path-traversal characters, to be customised via the uselang parameter. Language::isValidCode() represents this concept. 
* Add some shortcuts preventing Language and LocalisationCache from looking for localisation files for a language code which does not follow the usual form of language codes in MediaWiki, i.e. /[a-z-]*/. This concept is represented by Language::isValidBuiltInCode().
* Do not allow colon characters in file names, per Platonides' suggestion on CR.
2011-02-28 03:15:39 +00:00
Tim Starling
63f263b182 Revert r81576: The fact that there are two checks, one close to the inclusion and one exposed to the user, was a deliberate security measure. Only the fact that they are the same was intended to be temporary. 2011-02-28 02:35:57 +00:00
Sam Reed
7ebf2e5165 More function level documentation
Fixup some indenting
2011-02-19 00:44:38 +00:00
Philip Tzou
9babe5aa4f Follow r77452, r80492. Avoid to find sub-languages when load css/js messages. 2011-02-16 14:18:43 +00:00
Niklas Laxström
7694c67c99 * (bug 17160) Gender specific display text for User namespace
Second attempt for this thing..
2011-02-12 20:40:40 +00:00
Mark A. Hershberger
b4cee86beb w/s fixups 2011-02-12 04:06:22 +00:00
Platonides
834899a9cf Move LanguageGetMagic hook to its own function 2011-02-10 18:15:58 +00:00
Antoine Musso
979880b774 Avoid code duplication for Language::isValidCode
r81335 changed the way we validate language code by introducing:
  strcspn( $code, "/\\\000" ) !== strlen( $code )

That code was later made a function in r81340 but some conditional tests were
not updated to reflect this change.
2011-02-05 22:55:09 +00:00
Tim Starling
cecd6a37c5 Relax Language::isValidCode() to avoid breaking uselang hacks 2011-02-01 22:54:50 +00:00
Tim Starling
63394d63f5 (bug 27094) fix path traversal vulnerability 2011-02-01 22:43:58 +00:00
Philip Tzou
928181ad67 Follow up r77452. Follow mark's suggest to remove getCodeForMessage() and explain why use getPreferredVariant() instead of getCode(). 2011-01-18 07:59:53 +00:00
Tim Starling
eaeea84b44 * Introduced a non-dummy collation for $wgCategoryCollation, namely UCA with default tables.
* Added a maintenance script which generates a list of first letters. Unified Han are omitted for performance, and because they shouldn't be used as headings anyway. A future collation specific to Chinese would provide the KangXi radicals as "first letters".
* Provided a precomputed list of first letters. Used Unicode 6.0.0 data and ICU 4.2. 
* Moved collation functionality from Language to a Collation class hierarchy with factory function. Removed the recently-added methods from Language and updated all callers.
* Changed Title::getCategorySortkey() to separate its parts with a line break instead of a null character. All collations supported by the intl extension ignore the null character, i.e. "ab" == "a\0b". It would have required a lot of hacking to make it work.
* Fixed the uppercase collation to handle non-ASCII characters, redundantly with r80436. I don't think it's necessary to change the collation name as was done there, so I reverted that in the course of my conflict merge. A --force option to updateCollation.php might be nice though.
2011-01-17 14:02:22 +00:00
Brian Wolff
c79b4bdd21 Change the default collation from strtoupper to Language::uc, so that non-ascii characters get to play too.
I know the uppercase thing is just a standby until a real collation function is written. However in the
mean time, i think it'd be really weird for a wiki with $wgCapitalLinks = false to suddenly have
[[a]] and [[A]] sort under the same letter in a category page, but [[Ä]] and [[ä]] sort no where
near each other, even though on a capitalized wiki they would be the same page.

See discussion on r69816.

Also fix an issue with maintenance/updateCollation.php, where php thinks
that 'uppercase' == 0 (?!). I don't really know what the deal with that
is, but using a ! instead of == 0 seems to fix it. (Follow-up r69961)
2011-01-17 06:27:49 +00:00
Sam Reed
b2bfcc788a Documentation addition/tweaks 2011-01-10 04:44:33 +00:00
Niklas Laxström
15faf878e1 New method for making it easier for developers to get localised language names.
For now the core itself doesn't provide those, but extension can use the hook
to provide them. Callers should not except full coverage in every language.
2010-12-31 18:18:57 +00:00
Sam Reed
8068fe8cf9 Remove another usage of extract() 2010-12-30 03:00:45 +00:00
Chad Horohoe
c491085fd8 Revert r78903, r78904, r78905, r78906 (changing opendir() to use sfFinder class) per CR and wikitech-l objections.
It's arguable whether the code is cleaner either way, and adding all this code for the (relatively few) places we do file listings just isn't worth it.
2010-12-23 21:49:01 +00:00
X!
c4bdc6f4a1 Per discussion on mailing list, modifying some uses of opendir()/readdir()/closedir() to use new sfFinder class. 2010-12-23 18:20:13 +00:00
Mark A. Hershberger
aa08646a71 Misc whitespace changes, mostly EOL w/s and indention fixes so TAB = 4 spaces 2010-12-19 04:31:15 +00:00
Niklas Laxström
39cfb5a1d6 Typo 2010-12-18 14:34:29 +00:00
Platonides
1920363bde Follow up r71459
Deprecate Language::convertLinkToAllVariants() now.
2010-12-01 00:30:35 +00:00
Sam Reed
5369be9e82 Qualify call to autoConvertToAllVariants from convertLinkToAllVariants in FakeConverter 2010-11-30 18:55:03 +00:00
Philip Tzou
881214d130 Select a friendly sub-language while acquiring system messages if the uselang has multiple variants available for use. 2010-11-30 03:04:47 +00:00
Alexandre Emsenhuber
7646fa870c Follow-up r65654:
* Per Hashar: added test cases
* Added some more round() to be really correct
2010-11-07 21:05:01 +00:00
Sam Reed
604ae0ca1c Update deprecated method calls
Remove some unused stuff
2010-10-31 16:20:48 +00:00
Philip Tzou
e6c51a4143 1. Revert the complicated redirection I made in r59754;
2. Add more Accept-Language XVO cache name for IE;
3. Use hreflang to specify canonical and alternate links, it's search engine friendly
   when a wiki has multiple variant languages.
2010-10-28 16:58:39 +00:00
Aaron Schulz
8947566ec1 truncateHtml() comment tweaks 2010-10-28 02:47:48 +00:00
Sam Reed
6b3b915353 Big attack on unused variables... 2010-10-14 20:53:04 +00:00
Niklas Laxström
9ad58598da * (Bug 25451) Language::time() and ::date() misfunction when given timestamps in wrong format
Convert given times to correct format like ::timeandate() already does.
Based on patch by Thorsten Glaser <tg@debian.org>.
2010-10-14 15:59:20 +00:00
Siebrand Mazeland
f11d7ed6b1 Follow-up r74173: remove more PHP pre-5.1.0 comments, including two TODOs. Yay. 2010-10-02 22:49:41 +00:00
Siebrand Mazeland
5b6e452020 Remove comment related to PHP pre-5.1 version. 2010-10-02 22:45:28 +00:00
Aryeh Gregor
980ed5d2b1 Get rid of Language::usesFirstLettersInLists()
Added by me in r69810, but never used.  It's not clear to me if it's
needed, but if so, it can be re-added later.
2010-09-05 20:43:00 +00:00